9
9
#include "UniquelyIdentified.h"
12
11
#include "vector.h"
14
#include "Immovable.h"
13
#include "LocationBox.h"
15
14
#include "rectangle.h"
19
class ::UniquelyIdentified;
18
class UniquelyIdentified;
21
20
//! A feature constructed on the game map.
23
22
* A Location is a map feature with a location, and a size.
24
23
* City, Ruin, Temple, Signpost and more classes are derived from Location.
26
class Location : public ::UniquelyIdentified, public Immovable
25
class Location : public UniquelyIdentified, public LocationBox
29
28
//! Default constructor.
46
45
Location(XML_Helper* helper, Uint32 size = 1);
50
//! Add an army to a tile that is included in this location.
52
* @param army The army instance to add to a tile in the location.
54
* @return A pointer to the stack where the Army was added. Returns NULL
55
* when the Army couldn't be added because the location is full.
57
Stack *addArmy(Army *army) const;
59
//! Returns whether or not this location obscured from view on a hidden map.
61
* @note This method relies on Playerlist::getActiveplayer to know
62
* which FogMap to query.
66
//! Unobscures the view of this location in the active player's FogMap.
69
//! Unobscures the view of this location in the given player's FogMap.
70
void deFog(Player *p);
72
//! Return the size of the location.
73
Uint32 getSize() const {return d_size;}
75
//! Returns whether or not the Location contains the given point?
76
bool contains(Vector<int> pos) const;
78
//! Returns a rectangle that describes the location.
79
Rectangle get_area() const
80
{ return Rectangle(getPos().x, getPos().y, d_size, d_size); }
84
//! Obtains a stack in the location to put an Army unit in.
86
* This method scans the tiles of the location for a place to put a new
87
* Army unit. If the position is empty it makes a new stack in that
88
* position and returns that stack. If a stack containing fewer than
89
* eight Army units is found, that stack is returned. If no open spots
90
* could be found, it returns NULL.
92
* @param owner The player to own the new stack if one needs to be created.
94
* @return The stack that has room for one Army unit in the Location. If
95
* an available stack could not be found this method returns NULL.
97
Stack* getFreeStack(Player *owner) const;
99
//! The size of the location.
101
* This size is the number tiles high and wide the location is.
102
* This value is always 1, except for City objects which are always 2.