[CODE] Portal objects

From: Chuck Reed (creed@I-55.COM)
Date: 12/22/97


I have just implemented a new item type called OBJECT and re-did the
do_enter command.
The object is to make an "enterable" object.  The object is assigned a room
number to take you to in OLC. Everything is compiling nicely, but it creates
a segmentation fault (WOOHOO!).  Wait!  It gets even better!  The gdb stuff
is incomprehesible to me!  Here it is:

gdb) bt
#0  0x4004980e in ?? () from /lib/libc.so.6
#1  0x4009f75c in ?? () from /lib/libc.so.6
#2  0x4003ce4d in ?? () from /lib/libc.so.6
#3  0x40047503 in ?? () from /lib/libc.so.6
#4  0x40042ac1 in ?? () from /lib/libc.so.6
#5  0x80533f0 in do_enter (ch=0x811ac08, argument=0xbffff80d " axe", cmd=73,
    subcmd=0) at act.movement.c:459
#6  0x806ef8c in command_interpreter (ch=0x811ac08,
    argument=0xbffff808 "enter axe") at interpreter.c:683
#7  0x804a4dc in game_loop (mother_desc=3) at comm.c:642
#8  0x8049b07 in init_game (port=6002) at comm.c:255
#9  0x8049a98 in main (argc=3, argv=0xbffffd80) at comm.c:225

Now, for those interested in knowing what I have changed.

Structs.h
---------
added the following:
#define ITEM_PORTAL   <next item ##>
#define PORTAL_TO_ROOM 0

constants.c
-----------
"FOUNTAIN",
Added the following:
"PORTAL",

olc.h
-----
changed NUM_ITEM_TYPES to the new number

oedit.c
-------
set the cases for min_value and max_value for value[1] of PORTAL.

act.movement.c
--------------
removed the stock do_enter command
Added the following:

ACMD(do_enter)
{
   int to_room, mode;
   char arg1[MAX_INPUT_LENGTH], *buf1;
   struct obj_data *obj;
   struct char_data *tmp_char;

   one_argument(argument, arg1);

   if(!*arg1)
      send_to_char("What would you like to enter?\r\n", ch);
   else {

   mode = generic_find(arg1, FIND_OBJ_INV | FIND_OBJ_ROOM, ch, &tmp_char, &obj);
   if(!obj)
      send_to_char("There is nothing of that nature to enter here.\r\n", ch);
   else {
      if(obj->obj_flags.type_flag != ITEM_PORTAL)
         send_to_char("Yeah smart guy, you just try and enter that . .
.\r\n", ch);
      else {
      sprintf(buf1, "%d", obj->obj_flags.value[1]);
      to_room = find_target_room(ch, buf1);
      char_from_room(ch);
      char_to_room(ch, to_room);
      send_to_char(OK, ch);
      }
     }
    }
}

Well, that's about it i think.  If anyone has any ideas, I'd really
apreciate it.
Sorry for such a long message :)



+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+
| Chuck Reed                  | Ash of Dark Horizon          |
| creed@i-55.com              | dh.gator.net 6000            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+
"Losers always whine about their best while the winner goes
 home and fucks the prom queen." -Sean Connery


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST