Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, Sogou

Members: 0
Guests: 3
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWR FUSS Bugfix List » [Bug] Mudprog ifchecks do not...
Forum Rules | Mark all | Recent Posts

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

Pages:<< prev 1 next >>
Post is unread #1 Sep 10, 2006, 11:02 am   Last edited Sep 10, 2006, 11:03 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
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
Found by: Valcados
Fixed by: Valcados

---

mud.h

Locate:
extern CHAR_DATA *supermob;


Below that, add:
extern OBJ_DATA *supermob_obj;


db.c

Locate:
AUCTION_DATA *auction;  /* auctions */


Below that, add:
OBJ_DATA *supermob_obj;


mud_prog.c

Locate:
#include "mud.h"


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->description );
          supermob->short_descr = QUICKLINK( supermob_obj->short_descr );
          snprintf( buf, 128, "Object #%d", supermob_obj->pIndexData->vnum );
          supermob->description = STRALLOC( buf );
      }
      else
      {
         if( !true_supermob_obj )
            supermob_obj = NULL;
         if( supermob->short_descr )
            STRFREE( supermob->short_descr );
         if( supermob->description )
            STRFREE( supermob->description );
         supermob->short_descr = QUICKLINK( (*supermob_room)->name );
         snprintf( buf, 128, "Room #%d", (*supermob_room)->vnum );
         supermob->description = 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;


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 );


Locate:
void release_supermob(  )
{
   char_from_room( supermob );
   char_to_room( supermob, get_room_index( ROOM_VNUM_POLY ) );
}


Change to:
void release_supermob(  )
{
   supermob_obj = NULL;
   char_from_room( supermob );
   char_to_room( supermob, get_room_index( ROOM_VNUM_POLY ) );
}


mud_prog.c, set_supermob

Locate:
   if( !obj )
      return;


Below that, add:
   supermob_obj = 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 >>