» SmaugMuds » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Mudprog ifchecks do not...
Pages:<< prev 1 next >>
#1 Sep 10, 2006 4:48 pm
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002
Bug: Mudprog ifchecks do not support proper nesting
Danger: Medium - Whoever enters the room first is going to get picked on more
Discovered in: AFKMud 1.77
Found by: Valcados
Fixed by: Valcados
---
mud_prog.c
Locate:
Below that, add:
mud_prog.c, mprog_driver
Locate:
Below that, add:
Locate:
Below that, add:
Uopn completion of the innermost block of script code, the supermob will end his duties for the program and return to his usual utility room. He should not do that as there is more prog to process.
Danger: Medium - Whoever enters the room first is going to get picked on more
Discovered in: AFKMud 1.77
Found by: Valcados
Fixed by: Valcados
---
mud_prog.c
Locate:
struct mpsleep_data { MPSLEEP_DATA *next; MPSLEEP_DATA *prev; CHAR_DATA *mob; CHAR_DATA *actor; OBJ_DATA *obj; void *vo; ROOM_INDEX_DATA *room; /* Room when type is MP_ROOM */ int timer; /* Pulses to sleep */ mp_types type; /* Mob, Room or Obj prog */ int ignorelevel; int iflevel; bool ifstate[MAX_IFS][DO_ELSE + 1]; char *com_list; bool single_step; };
Below that, add:
void uphold_supermob( int *curr_serial, int serial, ROOM_INDEX_DATA **supermob_room, OBJ_DATA *true_supermob_obj ) { if( *curr_serial != serial ) { char buf[128]; if( supermob->in_room != *supermob_room ) { char_from_room( supermob ); char_to_room( supermob, *supermob_room ); } if( true_supermob_obj && true_supermob_obj != supermob_obj ) { supermob_obj = true_supermob_obj; STRFREE( supermob->short_descr ); STRFREE( supermob->chardesc ); supermob->short_descr = QUICKLINK( supermob_obj->short_descr ); snprintf( buf, 128, "Object #%d", supermob_obj->pIndexData->vnum ); supermob->chardesc = STRALLOC( buf ); } else { if( !true_supermob_obj ) supermob_obj = NULL; STRFREE( supermob->short_descr ); STRFREE( supermob->chardesc ); supermob->short_descr = QUICKLINK( (*supermob_room)->name ); snprintf( buf, 128, "Room #%d", (*supermob_room)->vnum ); supermob->chardesc = STRALLOC( buf ); } *curr_serial = serial; } else *supermob_room = supermob->in_room; }
mud_prog.c, mprog_driver
Locate:
bool ifstate[MAX_IFS][DO_ELSE + 1]; static int prog_nest; MPSLEEP_DATA *mpsleep = NULL; char arg[MIL]; /* mpsleep */
Below that, add:
static int serial; int curr_serial; ROOM_INDEX_DATA *supermob_room; OBJ_DATA *true_supermob_obj; bool rprog_oprog = ( mob == supermob ); if( rprog_oprog ) { serial++; supermob_room = mob->in_room; true_supermob_obj = supermob_obj; } else true_supermob_obj = NULL, supermob_room = NULL; curr_serial = serial;
Locate:
/* * Evaluate/execute the command, check what happened. */ result = mprog_do_command( cmnd, mob, actor, obj, vo, rndm, ( ifstate[iflevel][IN_IF] && !ifstate[iflevel][DO_IF] ) || ( ifstate[iflevel][IN_ELSE] && !ifstate[iflevel][DO_ELSE] ), ( ignorelevel > 0 ) );
Below that, add:
if( rprog_oprog ) uphold_supermob( &curr_serial, serial, &supermob_room, true_supermob_obj );
Uopn completion of the innermost block of script code, the supermob will end his duties for the program and return to his usual utility room. He should not do that as there is more prog to process.
Pages:<< prev 1 next >>