Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
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
LoP 1.46
Author: Remcon
Submitted by: Remcon
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
Users Online
CommonCrawl, Yahoo!, Google, Yandex

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » roomprogs/objprogs do not nes...
Forum Rules | Mark all | Recent Posts

roomprogs/objprogs do not nest correctly
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Sep 2, 2006, 10:20 am   Last edited Mar 10, 2008, 7:01 pm by Samson
Go to the top of the page
Go to the bottom of the page

Valcados
Apprentice
GroupMembers
Posts63
JoinedAug 25, 2006

More specifically, when the innermost roomprog/objprog ends, supermob will return to his utility room, as if his job is done.

NOTE: this fix assumes the fix I posted here is already done.

All changes below take place in mud_prog.c.

Find this:
#include "mud.h"


Below it, add this:
void uphold_supermob args(( int *curr_serial, int serial, ROOM_INDEX_DATA **supermob_room, OBJ_DATA *true_supermob_obj ));


In mprog_driver, declare new variables:
  static int serial;
  int curr_serial;
  ROOM_INDEX_DATA *supermob_room;
  OBJ_DATA *true_supermob_obj;
  bool rprog_oprog = ( mob == supermob );


Right below the new variables declared above, add this:

  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;


Find this:
      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 it, add this:
    if ( rprog_oprog )
      uphold_supermob( &curr_serial, serial, &supermob_room, true_supermob_obj );


Somewhere in mud_prog.c, for example at the very bottom, add this function:
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;
          if ( supermob->short_descr )
            STRFREE( supermob->short_descr );
          if ( supermob->description )
            STRFREE( supermob->description );
          supermob->short_descr = QUICKLINK( supermob_obj->short_descr );
          sprintf( buf, "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 );
          sprintf( buf, "Room #%d", (*supermob_room)->vnum );
          supermob->description = STRALLOC( buf );
        }
        *curr_serial = serial;
      }
      else
        *supermob_room = supermob->in_room;
}
       
Pages:<< prev 1 next >>