DB.c Check_bitvector_names

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 3 weeks ago #8636 by cunning
DB.c Check_bitvector_names was created by cunning
I am not very good with Bitwise operations and as such I have not had time to solve this. However, it happens on every single 32 bit.... AKA "F" always returns an error. No matter which parser is checking the bitvector. I validated it on a few things. If the 32 bit is present, i get an error on all bitvectors. I have included just a small subset, as stated, all "bitvectors" fail if the very last BIT is used. I tried to simulate on tbamud-2020 but i did not see anything using the last Bitvector by looking at structs.h to see what was defined.

SYSERR: room #702 has unknown room flag, bit 39 (0 through 32 known).
SYSERR: room #702 has unknown room flag, bit 42 (0 through 32 known).
SYSERR: room #702 has unknown room flag, bit 63 (0 through 32 known).
SYSERR: room #703 has unknown room flag, bit 39 (0 through 32 known).
SYSERR: room #703 has unknown room flag, bit 42 (0 through 32 known).
SYSERR: room #703 has unknown room flag, bit 63 (0 through 32 known).
SYSERR: room #704 has unknown room flag, bit 39 (0 through 32 known).
SYSERR: room #704 has unknown room flag, bit 42 (0 through 32 known).
SYSERR: room #704 has unknown room flag, bit 63 (0 through 32 known).
SYSERR: room #705 has unknown room flag, bit 39 (0 through 32 known).
SYSERR: room #705 has unknown room flag, bit 42 (0 through 32 known).
SYSERR: room #705 has unknown room flag, bit 63 (0 through 32 known).
SYSERR: room #706 has unknown room flag, bit 39 (0 through 32 known).
SYSERR: room #706 has unknown room flag, bit 42 (0 through 32 known).
SYSERR: room #706 has unknown room flag, bit 63 (0 through 32 known).
SYSERR: mob vnum 7703 has unknown mobile flag, bit 35 (0 through 34 known).
SYSERR: mob vnum 7703 has unknown mobile flag, bit 41 (0 through 34 known).
SYSERR: mob vnum 7703 has unknown mobile flag, bit 45 (0 through 34 known).
SYSERR: mob vnum 7703 has unknown mobile flag, bit 52 (0 through 34 known).
SYSERR: mob vnum 7703 has unknown mobile flag, bit 56 (0 through 34 known).
SYSERR: mob vnum 7703 has unknown mobile flag, bit 57 (0 through 34 known).
SYSERR: mob vnum 7703 has unknown mobile flag, bit 63 (0 through 34 known).

SYSERR: Object #11803 (a cloth nappy) has unknown object wear flag, bit 26 (0 through 18 known).
SYSERR: Object #11803 (a cloth nappy) has unknown object wear flag, bit 37 (0 through 18 known).
SYSERR: Object #11803 (a cloth nappy) has unknown object wear flag, bit 58 (0 through 18 known).

Please Log in or Create an account to join the conversation.

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 3 weeks ago #8637 by cunning
Replied by cunning on topic DB.c Check_bitvector_names
static int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits)
{
  unsigned int flagnum = 0;
  bool error = FALSE;

  /* See if any bits are set above the ones we know about. */
  if (bits <= (~(bitvector_t) 0 >> (sizeof(bitvector_t) * 8 - namecount)))
    return (FALSE);

  for (flagnum = namecount; flagnum < sizeof(bitvector_t) * 8; flagnum++)
    if ((1 << flagnum) & bits) {
      log("SYSERR: %s has unknown %s flag, bit %d (0 through %d known).", whatami, whatbits, flagnum, (int)namecount - 1);
      error = TRUE;
    }

  return (error);
}

Please Log in or Create an account to join the conversation.

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 3 weeks ago #8638 by cunning
Replied by cunning on topic DB.c Check_bitvector_names
Just an example of my Room bits.

* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */
#define ROOM_DARK                                         0 //A
#define ROOM_DEATH                                        1 //B
#define ROOM_NO_MOB                                       2 //C
#define ROOM_INDOORS                                      3 //D
#define ROOM_NO_STORM_ENTRANCE                            4 //E
#define ROOM_DUMP                                         5 //F
#define ROOM_MOVING                                       6 //G
#define ROOM_NO_MAGIC                                     7 //H
#define ROOM_MOB_MAGIC_ONLY                               8 //I
#define ROOM_PRIVATE                                      9 //J
#define ROOM_PEACEFUL                                     10 //K
#define ROOM_GODROOM                                      11 //L
#define ROOM_NOCRIME                                      12 //M
#define ROOM_CAMPSITE                                     13 //N
#define ROOM_SOUNDPROOF                                   14 //O
#define ROOM_BFS_MARK                                     15 //P (R)
#define ROOM_SHADOW                                       16 //Q
#define ROOM_MDARK                                        17 //R
#define ROOM_NPC_DEATH                                    18 //S
#define ROOM_OVERWHELMING_EVIL                            19 //T
#define ROOM_OVERWHELMING_GOOD                            20 //U
#define ROOM_NO_SLEEP                                     21 //V
#define ROOM_TIMED_DT                                     22 //W
#define ROOM_LOW_LIGHT                                    23 //X
#define ROOM_WORLDMAP                                     24 //Y   /**< World-map style maps here */
#define ROOM_CURRENT                                      25 //Z
#define ROOM_NOTRACK                                      26 //a
#define ROOM_HOUSE                                        27 //b
#define ROOM_HOUSE_CRASH                                  28 //c
#define ROOM_ATRIUM                                       29 //d
#define ROOM_OLC                                          30 //e
#define ROOM_NO_TELEPORT                                  31 //f
#define ROOM_NOASTRAL                                     32 //A1

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #8639 by Rumble
Replied by Rumble on topic DB.c Check_bitvector_names
It looks like you imported World files from another MUD with room/obj flags greater than your 32/18. You would have to manually remove those higher number flags from those World files.

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 3 weeks ago #8642 by cunning
Replied by cunning on topic DB.c Check_bitvector_names
I have been using the same for years... aka Jedimud.

Everything works, displays, stats, functionality. Only this check of bitvectors does not work when I use the last bitvector. In each group of 32

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #8643 by Rumble
Replied by Rumble on topic DB.c Check_bitvector_names
What is your max number of room flags set at in structs.h. It should be highest #+1.

in TBA it is:
#define NUM_ROOM_FLAGS 17

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 3 weeks ago #8644 by cunning
Replied by cunning on topic DB.c Check_bitvector_names
/** The total number of Room Flags */
#define NUM_ROOM_FLAGS 33 /* Jedi specific */

As stated it is every bitvector that uses "F". So its not just Rooms, but objects, zones, every thing I have that has past 31 bits.

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago - 1 year 3 weeks ago #8645 by doggo
Replied by doggo on topic DB.c Check_bitvector_names
It's not the room flag 32 that's causing problems, you're getting boot errors for room flags that go beyond 32.

From the very first line you're trying to load room flag 39.
SYSERR: room #702 has unknown room flag, bit 39 (0 through 32 known).
You're trying to use flags you don't have.
Last edit: 1 year 3 weeks ago by doggo.

Please Log in or Create an account to join the conversation.

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 2 weeks ago #8650 by cunning
Replied by cunning on topic DB.c Check_bitvector_names
Not true at all. I use a-zABCDEF

And in the game I have no issues using the flags or displaying them.

Please Log in or Create an account to join the conversation.

More
1 year 2 weeks ago #8651 by Rumble
Replied by Rumble on topic DB.c Check_bitvector_names
That is an odd one, perhaps look everywhere "ROOM_DUMP" is used to see if it is modifying the value?

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 2 weeks ago #8658 by cunning
Replied by cunning on topic DB.c Check_bitvector_names
Working on it. I have reverted my old school jedimud flags we used for 30 new years which was upper case then over case. I'll see how that works. I'm also about to test my flags on tbamud-2020 to see if I get the same result

Please Log in or Create an account to join the conversation.

More
11 months 4 days ago #8771 by Plex
Replied by Plex on topic DB.c Check_bitvector_names
I’ve noticed the same issue. Errors are reported when using bit 32 and higher. To test this I used the 2020 release and added object affect flags and then created a new object using bits 4 (DET-ALIGN) and 32 (NEW31). The SYSERR for bit 35 doesn’t appear until bit 32 is added. Removing bit 4 will cause the bit 35 error to go away. Using more bits above 32 will result in additional errors.

Jun 10 11:27:36 2020 :: Loading objs and generating index.
Jun 10 11:27:36 2020 :: 4767 objs, 152544 bytes in index, 1144080 bytes in prototypes.
Jun 10 11:27:36 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 35 (0 through 34 known).
Jun 10 11:27:36 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 63 (0 through 34 known).

From the .obj file – Flags are correct.
#1250
unfinished object~
an unfinished object~
An unfinished object is lying here.~
~
0 0 0 0 0 a 0 0 0 dF 0 0 0
0 0 0 0
0 0 0 0 0

oedit 1250
-- Item number : [1250]
1) Keywords : unfinished object
2) S-Desc : an unfinished object
3) L-Desc :-
An unfinished object is lying here.
4) A-Desc :-
Not Set.
5) Type : UNDEFINED
6) Extra flags : NOBITS
7) Wear flags : TAKE
8) Weight : 0
9) Cost : 0
A) Cost/Day : 0
B) Timer : 0
C) Values : 0 0 0 0
D) Applies menu
E) Extra descriptions menu: Not Set.
M) Min Level : 0
P) Perm Affects: DET-ALIGN NEW31
S) Script : Not Set.
W) Copy object
X) Delete object
Q) Quit
Enter choice :

Enter choice : p
1) BLIND 2) INVIS
3) DET-ALIGN 4) DET-INVIS
5) DET-MAGIC 6) SENSE-LIFE
7) WATWALK 8) SANCT
9) GROUP 10) CURSE
11) INFRA 12) POISON
13) PROT-EVIL 14) PROT-GOOD
15) SLEEP 16) NO_TRACK
17) FLY 18) SCUBA
19) SNEAK 20) HIDE
21) UNUSED 22) CHARM
23) NEW23 24) NEW24
25) NEW25 26) NEW26
27) NEW27 28) NEW28
29) NEW29 30) NEW30
31) NEW31 32) NEW32
33) NEW33 34) NEW34

Object permanent flags: DET-ALIGN NEW31
Enter object perm flag (0 to quit) :

To test this the following changes were made.

From structs.h
#define AFF_HIDE 20 /**< Char is hidden */
#define AFF_FREE 21 /**< Room for future expansion */
#define AFF_CHARM 22 /**< Char is charmed */
#define AFF_NEW23 23
#define AFF_NEW24 24
#define AFF_NEW25 25
#define AFF_NEW26 26
#define AFF_NEW27 27
#define AFF_NEW28 28
#define AFF_NEW29 29
#define AFF_NEW30 30
#define AFF_NEW31 31
#define AFF_NEW32 32
#define AFF_NEW33 33
#define AFF_NEW34 34


/** Total number of affect flags not including the don't use flag. */
#define NUM_AFF_FLAGS 35

From contants.c - affected_bits
"HIDE",
"UNUSED",
"CHARM",
"NEW23",
"NEW24",
"NEW25",
"NEW26",
"NEW27",
"NEW28",
"NEW29",
"NEW30",
"NEW31",
"NEW32",
"NEW33",
"NEW34",

"\n"
};

Please Log in or Create an account to join the conversation.

More
11 months 3 days ago #8772 by Plex
Replied by Plex on topic DB.c Check_bitvector_names
Check_bitvector_names will never work as intended. Check_object passes in 32 bits at a time. Check_bitvector_names puts these 32 bits into a 64 bit variable and looks for invalid bits between 35 and and 64. These bits wouldn’t even exist in the first element of the array. They would be in the second element, but this would get processed the same way. The second element gets passed in and the code evaluates bits 35 thru 64. In order for this to produce valid results we would have to look at the entire array as single chunk of 128 bits and look for any bit greater than 35. The easiest solution might be to pass in the array element so that the function can calculate which bit is actually being evaluated or just pass in the entire array.

From check_object
for(y = 0; y < TW_ARRAY_MAX; y++) {
error |= check_bitvector_names(GET_OBJ_WEAR(obj)[y], wear_bits_count, objname, "object wear");
error |= check_bitvector_names(GET_OBJ_EXTRA(obj)[y], extra_bits_count, objname, "object extra");
error |= check_bitvector_names(GET_OBJ_AFFECT(obj)[y], affected_bits_count, objname, "object affect");
}

GET_OBJ_AFFECT(obj)[y] – int
bits – unsigned long int
namecount – unsigned long int
flagnum – unsigned int

static int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits)
{
unsigned int flagnum;

for (flagnum = namecount; flagnum < sizeof(bitvector_t) * 8; flagnum++) {
if ((1 << flagnum) & bits) {

Attached is a proposed solution. It will produce the following errors for and object like this.

#1250
unfinished object~
an unfinished object~
An unfinished object is lying here.~
~
0 0 0 0 0 a 0 0 0 dF aF bF aF
0 0 0 0
0 0 0 0 0

Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 31 in element 1 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 1 in element 2 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 31 in element 2 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 0 in element 3 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 31 in element 3 (0 through 34 known).

File Attachment:

File Name: check_bitv...ames.txt
File Size:9 KB
Attachments:

Please Log in or Create an account to join the conversation.

  • cunning
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
10 months 3 days ago #8806 by cunning
Replied by cunning on topic DB.c Check_bitvector_names
Very nice. I suspected this all along, I just could not state it as elegant as you did

Please Log in or Create an account to join the conversation.

Time to create page: 0.142 seconds