~ubuntu-branches/ubuntu/saucy/lordsawar/saucy

« back to all changes in this revision

Viewing changes to src/Location.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese, Barry deFreese
  • Date: 2008-12-20 13:52:12 UTC
  • mfrom: (1.1.6 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081220135212-noeb2w3y98ebo7o9
Tags: 0.1.4-1
[ Barry deFreese ]
* New upstream release.
* Move 0.0.8-2.1 changelog entry to correct point in changelog.
* Make lordsawar-data suggest lordsawar.
* Update my e-mail address.
* Add build-depends on intltool, uuid-dev, and libboost-dev.
* Don't install locales since there are no translations currently.
* Add simple man page for new lordsawar-pbm binary.
* Drop gcc4.3 patches as they have been fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#define LOCATION_H
8
8
 
9
9
#include "UniquelyIdentified.h"
10
 
#include "defs.h"
11
10
#include <string>
12
11
#include "vector.h"
13
12
#include "stack.h"
14
 
#include "Immovable.h"
 
13
#include "LocationBox.h"
15
14
#include "rectangle.h"
16
15
 
17
16
class Player;
18
17
class Location;
19
 
class ::UniquelyIdentified;
 
18
class UniquelyIdentified;
20
19
 
21
20
//! A feature constructed on the game map.
22
21
/** 
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.
25
24
 */
26
 
class Location : public ::UniquelyIdentified, public Immovable
 
25
class Location : public UniquelyIdentified, public LocationBox
27
26
{
28
27
 public:
29
28
     //! Default constructor.
46
45
     Location(XML_Helper* helper, Uint32 size = 1);
47
46
     //! Destructor.
48
47
    ~Location();
49
 
    
50
 
    //! Add an army to a tile that is included in this location.
51
 
    /**
52
 
     * @param army    The army instance to add to a tile in the location.
53
 
     *
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.
56
 
     */
57
 
    Stack *addArmy(Army *army) const;
58
 
 
59
 
    //! Returns whether or not this location obscured from view on a hidden map.
60
 
    /**
61
 
     * @note This method relies on Playerlist::getActiveplayer to know
62
 
     *       which FogMap to query.
63
 
     */
64
 
    bool isFogged();
65
 
 
66
 
    //! Unobscures the view of this location in the active player's FogMap.
67
 
    void deFog();
68
 
 
69
 
    //! Unobscures the view of this location in the given player's FogMap.
70
 
    void deFog(Player *p);
71
 
 
72
 
    //! Return the size of the location.
73
 
    Uint32 getSize() const {return d_size;}
74
 
 
75
 
    //! Returns whether or not the Location contains the given point?
76
 
    bool contains(Vector<int> pos) const;
77
 
 
78
 
    //! Returns a rectangle that describes the location.
79
 
    Rectangle get_area() const
80
 
        { return Rectangle(getPos().x, getPos().y, d_size, d_size); }
81
 
 
82
 
 protected:
83
 
 
84
 
    //! Obtains a stack in the location to put an Army unit in.
85
 
    /**
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.
91
 
     *
92
 
     * @param owner  The player to own the new stack if one needs to be created.
93
 
     *
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.
96
 
     */
97
 
    Stack* getFreeStack(Player *owner) const;
98
 
 
99
 
    //! The size of the location.
100
 
    /**
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.
103
 
     */
104
 
    Uint32 d_size;
105
48
};
106
49
 
107
50
#endif