newarena, crashed by setting variable?

Posted by Zeno on Mon 14 Feb 2005 01:19 AM — 4 posts, 16,055 views.

USA #0
I can't figure this out now. I installed LrdElder's newarena, and after fixing up so much... There was this odd crash.
#0  0x0816da78 in do_end_game () at newarena.c:518
#1  0x0814dc53 in update_handler () at update.c:2331
#2  0x080bd0d3 in game_loop () at comm.c:707
#3  0x080bc941 in main (argc=8, argv=0xbff05ac0) at comm.c:317


#0  0x0816da78 in do_end_game () at newarena.c:518
518          time_left_in_game = 0;


(gdb) list
513               act(AT_TELL,"$n falls from the sky.", i, NULL, NULL, TO_ROOM);
514            }
515          }
516          sprintf(buf, "After %d hours of battle the Match is a draw.",game_length);
517          sportschan(buf);
518          time_left_in_game = 0;
519          ppl_in_arena=0;
520          ppl_challenged = 0;
521     }                                                                                                                    


The variable is int:
int time_left_in_game;


Not a single clue here.
USA #1
Chances are your evil is caused by a stack overflow somewhere. Given the complete ordinariness of the line, I'm almost certain it's something else.

If you still have Valgrind around this is a wonderful place to use it. It should also be much easier to reproduce than your other problems.
#2
there are 2 parts of that snippet that didn't work me me.

Make sure you add this

after your 'for' statement in

int num_in_arena()


for ( d = first_descriptor; d ; d = d->next )
{ if (d->character != NULL)




Mine looks like

      for ( d = first_descriptor; d ; d = d->next )
      { if (d->character != NULL) /*Klered - Perished Lands 01-19-01*/
        { if ( d->character->level >= lo_lim && d->character->level <= hi_lim)
            send_to_char(buf1, d->character);
          else
          { sprintf(buf, "The arena has been opened. %d hour(s) to start.\r\n", time_to_start);
            sprintf(buf, "%sPlace your bets!!!\r\n", buf);
            send_to_char(buf, d->character); } } }


as well as in

void start_arena()

mine looks like


for (d = first_descriptor; d; d = d->next)
  { if (d->character != NULL) /*Klered - Perished Lands 01-19-01*/
    { i = d->original ? d->original : d->character;
      if (IS_SET(i->in_room->room_flags,ROOM_ARENA))
      { if(i->level < LEVEL_IMMORTAL)
          num++; } } }


That really should help you out.
USA #3
Yeah I've already done something like that.

Also has anyone fixed the time? For example, it'll say something like "after -50 hours blah is the winner". It's quite a mess.

Arena: After -24 hours of battle Yakon is declared the winner.