Login
User Name:

Password:



Register

Forgot your password?
Overland with Bitmaps
Jul 4, 2025 11:57 pm
By Samson
void nanny_get_new_race -- comm.c
Mar 13, 2025 7:08 am
By Elwood
IPv6
Jan 25, 2025 10:45 pm
By Samson
mudstrlcpy and mudstrlcat
Jan 18, 2025 5:23 pm
By Samson
I3 and IMC
Jan 17, 2025 9:35 pm
By Samson
SWFotEFUSS 1.5.3
Author: Various
Submitted by: Samson
SWRFUSS 1.4.3
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.8
Author: Various
Submitted by: Samson
AFKMud 2.5.2
Author: AFKMud Team
Submitted by: Samson
SmaugFUSS 1.9.7
Author: Various
Submitted by: Samson
Users Online
Anthropic, Majestic-12, DotBot, Google, Amazonbot, Bing

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
507
3,812
19,727
601
PedroJooLu

» SmaugMuds » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Mudprog ifchecks do not...
Forum Rules | Mark all | Recent Posts

[Bug] Mudprog ifchecks do not support proper nesting
< Newer Topic :: Older Topic > AFKMud 1.77

Pages:<< prev 1 next >>
Post is unread #1 Sep 10, 2006 4:48 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,708
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:
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 >>