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, DotBot, Bing, Yandex

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
481
3,739
19,386
619
Alexander
Today's Birthdays
Scaythe (46)
Related Links
» SmaugMuds.org » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] Multiple problems with ...
Forum Rules | Mark all | Recent Posts

[Bug] Multiple problems with mpsleep support
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 15, 2008, 10:56 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: Multiple problems with mpsleep support
Danger: Medium - None of the problems lead to crashes, but the behavior of mpsleep is eratic at best.
Found by: Many people
Fixed by: Several people on Gammon's forums

---

mud_prog.c, mprog_driver

Locate:
      for( count = 0; count <= MAX_IFS; ++count )
      {
         for( count2 = 0; count2 < DO_ELSE; ++count2 )
            ifstate[count][count2] = current_mpsleep->ifstate[count][count2];
      }


Chage to:
      for( count = 0; count < MAX_IFS; ++count )
      {
         for( count2 = 0; count2 <= DO_ELSE; ++count2 )
            ifstate[count][count2] = current_mpsleep->ifstate[count][count2];
      }


Locate:
      /*
       * mpsleep - Check if we should sleep -rkb 
       */
      one_argument( cmnd, arg );
      if( !str_prefix( "mpsleep", cmnd ) )
      {
         if( ( ifstate[iflevel][IN_IF] == ifstate[iflevel][DO_IF] )
             && ( ifstate[iflevel][IN_ELSE] == ifstate[iflevel][DO_ELSE] ) )
         {
            CREATE( mpsleep, MPSLEEP_DATA, 1 );

            /*
             * State variables 
             */
            mpsleep->ignorelevel = ignorelevel;
            mpsleep->iflevel = iflevel;

            for( count = 0; count < MAX_IFS; ++count )
            {
               for( count2 = 0; count2 < DO_ELSE; ++count2 )
                  mpsleep->ifstate[count][count2] = ifstate[count][count2];
            }
         }

         /*
          * Driver arguments 
          */
         mpsleep->com_list = STRALLOC( command_list );
         mpsleep->mob = mob;
         mpsleep->actor = actor;
         mpsleep->obj = obj;
         mpsleep->vo = vo;
         mpsleep->single_step = single_step;

         /*
          * Time to sleep 
          */
         cmnd = one_argument( cmnd, arg );
         if( cmnd[0] == '\0' )
            mpsleep->timer = 4;
         else
            mpsleep->timer = atoi( cmnd );

         if( mpsleep->timer < 1 )
         {
            progbug( "mpsleep - bad arg, using default", mob );
            mpsleep->timer = 4;
         }

         /*
          * Save type of prog, room, object or mob 
          */
         if( mpsleep->mob->pIndexData->vnum == MOB_VNUM_SUPERMOB )
         {
            if( !str_prefix( "Room", mpsleep->mob->description ) )
            {
               mpsleep->type = MP_ROOM;
               mpsleep->room = mpsleep->mob->in_room;
            }
            else if( !str_prefix( "Object", mpsleep->mob->description ) )
               mpsleep->type = MP_OBJ;
         }
         else
            mpsleep->type = MP_MOB;

         LINK( mpsleep, first_mpsleep, last_mpsleep, next, prev );
         --prog_nest;
         return;
      }


Change to:
      /*
       * mpsleep - Check if we should sleep -rkb 
       */
      one_argument( cmnd, arg );
      if( !str_cmp( arg, "mpsleep" ) )
      {
         if( ( ifstate[iflevel][IN_IF] == TRUE && ifstate[iflevel][DO_IF] == FALSE ) ||  // if we are in an if/else and we
           ( ifstate[iflevel][IN_ELSE] == TRUE && ifstate[iflevel][DO_ELSE] == FALSE ) ) // dont want to execute, dont..
         {
         }
         else
         {
            CREATE( mpsleep, MPSLEEP_DATA, 1 );

            /*
             * State variables 
             */
            mpsleep->ignorelevel = ignorelevel;
            mpsleep->iflevel = iflevel;

            for( count = 0; count < MAX_IFS; ++count )
            {
               for( count2 = 0; count2 <= DO_ELSE; ++count2 )
                  mpsleep->ifstate[count][count2] = ifstate[count][count2];
            }

            /*
             * Driver arguments 
             */
            mpsleep->com_list = STRALLOC( command_list );
            mpsleep->mob = mob;
            mpsleep->actor = actor;
            mpsleep->obj = obj;
            mpsleep->vo = vo;
            mpsleep->single_step = single_step;

            /*
             * Time to sleep 
             */
            cmnd = one_argument( cmnd, arg );
            if( cmnd[0] == '\0' )
               mpsleep->timer = 4;
            else
               mpsleep->timer = atoi( cmnd );

            if( mpsleep->timer < 1 )
            {
               progbug( "mpsleep - bad arg, using default", mob );
               mpsleep->timer = 4;
            }

            /*
             * Save type of prog, room, object or mob 
             */
            if( mpsleep->mob->pIndexData->vnum == MOB_VNUM_SUPERMOB )
            {
               if( !str_prefix( "Room", mpsleep->mob->description ) )
               {
                  mpsleep->type = MP_ROOM;
                  mpsleep->room = mpsleep->mob->in_room;
               }
               else if( !str_prefix( "Object", mpsleep->mob->description ) )
                  mpsleep->type = MP_OBJ;
            }
            else
               mpsleep->type = MP_MOB;

            LINK( mpsleep, first_mpsleep, last_mpsleep, next, prev );
            --prog_nest;
            return;
         }
      }


mud.h, struct mpsleep_data

Locate:
bool ifstate[MAX_IFS][DO_ELSE];


Change to:
bool ifstate[MAX_IFS][DO_ELSE+1];


Introduced as an official Smaug 1.8 feature, mpsleep has actually been around for quite a long time as a snippet. Over the years a few problems were discovered with it and people have piecemealed fixes for it here and there. This is an attempt to fix the whole thing in one shot. If you use mpsleep and you get progs that execute all steps while ignoring the mpsleep delay, or you get delays where none are wanted, or you get corner case crashes with it, this fix should correct all of that.
       
Pages:<< prev 1 next >>