Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Google, DotBot

Members: 0
Guests: 9
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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, 2:48 pm
Go to the top of the page
Go to the bottom of the page

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