--- deliantra/server/include/map.h 2009/12/18 03:49:46 1.124 +++ 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 @@ -322,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); @@ -350,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); @@ -391,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]; } @@ -401,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 @@ -549,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" @@ -564,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