Re: VId: Changing of the VNums

From: Chris Jacobson (
Date: 04/04/99

On 4/4/99 10:22 PM, Del Minturn ( stated:

>The only problem I see with this, is you would have to add code to check
>all the zones for specific items/mobs/rooms instead of just one list.
>Not sure if I would like the idea of two or more items with the same
>number (granted it would have a different zone qualifier)
>Simplex 1
>Midgaard 1
>Thalos 1
>here is a problem, when you have two zones similar names
>what will separate them?
>oldthalos 1?
>The more I think about it.. the more I dislike the idea.

Actually with my system (LexiMUD) I wouldn't have a problem - I use a
map<VNum, *> class (actually a custom written one) that stores everything
in an AVL tree (sorta like a Red/Black).  Thus:

class VId {
     string    zone;
     UInt16    number;         //   Note: I use sign- and size-qualified

     bool operator <(const VId v);

bool VId::operator<(const VId v) {
     //   If VId::zone is a char *, use str_cmp
     if (zone < || (zone == && number < v.number))  return
     //   zone ==
     return false;  //   zone == && number >= v.number, or zone >

Finally, if you want some speedup, instead of string zone, use an index
into the zone list.

- Chris Jacobson

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

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