Re: virtual/real variable types

From: Mysidia (jmhess@i-55.com)
Date: 12/04/01


> That'll still work, as long as you don't use 0.  Because -1 == 65535 (or
> 2^31) anyway, with appropriate bit sizes.  It's recommended to use the
> proper variable types though.

yeah.. appropriate bit sizes..
if you did:

int foo = real_room(1234);

then
if (foo > -1)
 ...

would always fail because  (unsigned int)-1 == INT_MAX
well, generally

there's code that treats vnums/rnums in a very bad manner even
in circle unless that's been fixed..

might be worthwhile to change a room_rnum into a typedef to catch
that sort of stuff and hide the need to mess with the structure of
a rnum inside a few select places .. ie, get rid of nasty array
accesses

typedef struct{u_short _val;} room_rnum;

...
#define ROOM_INFO(x) (&world[x._val])
#define GET_ROOM_CONTENTS(x) (world[x._val].contents)
etc
...so

int x = real_room(1234);

becomes illegal (incompatible types in assignment)

-Mysid

--
   +---------------------------------------------------------------+
   | 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 : 06/24/03 PDT