--- deliantra/server/include/map.h 2009/11/09 18:47:56 1.121 +++ deliantra/server/include/map.h 2010/03/26 00:59:21 1.129 @@ -1,9 +1,9 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * Copyright (©) 2002-2005,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002-2005 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -206,7 +206,7 @@ } }; -// a rectangular area of a map +// a rectangular area of a map, used my split_to_tiles/unordered_mapwalk struct maprect { maptile *m; @@ -283,13 +283,6 @@ uint16 ACC (RW, enter_x); /* enter_x and enter_y are default entrance location */ uint16 ACC (RW, enter_y); /* on the map if none are set in the exit */ oblinkpt *buttons; /* Linked list of linked lists of buttons */ - sint16 ACC (RW, temp); /* base temperature of this tile (F) */ - sint16 ACC (RW, pressure); /* barometric pressure (mb) */ - sint8 ACC (RW, humid); /* humitidy of this tile */ - sint8 ACC (RW, windspeed); /* windspeed of this tile */ - sint8 ACC (RW, winddir); /* direction of wind */ - sint8 ACC (RW, sky); /* sky conditions */ - int ACC (RW, worldpartx), ACC (RW, worldparty); /*Highly fasten conversion between worldmap and weathermap */ struct shopitems *shopitems; /* a semi-colon seperated list of item-types the map's shop will trade in */ shstr ACC (RW, shoprace); /* the preffered race of the local shopkeeper */ double ACC (RW, shopgreed); /* how much our shopkeeper overcharges */ @@ -321,6 +314,7 @@ // deallocates the mapspaces (and destroys all objects) MTH void clear (); + MTH void post_load (); // update cached values in mapspaces etc. MTH void fix_auto_apply (); MTH void do_decay_objects (); MTH void update_buttons (); @@ -328,7 +322,7 @@ MTH int estimate_difficulty () const; MTH void play_sound (faceidx sound, int x, int y) const; - MTH void say_msg (const char *msg, int x, int y) const; + MTH void say_msg (const_utf8_string msg, int x, int y) const; // connected links oblinkpt *find_link (shstr_tmp id); @@ -356,11 +350,11 @@ // save objects into the given file (uses IO_ flags) bool _save_objects (object_freezer &freezer, int flags); - MTH bool _save_objects (const char *path, int flags); + MTH bool _save_objects (const_octet_string path, int flags); // save the header pseudo object _only_ bool _save_header (object_freezer &freezer); - MTH bool _save_header (const char *path); + MTH bool _save_header (const_octet_string path); maptile (); maptile (int w, int h); @@ -397,9 +391,9 @@ void make_map_floor (char **layout, char *floorstyle, random_map_params *RP); bool generate_random_map (random_map_params *RP); - static maptile *find_async (const char *path, maptile *original = 0, bool load = true);//PERL - static maptile *find_sync (const char *path, maptile *original = 0);//PERL - static maptile *find_style_sync (const char *dir, const char *file = 0);//PERL + static maptile *find_async (const_utf8_string path, maptile *original = 0, bool load = true);//PERL + static maptile *find_sync (const_utf8_string path, maptile *original = 0);//PERL + static maptile *find_style_sync (const_utf8_string dir, const_utf8_string file = 0);//PERL object *pick_random_object (rand_gen &gen = rndm) const; mapspace &at (uint32 x, uint32 y) const { return spaces [x * height + y]; } @@ -407,9 +401,7 @@ // return an array of maprects corresponding // to the given rectangular area. the last rect will have // a 0 map pointer. - // the array will be stored in a static memory area, - // so recursion is not atm. supported - maprect *split_to_tiles (int x0, int y0, int x1, int y1); + maprect *split_to_tiles (dynbuf &buf, int x0, int y0, int x1, int y1); }; //+GPL @@ -555,6 +547,8 @@ } \ } +extern dynbuf mapwalk_buf; // can be used in simple non-recursive situations + // loop over every space in the given maprect, // setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0 // the iterator code must be a single statement following this macro call, similar to "if" @@ -570,16 +564,16 @@ // order (unorded), but is likely faster. // m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op // "continue" will skip to the next space -#define unordered_mapwalk_at(map,ox,oy,dx0,dy0,dx1,dy1) \ - for (maprect *r_e_c_t = (map)->split_to_tiles ( \ +#define unordered_mapwalk_at(buf,map,ox,oy,dx0,dy0,dx1,dy1) \ + for (maprect *r_e_c_t = (map)->split_to_tiles (buf, \ (ox) + (dx0) , (oy) + (dy0) , \ (ox) + (dx1) + 1, (oy) + (dy1) + 1); \ r_e_c_t->m; \ ++r_e_c_t) \ rect_mapwalk (r_e_c_t, (ox), (oy)) -#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \ - unordered_mapwalk_at (op->map, op->x, op->y, dx0, dy0, dx1, dy1) +#define unordered_mapwalk(buf,op,dx0,dy0,dx1,dy1) \ + unordered_mapwalk_at (buf,op->map, op->x, op->y, dx0, dy0, dx1, dy1) #endif