initial commit, lordsawar source, slightly modified
[lordsawar] / src / armyprotobase.h
1 // Copyright (C) 2000, 2001, 2003 Michael Bartl
2 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Ulf Lorenz
3 // Copyright (C) 2004, 2005 Andrea Paternesi
4 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
5 // Copyright (C) 2007, 2008 Ole Laursen
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 Library 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 
20 //  02110-1301, USA.
21
22 #ifndef ARMY_PROTO_BASE_H
23 #define ARMY_PROTO_BASE_H
24
25 #include <gtkmm.h>
26 #include <string>
27
28 #include "defs.h"
29
30 class XML_Helper;
31
32 #include "armybase.h"
33
34 class ArmyProtoBase : public ArmyBase
35 {
36     public:
37
38         //! Copy constructor.
39         ArmyProtoBase(const ArmyProtoBase& armyprotobase);
40
41         //! Loading constructor.
42         ArmyProtoBase(XML_Helper* helper);
43         
44         //! Default constructor.  Create an empty army prototype base.
45         ArmyProtoBase();
46
47         //! Destructor.
48         ~ArmyProtoBase();
49
50         // Set Methods
51         
52         void setTypeId(guint32 type_id) {d_type_id = type_id;};
53
54         //! Sets the descriptive text for this Army.
55         void setDescription(std::string text) {d_description = text;};
56         
57         //! Set the gold pieces needed to make an Army unit of this kind.
58         void setProductionCost(guint32 production_cost)
59           {d_production_cost = production_cost;}
60
61         //! Set the gold pieces needed to add this Army to a city's production.
62         void setNewProductionCost(guint32 new_production_cost)
63           {d_new_production_cost = new_production_cost;}
64
65         //! Sets the armyset id for this army.
66         void setArmyset(guint32 id) {d_armyset = id;};
67
68         //! Set the army bonus of the army prototype.
69         void setArmyBonus(guint32 bonus) {d_army_bonus = bonus;};
70
71         //! Set the move bonus.
72         void setMoveBonus(guint32 bonus) {d_move_bonus = bonus;};
73
74         //! Set the movement points of the army.
75         void setMaxMoves(guint32 moves) {d_max_moves = moves;};
76
77         //! Set the sight of the army.
78         void setSight(guint32 sight) {d_sight = sight;};
79
80         //! Set the name of the Army.
81         void setName(std::string name){d_name = name;}
82
83         //! Set how many turns this unit type needs to be produced.
84         void setProduction(guint32 production){d_production = production;};
85
86
87         // Get Methods
88         
89         //! Get the Id of the Armyset to which the Army's type belongs.
90         guint32 getTypeId() const {return d_type_id;}
91
92         //! Returns the descriptive text of this Army.
93         std::string getDescription() const {return _(d_description.c_str());}
94
95         //! Returns how much gold making one of these army units costs.
96         guint32 getProductionCost() const {return d_production_cost;}
97
98         //! Returns how much gold setting up the production costs
99         /**
100          * @return The amount of gold pieces required to add this Army
101          *         into the City's suite of 4 production slots.
102          */
103         guint32 getNewProductionCost() const {return d_new_production_cost;}
104
105         //! Returns the armyset id for this army.
106         guint32 getArmyset() const {return d_armyset;};
107
108         //! Returns the name of the Army.
109         std::string getName() const {return _(d_name.c_str());};
110
111         //! Returns how many turns this Army needs to be produced.
112         guint32 getProduction() const {return d_production;};
113
114     protected:
115         //! Callback method for loading this object from an opened file.
116         bool saveData(XML_Helper* helper) const;
117
118         //! The name of the Army unit.  e.g. Scouts.
119         std::string d_name;
120
121         //! The index of the Army prototype's index in it's Armyset.
122         guint32 d_type_id;
123
124         //! The description of the Army unit.
125         std::string d_description;
126
127         //! How many gold pieces needed to create an army of this kind.
128         /**
129          * Every time an army unit is created of this kind, it costs the
130          * player this many gold pieces.
131          */
132         guint32 d_production_cost;
133
134         //! How many gold pieces needed to add this Army to a city's production.
135         /**
136          * If d_production_cost is over zero, then the Army can be purchased.
137          * If not, then the Army unit cannot be incorporated into a 
138          * City's production at any price.
139          *
140          * This value does not change during gameplay.
141          */
142         guint32 d_new_production_cost;
143
144         //! How many turns the Army unit takes to be produced in a City.
145         /**
146          * This value must be above 0.  Normal values for d_production are
147          * 1 through 4.
148          * This value does not change during gameplay.
149          */
150         guint32 d_production;
151
152         //! The armyset to which this army prototype belongs.
153         guint32 d_armyset;
154         
155 };
156
157 #endif // ARMY_PROTO_BASE_H