Re: Trouble determining how to express something.

From: Thomas Arp (
Date: 08/30/02

From: "Mathew Earle Reuther" <graymere@ZIPCON.NET>
>   if ((zone_table[world[EXIT(ch,dir)->to_room].zone].status_mode != 1) &&

You should avoid all uses of magic numbers (in this case 1) in your code.
Also, status_mode could with little effort be made into a bitvector, making
it possible to set more flags than just this open/closed. Ie:

#define ZONE_FLAG_CLOSED (1<<0)
#define ZONE_NO_SUMMON   (1<<1)
#define ZONE_NO_MAGIC    (1<<2)

#define ZONE_FLAGS(zrn) (zone_table[(zrn)].status_mode)
#define ZONE_FLAGGED(zrn, flag) (IS_SET(ZONE_FLAGS(zrn), (flag))

The check above can the be written as
   if (ZONE_FLAGGED(world[EXIT(ch,dir)->to_room].zone, ZONE_FLAG_CLOSED)) &&

To further facilitate this, circle already has some very nice utilities
for handling bitvectors - sprintbits, asciiflag_conv, etc.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT