Re: [CODE] Some input please for idea

From: Ebon Mists (mud@quake.cloudnet.com)
Date: 10/28/96


> Yep.  It's actually very easy to do this.  Just set up #define's for all
> the "global" variables that are actually instance variables in the
> different
> worlds.  For example, try:
> 
> struct World {
>    struct room_data *world;
>    int top_of_world;
>    ...
> };
> 
> Then, in your main program, have a global variable called current_realm:
> 
>    struct World *current_realm;
> 
> Whenever input is received from a player, the game sets current_realm to
> whatever World that player is currently in.  That's where your macros
> come
> in:
> 
>    #define WORLD           current_realm->world
>    #define TOP_OF_WORLD    current_realm->top_of_world
>    ...
> 
> Replace every instance of world in the source with WORLD, and
> top_of_world
> with TOP_OF_WORLD.  Take the same approach with all the other "world
> variables" in the game.  You then need some extra logic in the login
> sequence to assign realms to players, and a loop to go through all
> the World's and call the heartbeat functions such as pulse_violence.
> The database initialization has to fire up multiple worlds (you can
> again do a quick hack to make this work by using a World loop and
> calling all the DB init routines from inside it).
> 
> Don't forget to give each World its own lib directory, as well.  Your
> mileage may vary - you may want the worlds to share the wizhelp files
> but
> not the player help files, for example.

Dear lord... why spend all the time and effort... do as I did:
In the zone data add an: 
int realm;

And just set diffrent realsm to diffrent numbers, then add in some checks as
to who can see and hear what. 1 thousand times easier than splitting up
worlds and everything into diffrent structs.

Then again, my zones are linked lists now and I can find the number of the
zone a player is in with a simple: ch->in_room->zone->number;

Whatever, I just think that whole multi-world lists thing is more hassle
than it's worth.
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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