ScummVM API documentation
location.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA4_MAP_LOCATION_H
23 #define ULTIMA4_MAP_LOCATION_H
24 
25 #include "ultima/ultima4/map/map.h"
26 #include "ultima/ultima4/map/movement.h"
27 #include "ultima/ultima4/core/observable.h"
28 #include "ultima/ultima4/core/types.h"
29 
30 namespace Ultima {
31 namespace Ultima4 {
32 
33 typedef enum {
34  CTX_WORLDMAP = 0x0001,
35  CTX_COMBAT = 0x0002,
36  CTX_CITY = 0x0004,
37  CTX_DUNGEON = 0x0008,
38  CTX_ALTAR_ROOM = 0x0010,
39  CTX_SHRINE = 0x0020
40 } LocationContext;
41 
42 #define CTX_ANY (LocationContext)(0xffff)
43 #define CTX_NORMAL (LocationContext)(CTX_WORLDMAP | CTX_CITY)
44 #define CTX_NON_COMBAT (LocationContext)(CTX_ANY & ~CTX_COMBAT)
45 #define CTX_CAN_SAVE_GAME (LocationContext)(CTX_WORLDMAP | CTX_DUNGEON)
46 
47 class TurnCompleter;
48 
49 class Location : public Observable<Location *, MoveEvent &> {
50 public:
54  Location(MapCoords coords, Map *map, int viewmode, LocationContext ctx, TurnCompleter *turnCompleter, Location *prev);
55 
59  Std::vector<MapTile> tilesAt(MapCoords coords, bool &focus);
60 
67  TileId getReplacementTile(MapCoords atCoords, Tile const *forTile);
68 
74  int getCurrentPosition(MapCoords *coords);
75  MoveResult move(Direction dir, bool userEvent);
76 
77  MapCoords _coords;
78  Map *_map;
79  int _viewMode;
80  LocationContext _context;
81  TurnCompleter *_turnCompleter;
82  Location *_prev;
83 };
84 
88 void locationFree(Location **stack);
89 
90 } // End of namespace Ultima4
91 } // End of namespace Ultima
92 
93 #endif
Definition: map.h:134
int getCurrentPosition(MapCoords *coords)
Definition: controller.h:153
Location(MapCoords coords, Map *map, int viewmode, LocationContext ctx, TurnCompleter *turnCompleter, Location *prev)
Definition: detection.h:27
TileId getReplacementTile(MapCoords atCoords, Tile const *forTile)
Definition: location.h:49
Definition: observable.h:45
Definition: tile.h:65
Definition: map.h:64
Std::vector< MapTile > tilesAt(MapCoords coords, bool &focus)