--- deliantra/server/include/map.h 2010/01/16 17:41:01 1.126 +++ deliantra/server/include/map.h 2010/04/04 02:51:56 1.131 @@ -1,9 +1,9 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008,2009 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,2010 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 @@ -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_utf8_string 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_utf8_string path); + MTH bool _save_header (const_octet_string path); maptile (); maptile (int w, int h); @@ -401,11 +401,18 @@ // 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); + + MTH bool is_in_shop (int x, int y) const; }; +inline bool +object::is_in_shop () const +{ + return is_on_map () + && map->is_in_shop (x, y); +} + //+GPL /* This is used by get_rangevector to determine where the other @@ -549,6 +556,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 +573,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