1 /* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #include "ultima/ultima1/maps/map_tile.h"
24 #include "ultima/ultima1/maps/map_overworld.h"
25 #include "ultima/ultima1/maps/map_city_castle.h"
26
27 namespace Ultima {
28 namespace Ultima1 {
29 namespace Maps {
30
clear()31 void U1MapTile::clear() {
32 _map = nullptr;
33 _locationNum = -1;
34 }
35
isWater() const36 bool U1MapTile::isWater() const {
37 return dynamic_cast<MapOverworld *>(_map) && _tileId == TILE_WATER;
38 }
39
isGrass() const40 bool U1MapTile::isGrass() const {
41 return dynamic_cast<MapOverworld *>(_map) && _tileId == TILE_GRASS;
42 }
43
isWoods() const44 bool U1MapTile::isWoods() const {
45 return dynamic_cast<MapOverworld *>(_map) && _tileId == TILE_WOODS;
46 }
47
isOriginalWater() const48 bool U1MapTile::isOriginalWater() const {
49 return dynamic_cast<MapOverworld *>(_map) && _tileId == TILE_WATER;
50 }
51
isOriginalGrass() const52 bool U1MapTile::isOriginalGrass() const {
53 return dynamic_cast<MapOverworld *>(_map) && _tileId == TILE_GRASS;
54 }
55
isOriginalWoods() const56 bool U1MapTile::isOriginalWoods() const {
57 return dynamic_cast<MapOverworld *>(_map) && _tileId == TILE_WOODS;
58 }
59
isGround() const60 bool U1MapTile::isGround() const {
61 if (dynamic_cast<MapCityCastle *>(_map) && (_tileId == 1 || _tileId >= 51))
62 return true;
63 else if (dynamic_cast<MapOverworld *>(_map))
64 // Not water or mountains
65 return _tileId != TILE_WATER && _tileId != TILE_MOUNTAINS;
66 return false;
67 }
68
69 } // End of namespace Maps
70 } // End of namespace Ultima1
71 } // End of namespace Ultima
72