diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/map.cpp | 18 | ||||
-rw-r--r-- | engines/gob/map.h | 22 |
2 files changed, 20 insertions, 20 deletions
diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp index 3efa18c264..500f6515ec 100644 --- a/engines/gob/map.cpp +++ b/engines/gob/map.cpp @@ -146,6 +146,24 @@ const WayPoint &Map::getWayPoint(int n) const { return _wayPoints[n]; } +int16 Map::getItem(int x, int y) const { + assert(_itemsMap); + + x = CLIP<int>(x, 0, _mapWidth - 1); + y = CLIP<int>(y, 0, _mapHeight - 1); + + return _itemsMap[y][x]; +} + +void Map::setItem(int x, int y, int16 item) { + assert(_itemsMap); + + x = CLIP<int>(x, 0, _mapWidth - 1); + y = CLIP<int>(y, 0, _mapHeight - 1); + + _itemsMap[y][x] = item; +} + void Map::placeItem(int16 x, int16 y, int16 id) { if ((getItem(x, y) & 0xFF00) != 0) setItem(x, y, (getItem(x, y) & 0xFF00) | id); diff --git a/engines/gob/map.h b/engines/gob/map.h index 4866b9b7f8..4bf2dc6228 100644 --- a/engines/gob/map.h +++ b/engines/gob/map.h @@ -107,6 +107,8 @@ public: void findNearestWalkable(int16 &gobDestX, int16 &gobDestY, int16 mouseX, int16 mouseY); + int16 getItem(int x, int y) const; + void setItem(int x, int y, int16 item); void placeItem(int16 x, int16 y, int16 id); Direction getDirection(int16 x0, int16 y0, int16 x1, int16 y1); @@ -118,9 +120,6 @@ public: void loadMapsInitGobs(); - virtual int16 getItem(int x, int y) = 0; - virtual void setItem(int x, int y, int16 item) = 0; - virtual void loadMapObjects(const char *avjFile) = 0; virtual void findNearestToGob(Mult::Mult_Object *obj) = 0; virtual void findNearestToDest(Mult::Mult_Object *obj) = 0; @@ -168,23 +167,6 @@ public: virtual void findNearestToDest(Mult::Mult_Object *obj); virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y); - virtual int16 getItem(int x, int y) { - assert(_itemsMap); - - x = CLIP<int>(x, 0, _mapWidth - 1); - y = CLIP<int>(y, 0, _mapHeight - 1); - - return _itemsMap[y][x]; - } - virtual void setItem(int x, int y, int16 item) { - assert(_itemsMap); - - x = CLIP<int>(x, 0, _mapWidth - 1); - y = CLIP<int>(y, 0, _mapHeight - 1); - - _itemsMap[y][x] = item; - } - Map_v1(GobEngine *vm); virtual ~Map_v1(); |