-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhero.hpp
59 lines (44 loc) · 1.77 KB
/
hero.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
This file is part of Heroes of Wesnoth.
Copyright (C) 2007, 2008, 2009 Jon Ander Peñalba <[email protected]>
Heroes of Wesnoth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
Heroes of Wesnoth is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Heroes of Wesnoth. If not, see <http://www.gnu.org/licenses/>
*/
/// @file
/// The Hero class.
/// @author Jonan
#ifndef HERO_HPP
#define HERO_HPP
#include "unit.hpp"
/// Stores the hero's attributes.
class Hero : public Unit {
public:
/// @param[in] type Type of hero (name or id).
Hero(const char *type); // Constructor
virtual ~Hero(void); // Destructor
// @{
/// Get functions.
Unit* getCreature (const int number) {return creature[number];}
int getVisibility (void) {return visibility; }
// @}
/// Assings a new creature to the hero.
/// @param[in] creature The new unit the hero can control.
/// @param[in] position Position were the unit should be.
void recruitCreature(Unit *creature, const int position = -1);
/// Draws the hero in the given position.
/// @param[in] position The position where the hero should be drawn.
virtual void draw(SDL_Rect &position) {drawUnit(position);}
private:
static const int MAX_UNITS = 9;
Unit *creature[MAX_UNITS]; // The creatures a hero controls
int visibility; // How far the hero sees
DISALLOW_COPY_AND_ASSIGN(Hero);
};
#endif // HERO_HPP