add new sector type

Posted by De Martino on Thu 15 Jul 2004 11:49 PM — 16 posts, 59,333 views.

Italy #0
Hi!
I desire to add new sector type in my smaugfuss
I desire to insert up to 39 sectors type. How can do it ?
Thanks

:)

De Martino
Australia Forum Administrator #1
Do you really need that many?

At present sector_type is a sh_int, which is 16 bits, and 15 are used. So, you would need to make it a long int to get 32 bits, which is still short of 39 (but close).

If you really want more than 32 you would need to use the extended bitvectors to fit more bits in.

eg. Change:

sh_int sector_type;

to

EXT_BV sector_type;

However then you would need to change the places that refer to sector types, change the load/save routines and so on.
Italy #2
Nick I have not understood, can you tell me even more?'
I don't find this string: sh_int sector_type

"change the load/save" as?
Would I need an explanation footstep footstep, possible?

De Martino
Amended on Fri 16 Jul 2004 08:48 AM by De Martino
USA #3
Why would he need to change the load/save types? sector_type is only a valid field in ROOM_INDEX_DATA and is not treated as a bitvector in the code. So a sh_int is plenty of room to hold up to 32767 sectors. 39 will be no problem whatsoever.

The BV_SECT_ values are only defined in mud.h and are not referenced anywhere in the 1.4a code. The intention was apparent, but it hasn't been followed through on and likely won't ever be officially since Smaug 2.0 has been shelved.
Italy #4
Samson I don't use smaug 1.4a but smaugfuss, in my code I don't find
BV_SECT.

:\

De Martino
Amended on Fri 16 Jul 2004 01:49 PM by De Martino
USA #5
The values are there, but that's not what you need anyway. The list where SECT_INSIDE is located is what you want to edit.
Canada #6
You also need to change 3 arrays in act_move.c. They are near the top:

char * const sect_names[SECT_MAX][2]
const int sent_total[SECT_MAX]
char * const room_sents[SECT_MAX][25]
Italy #7
I desire at least to have 32 sectors type
as I have to change these arrayses:

char * const sect_names[SECT_MAX][2]
const int sent_total[SECT_MAX]
char * const room_sents[SECT_MAX][25]

As?
Thanks Greven

De Martino
USA #8
you have to adjust those 2 numbers, [2] and [25] to what you need them to be, count up your sectors your adding and replace the total number over those two
Australia Forum Administrator #9
Sorry, I got confused by this code:


/*
 * New bit values for sector types.  Code by Mystaric
 */
 #define BVSECT_INSIDE 			BV00
 #define BVSECT_CITY 			BV01
 #define BVSECT_FIELD 			BV02
 #define BVSECT_FOREST 			BV03

... and so on


Of course, something cannot be inside and also outside, so the bits are not being used in that way.

Perhaps get rid of that, Samson, it is just confusing?
USA #10
Yeah. As I said, those BV_SECT values are never even used, so I guess they may as well be taken out to avoid confusion.
Italy #11
Quote:
Mike Scherling

writes:
you have to adjust those 2 numbers, [2] and [25]


Dear Mike I desire to have 39 sectors type, change
the two numbers [2] and [25]--> in [2] and [39]?
How do I have to do?

De Martino
Amended on Sat 17 Jul 2004 02:51 PM by De Martino
Italy #12
i've defined the sector in "typedef enum {..} sector_types;", in mud.h, but i get the same error when i start the server: "[*****] BUG: Fread_rooms: vnum 230 has bad sector_type 28."
I must define the sector in others files?

De Martino
Canada #13
That code is here in load_rooms:
	if (pRoomIndex->sector_type < 0 || pRoomIndex->sector_type >= SECT_MAX)
	{
	  bug( "Fread_rooms: vnum %d has bad sector_type %d.", vnum ,
	      pRoomIndex->sector_type);
	  pRoomIndex->sector_type = 1;
	}
Damned inconsistencies. Any ways, how did you define the enum list? Did you add to the very end of the list, like this:
typedef enum
{
  SECT_INSIDE, SECT_CITY, SECT_FIELD, SECT_FOREST, SECT_HILLS, SECT_MOUNTAIN,
  SECT_WATER_SWIM, SECT_WATER_NOSWIM, SECT_UNDERWATER, SECT_AIR, SECT_DESERT,
  SECT_DUNNO, SECT_OCEANFLOOR, SECT_UNDERGROUND, SECT_LAVA, SECT_SWAMP,
  SECT_MAX, SECT_MOON, SECT_MARS
} sector_types;
? If so, move SECT_MAX to the end of the list instead, like this:
typedef enum
{
  SECT_INSIDE, SECT_CITY, SECT_FIELD, SECT_FOREST, SECT_HILLS, SECT_MOUNTAIN,
  SECT_WATER_SWIM, SECT_WATER_NOSWIM, SECT_UNDERWATER, SECT_AIR, SECT_DESERT,
  SECT_DUNNO, SECT_OCEANFLOOR, SECT_UNDERGROUND, SECT_LAVA, SECT_SWAMP, SECT_MOON, SECT_MARS
  SECT_MAX
} sector_types;
. Or if SECT_MAX is the last one, did you make clean when you recompiled?
Amended on Sat 17 Jul 2004 04:41 PM by Greven
USA #14
on those sector splits up there ^^^^^



If im correct, isnt there also a #define or something that says how many there are, youd have to change the number.. and i -think- that in one of the files (cant remember which one) it said something baout not addin ganymore then 36 sectors... I might have been confusing somethign else with that though, if i was looking at y code i could confirm this.. but also, I am running the C++ version with smaugwiz, so it could be different
#15
Damn, I've the same problem...

And if I delete the following?

if (pRoomIndex->sector_type < 0 || pRoomIndex->sector_type >= SECT_MAX)
{
bug( "Fread_rooms: vnum %d has bad sector_type %d.", vnum ,
pRoomIndex->sector_type);
pRoomIndex->sector_type = 1;
}