On Mon, 4 Jun 2001, Daniel A. Koepke wrote:
>On Tue, 5 Jun 2001, Mike Breuer wrote:
>
>> Bit 32 (1 << 31) is the sign bit, so this could be a signed/unsigned
>> problem. A more likely cause might be that somewhere there is some
>> code that is not seeing the - sign as a digit, and is erroring at that
>> point. I would look carefully at the code that is parsing the mob
>> file, as it seems that that is where the problem is.
>
>Better yet change all bitvectors to be unsigned. There's no reason to
>encounter the problem with the sign bit at all and there's no reason to
>make the loading code handle such a case. All bitvectors should be
>unsigned. Don't be worried about breaking binary compatability: the
>binary representation does not change.
>
>It should be noted, however, that they don't appear to be in the stock
>code. I should change this.
You mean like this? It's part of the changes in my tree not yet merged.
Index: src/structs.h
===================================================================
RCS file: /home/circledb/.cvs/circle/src/structs.h,v
retrieving revision 1.35
diff -u -p -r1.35 structs.h
--- src/structs.h 2001/03/19 03:41:39 1.35
+++ src/structs.h 2001/05/18 17:50:40
@@ -557,15 +557,15 @@ struct extra_descr_data {
/* object flags; used in obj_data */
struct obj_flag_data {
- int value[4]; /* Values of the item (see list) */
- byte type_flag; /* Type of item */
- int /*bitvector_t*/ wear_flags; /* Where you can wear it */
- int /*bitvector_t*/ extra_flags; /* If it hums, glows, etc. */
- int weight; /* Weigt what else */
- int cost; /* Value when sold (gp.) */
- int cost_per_day; /* Cost to keep pr. real day */
- int timer; /* Timer for object */
- long /*bitvector_t*/ bitvector; /* To set chars bits */
+ int value[4]; /* Values of the item (see list)*/
+ byte type_flag; /* Type of item */
+ unsigned int /*bitvector_t*/ wear_flags; /* Where you can wear it */
+ unsigned int /*bitvector_t*/ extra_flags; /* If it hums, glows, etc. */
+ int weight; /* Weight, what else? */
+ int cost; /* Value when sold (gp.) */
+ int cost_per_day; /* Cost to keep per real day */
+ int timer; /* Timer for object */
+ bitvector_t bitvector; /* To set chars bits */
};
@@ -611,10 +611,10 @@ struct obj_file_elem {
sh_int location;
#endif
int value[4];
- int /*bitvector_t*/ extra_flags;
+ unsigned int /*bitvector_t*/ extra_flags;
int weight;
int timer;
- long /*bitvector_t*/ bitvector;
+ bitvector_t bitvector;
struct obj_affected_type affected[MAX_OBJ_AFFECT];
};
@@ -647,7 +647,7 @@ struct room_direction_data {
char *keyword; /* for open/close */
- sh_int /*bitvector_t*/ exit_info; /* Exit info */
+ ush_int /*bitvector_t*/ exit_info; /* Exit info */
obj_vnum key; /* Key's number (-1 for no key) */
room_rnum to_room; /* Where direction leads (NOWHERE) */
};
@@ -662,7 +662,7 @@ struct room_data {
char *description; /* Shown when entered */
struct extra_descr_data *ex_description; /* for examine/look */
struct room_direction_data *dir_option[NUM_OF_DIRS]; /* Directions */
- int /*bitvector_t*/ room_flags; /* DEATH,DARK ... etc */
+ unsigned int /*bitvector_t*/ room_flags; /* DEATH,DARK ... etc */
byte light; /* Number of lightsources in room */
SPECIAL(*func);
@@ -761,10 +761,9 @@ struct char_point_data {
struct char_special_data_saved {
int alignment; /* +-1000 for alignments */
long idnum; /* player's idnum; -1 for mobiles */
- long /*bitvector_t*/ act; /* act flag for NPC's; player flag for PC's */
+ bitvector_t act; /* act flag for NPC's; player flag for PC's */
- long /*bitvector_t*/ affected_by;
- /* Bitvector for spells/skills affected by */
+ bitvector_t affected_by; /* Bitvector for spells/skills affected by */
sh_int apply_saving_throw[5]; /* Saving throw (Bonuses) */
};
@@ -800,7 +799,7 @@ struct player_special_data_saved {
byte freeze_level; /* Level of god who froze char, if any */
sh_int invis_level; /* level of invisibility */
room_vnum load_room; /* Which room to place char in */
- long /*bitvector_t*/ pref; /* preference flags for PC's. */
+ bitvector_t pref; /* preference flags for PC's. */
ubyte bad_pws; /* number of bad password attemps */
sbyte conditions[3]; /* Drunk, full, thirsty */
@@ -867,7 +866,7 @@ struct affected_type {
sh_int duration; /* For how long its effects will last */
sbyte modifier; /* This is added to apropriate ability */
byte location; /* Tells which ability to change(APPLY_XXX)*/
- long /*bitvector_t*/ bitvector; /* Tells which bits to set (AFF_XXX) */
+ bitvector_t bitvector; /* Tells which bits to set (AFF_XXX) */
struct affected_type *next;
};
--
George Greer
greerga@circlemud.org
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/05/01 PST