Re: [Code] Problem!

From: Jack Wilson (deejay@cu-online.com)
Date: 12/17/96


Josh B. wrote:
>Hello, I was wondering if somebody could help me here.  Can anybody see
>why this would cause the mud to crash?

Yes, get a C book and find out what the number of the first element of
an array is.  Until you learn C, you will continue to encounter bizarre
problems like this one that you can't possibly solve without outside
help.

>This is in the interpreter.c file right as a new character logs on...
> 
>for (k=1;k <=13;k++) {
> obj=read_obj(newbie_eq[k], REAL);
> obj_to_char(obj, d->character);
>}
> 
> It crashes as soon as they press 1 to enter the game.  Here is my
> newbie_eq array if you need it.
> 
> int newbie_eq[13] = {3043, 3076, 3081, 3086, 3071, 5424, 5426, 5427
>                      12008, 3020, 7908, 3104, 3032};

Besides, this code is not robust.  Replace with:

for (k=<the magic number which you'll have to find out for yourself>;
     newbie_eq[k] >= 0; k++) {
   obj = read_obj(newbie_eq[k], REAL);
   obj_to_char(obj, d->character);
}

...

int newbie_eq[] = {3043, 3076, 3081, 3086, 3071, 5424, 5426, 5427
                   12008, 3020, 7908, 3104, 3032, -1};
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST