--- Alex <fletchra@QSILVER.QUEENSU.CA> wrote:
>> #0 0x42078f4a in strcmp () from /lib/i686/libc.so.6
>> #1 0x08114689 in sort_spells () at spec_guilds.c:64
>step up to this function, and take a look at the data. i'm betting that
>there's a strcmp() comparison to something that ends up being a NULL in
>there.
>Ae.
Sorry for my horrid posting manners previously :)
This is the code in question, But I fail to see the error in it?
void sort_spells(void)
{
int a, b=0, tmp;
/* initialize array */
for (a = 1; a < MAX_ABILITIES; a++)
spell_sort_info[a] = a;
/* Sort. 'a' starts at 1, not 0, to remove 'RESERVED' */
for (a = 1; a < MAX_ABILITIES - 1 && spell_sort_info[b]!='\n'; a++)
for (b = a + 1; b < MAX_ABILITIES; b++)
if (strcmp(spells[spell_sort_info[a]], spells[spell_sort_info[b]]) > 0)
{
tmp = spell_sort_info[a];
spell_sort_info[a] = spell_sort_info[b];
spell_sort_info[b] = tmp;
}
}
char *how_good(int percent)
{
static char buf[256];
if (percent == 0)
strcpy(buf, " /cw(/cc---------------/cw)/c0");
else if (percent <= 10)
strcpy(buf, " /cw(/cr=/cc--------------/cw)/c0");
else if (percent <= 20)
strcpy(buf, " /cw(/cr===/cc------------/cw)/c0");
else if (percent <= 30)
strcpy(buf, " /cw(/cr=====/cc----------/cw)/c0");
else if (percent <= 40)
strcpy(buf, " /cw(/cr=====/cy==/cc--------/cw)/c0");
else if (percent <= 50)
strcpy(buf, " /cw(/cr=====/cy====/cc------/cw)/c0");
else if (percent <= 60)
strcpy(buf, " /cw(/cr=====/cy=====/cg=/cc----/cw)/c0");
else if (percent <= 70)
strcpy(buf, " /cw(/cr=====/cy=====/cg==/cc---/cw)/c0");
else if (percent <= 80)
strcpy(buf, " /cw(/cr=====/cy=====/cg===/cc--/cw)/c0");
else if (percent <= 90)
strcpy(buf, " /cw(/cr=====/cy=====/cg====/cc-/cw)/c0");
else
strcpy(buf, " /cw(/cr=====/cy=====/cg=====/cw)/c0");
return (buf);
}
#define LEARNED_LEVEL 0 /* % known which is considered "learned" */
#define MAX_PER_PRAC 1 /* max percent gain in skill per practice */
#define MIN_PER_PRAC 2 /* min percent gain in skill per practice */
#define PRAC_TYPE 3 /* should it say 'spell' or 'skill'? */
#define LEARNED(ch) (prac_params[LEARNED_LEVEL][(int)GET_CLASS(ch)])
#define MINGAIN(ch) (prac_params[MIN_PER_PRAC][(int)GET_CLASS(ch)])
#define MAXGAIN(ch) (prac_params[MAX_PER_PRAC][(int)GET_CLASS(ch)])
#define ABIL(ch) (prac_types[prac_params[PRAC_TYPE][(int)GET_CLASS(ch)]])
Of coarse it is prolly stareing me right in the face.
R.W.
_____________________________________________________________
Are you a Techie? Get Your Free Tech Email Address Now! Visit http://www.TechEmail.com
_____________________________________________________________
Select your own custom email address for FREE! Get you@yourchoice.com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/26/03 PDT