Re: long vs. int

From: Paul Cole (pcole@ccwf.cc.utexas.edu)
Date: 09/21/95


On Wed, 20 Sep 1995, Sean Mountcastle wrote:

> 
> 	I have two questions, and not a very good subject line ;)
> 
> 	First, since the bitvectors start off at 0, if the maximum 
> bitvector 2^31 or 2^32 (21474883648 or 4294967296) that can be contained 
> in the long variable?  Pretty easy question eh?  I know, I know, but I 
> forgot and can't seem to find it.

There are 32 bits in a standard long value.  That means you have from bit
values 2^0 to 2^31 to play with < or (1<<0) to (1<<31) in c speak >. 

> 	Next, I've tried to change all the references to vnums and rnums 
> to long from int, so I can increase the total number of rooms/obj/mobs in 

You mean from int to long don't you?  an int has a smaller range than a
long. An int is normally 16 bits <2 bytes>, and a long is normally 32 bits
<4 bytes>. And then there's the infamous long long which is 8 bytes but I
highly recommend not using it just yet, its not terribly portable because
only the most recent gcc versions understand it.  Not to mention that 
long long mathematics is extremely slow.

> the game - this seems to have no effect, except when I change the line in 
> db.c if (nr >= 99999) return;  I made this much larger to reflect the 
> nature of long integers, but everytime I do this the MUD crashes upon 
> boot-up with the error message: Room %ld is outside of any zone (%ld = 
> virtual_nr) this is shortly after the if statement (++zone > 
> top_of_zone_table)  - anyway I can fix this?

Yes there is an easy way to fix it, probably. Although I'm not entirely
familiar with the way circle has its zone database setup, I know its split
into a directory heirarchy and mine isn't, but I'll explain what generates
that message in my format, its probably still relevent. 

There is probably a value in each zone header which states the last room
in the zone, is there not?  If so, try changing the last zone's
top_of_zone number to a sufficiently high value in order to encompass your
largest room number.   I simply have a last zone that is completely empty 
and has its top_of_zone set to the largest possible room and be done with it.

You see, when it loads in the rooms, it tries to assign a zone value to 
each one but if the room doesn't fit into any zone, it bitches about it.

Since circle uses a split zone heirarchy, I would have expected the 
top_of_zone value to be determined from the zone content but aparently not.

  --Paul



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