--- deliantra/server/include/map.h 2006/12/30 12:38:18 1.41 +++ deliantra/server/include/map.h 2007/01/01 12:28:47 1.46 @@ -98,7 +98,7 @@ #define P_IS_ALIVE 0x10 /* something alive is on this space */ #define P_NO_CLERIC 0x20 /* no clerical spells cast here */ -#define P_NEED_UPDATE 0x80 /* this space is out of date */ +#define P_UPTODATE 0x80 /* this space is up to date */ /* The following two values are not stored in the MapLook flags, but instead * used in the get_map_flags value - that function is used to return @@ -136,7 +136,7 @@ void update_ (); void update () { - if (flags_ & P_NEED_UPDATE) + if (!(flags_ & P_UPTODATE)) update_ (); } @@ -165,30 +165,31 @@ * Each map is in a given region of the game world and links to a region definiton, so * they have to appear here in the headers, before the mapdef */ +INTERFACE_CLASS (region) struct region : zero_initialised { - struct region *next; /* pointer to next region, NULL for the last one */ - const char *name; /* Shortend name of the region as maps refer to it */ - const char *parent_name; /* - * So that parent and child regions can be defined in - * any order, we keep hold of the parent_name during - * initialisation, and the children get assigned to their - * parents later. (before runtime on the server though) - * nothing outside the init code should ever use this value. - */ - struct region *parent; /* - * Pointer to the region that is a parent of the current - * region, if a value isn't defined in the current region - * we traverse this series of pointers until it is. - */ - const char *longname; /* Official title of the region, this might be defined - * to be the same as name*/ - const char *msg; /* the description of the region */ - uint32 counter; /* A generic counter for holding temporary data. */ - sint8 fallback; /* whether, in the event of a region not existing, - * this should be the one we fall back on as the default */ - char *jailmap; /*where a player that is arrested in this region should be imprisoned. */ - sint16 jailx, jaily; /* The coodinates in jailmap to which the player should be sent. */ + struct region *ACC (RW, next); /* pointer to next region, NULL for the last one */ + char *ACC (RW, name); /* Shortend name of the region as maps refer to it */ + char *ACC (RW, parent_name); /* + * So that parent and child regions can be defined in + * any order, we keep hold of the parent_name during + * initialisation, and the children get assigned to their + * parents later. (before runtime on the server though) + * nothing outside the init code should ever use this value. + */ + struct region *ACC (RW, parent); /* + * Pointer to the region that is a parent of the current + * region, if a value isn't defined in the current region + * we traverse this series of pointers until it is. + */ + char *ACC (RW, longname); /* Official title of the region, this might be defined + * to be the same as name*/ + char *ACC (RW, msg); /* the description of the region */ + uint32 ACC (RW, counter); /* A generic counter for holding temporary data. */ + sint8 ACC (RW, fallback); /* whether, in the event of a region not existing, + * this should be the one we fall back on as the default */ + char *ACC (RW, jailmap); /*where a player that is arrested in this region should be imprisoned. */ + sint16 ACC (RW, jailx), ACC (RW, jaily); /* The coodinates in jailmap to which the player should be sent. */ }; struct shopitems : zero_initialised @@ -232,6 +233,7 @@ uint32 ACC (RW, reset_timeout); /* How many seconds must elapse before this map * should be reset */ + bool ACC (RW, dirty); /* if true, something was inserted or removed */ bool ACC (RW, fixed_resettime); /* if true, reset time is not affected by * players entering/exiting map */ @@ -240,7 +242,7 @@ uint32 ACC (RW, in_memory); /* If not true, the map has been freed and must * be loaded before used. The map,omap and map_ob * arrays will be allocated when the map is loaded */ - sint16 ACC (RW, players); /* How many players are on this map right now */ + sint16 players; /* How many players are on this map right now */ uint16 ACC (RW, difficulty); /* What level the player should be to play here */ bool ACC (RW, per_player); @@ -269,19 +271,6 @@ maptile *ACC (RW, tile_map[4]); /* Next map, linked list */ shstr ACC (RW, path); /* Filename of the map */ -// /* -// * Makes sure the given map is loaded and swapped in. -// * name is path name of the map. -// * flags meaning: -// * 0x1 (MAP_FLUSH): flush the map - always load from the map directory, -// * and don't do unique items or the like. -// * 0x2 (MAP_PLAYER_UNIQUE) - this is a unique map for each player. -// * dont do any more name translation on it. -// * -// * Returns a pointer to the given map. -// */ -// static maptile *ready (const char *name, int flags); - MTH void activate (); MTH void deactivate (); @@ -298,6 +287,9 @@ MTH void set_darkness_map (); MTH int estimate_difficulty () const; + // set the given flag on all objects in the map + MTH void set_object_flag (int flag, int value = 1); + MTH void link_multipart_objects (); MTH void clear_unique_items (); @@ -331,34 +323,34 @@ MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0); - static maptile *find_map (const char *path, maptile *origin);//PERL - - // load a map relative to this one - maptile *find_map (const char *path) - { - return find_map (path, this); - } - - // customise this map for the given player - // might return this or a completely new map - maptile *customise_for (object *op); + MTH void touch () { last_access = runtime; } - // make sure the map is loaded - MTH bool load () - { - if (in_memory != MAP_IN_MEMORY) - do_load (); - - return spaces; - } +// static maptile *find_map (const char *path, maptile *origin);//PERL +// +// // load a map relative to this one +// maptile *find_map (const char *path) +// { +// return find_map (path, this); +// } +// +// // customise this map for the given player +// // might return this or a completely new map +// maptile *customise_for (object *op); +// +// void do_force_map_sync ();//PERL +// +// // make sure the map is loaded +// MTH void force_map_sync () +// { +// if (in_memory != MAP_IN_MEMORY) +// do_force_map_sync (); +// } + static maptile *load_map_sync (const char *path, maptile *original = 0);//PERL static void emergency_save ();//PERL mapspace const &at (uint32 x, uint32 y) const { return spaces [x * height + y]; } mapspace &at (uint32 x, uint32 y) { return spaces [x * height + y]; } - -private: - void do_load ();//PERL }; /* This is used by get_rangevector to determine where the other