Turning room flags into extended bit vectors and getting errors

Posted by Mopop on Sun 11 Dec 2005 04:26 AM — 16 posts, 62,825 views.

#0
I have used a guide to turn my room flags into extended bit vectors and ive had quite a problem with this error, I managed to get it down to 3 errors.

build.c: In function `fold_area':
build.c:6192: warning: int format, pointer arg (arg 3)
build.c:6194: warning: int format, pointer arg (arg 3)

mapout.c: In function `add_new_room_to_map':
mapout.c:365: `rm' undeclared (first use in this function)
mapout.c:365: (Each undeclared identifier is reported only once
mapout.c:365: for each function it appears in.)

Here is 6192 and 6194 of build.c

                  room->sector_type, room->tele_delay, room->tele_vnum, room->tunnel );

      fprintf( fpout, "0 %d %d\n", print_bitvector(&room->room_flags), room->sector_type );


mapout.c 365

          xSET_BITS(location->room_flags, rm->room_flags);


USA #1
This is what I have:
build.c:
          fprintf( fpout, "0 %s %d %d %d %d\n", print_bitvector(&room->room_flags),
                                                room->sector_type,
                                                room->tele_delay,
                                                room->tele_vnum,
                                                room->tunnel            );


mapout:
            xSET_BITS(location->room_flags, rm->room_flags);

Looks like you forgot to declare rm in the mapout code?
#2
I guess so The above code doesnt look any different...and im not exactly sure what rm is x_x is it remove?
USA #3
Well it should be a room data index. As for the first code, the %d was changed to a %s.
#4
Rock on that fixed the first code up, where would i find the room data indexes at? Thanks alot Zeno you are so helpfull =P
USA #5
Can you show me the instruction in the guide that told you to add that line in mapout?
#6
sure thing.

mapout.c

location -> room_flags = ROOM_PROTOTYPE && rm -> room_flags;
becomes

xCLEAR_BITS(location->room_flags);
xSET_BITS(location->room_flags, rm->room_flags);
xSET_BIT(location->room_flags, ROOM_PROTOTYPE);
USA #7
Well since you had a rm in the previous mapout, which was changed, it should be fine. Seems like you did something wrong?
location -> room_flags = ROOM_PROTOTYPE && rm -> room_flags;
#8
Im not too sure what was done wrong, I followed the guide word for word. Any idea where to even look for an error?
USA #9
Revert mapout.c to the original state? If it compiles, then rm was declared and you for some reason had removed that declaration. I don't even know if it's initialized now, so declaring it may not do much.
#10
I just removed it all together, since mapout is just used to making maps. And I dont like those maps...Now my problem is when i try to put a flag on a room it sets it as a different flag x_x
USA #11
What's the lines in do_redit that sets the flag?
#12

 if( !str_cmp( arg, "flags" ) )
   {
      if( !argument || argument[0] == '\0' )
      {
         send_to_char( "Toggle the room flags.\n\r", ch );
         send_to_char( "Usage: redit flags <flag> [flag]...\n\r", ch );
         return;
      }
      while( argument[0] != '\0' )
      {
         argument = one_argument( argument, arg2 );
         value = get_rflag( arg2 );
         if( value < 0 || value > MAX_BITS )
            ch_printf( ch, "Unknown flag: %s\n\r", arg2 );
         else
         {
            if( 1 << value == ROOM_PROTOTYPE && get_trust( ch ) < LEVEL_GREATER )
               send_to_char( "You cannot change the prototype flag.\n\r", ch );
            else
               xTOGGLE_BIT( location->room_flags, 1 << value );
}
      }
      return;
   }


#13
Ooh i got the error fixed, thanks for your help bro!
USA #14
You really should post how you fixed it so others will know if they run into the same problem.
#15
xTOGGLE_BIT( location->room_flags, 1 << value );

xTOGGLE_BIT( location->room_flags, value );

I forgot to remove the 1 <<