--- deliantra/server/include/map.h 2007/08/15 04:57:48 1.83 +++ deliantra/server/include/map.h 2007/08/31 00:20:41 1.86 @@ -301,6 +301,8 @@ MTH void touch () { last_access = runtime; } + MTH bool tile_available (int dir, bool load = true); + // find the map that is at coordinate x|y relative to this map // TODO: need a better way than passing by reference // TODO: make perl interface @@ -321,7 +323,7 @@ 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);//PERL + 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 MTH object *pick_random_object () const; @@ -375,5 +377,60 @@ return map->at (x, y); } +// not used anywhere *yet* +struct mapxy { + maptile *m; + sint16 x, y; + + mapxy (maptile *m, sint16 x, sint16 y) + : m(m), x(x), y(y) + { } + + mapxy (object *op) + : m(op->map), x(op->x), y(op->y) + { } + + mapxy &move (int dir) + { + x += freearr_x [dir]; + y += freearr_y [dir]; + + return *this; + } + + operator void *() const { return (void *)m; } + mapxy &operator =(const object *op) + { + m = op->map; + x = op->x; + y = op->y; + + return *this; + } + + mapspace *operator ->() const { return &m->at (x, y); } + mapspace *operator * () const { return &m->at (x, y); } + + bool normalise () + { + return xy_normalise (m, x, y); + } + + object *insert (object *op, object *originator = 0, int flags = 0) const + { + m->insert (op, x, y, originator, flags); + } +}; + +inline const mapxy & +object::operator =(const mapxy &pos) +{ + map = pos.m; + x = pos.x; + y = pos.y; + + return pos; +} + #endif