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, 2014 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 #pragma once 23 #ifndef ARMY_PROTO_BASE_H 24 #define ARMY_PROTO_BASE_H 25 26 #include <gtkmm.h> 27 #include "defs.h" 28 29 class XML_Helper; 30 31 #include "armybase.h" 32 33 //! A basic set of properties belonging to an army prototype. 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. ~ArmyProtoBase()48 ~ArmyProtoBase() {}; 49 50 // Set Methods 51 52 //! Sets the descriptive text for this Army. setDescription(Glib::ustring text)53 void setDescription(Glib::ustring text) {d_description = text;}; 54 55 //! Set the gold pieces needed to make an Army unit of this kind. setProductionCost(guint32 production_cost)56 void setProductionCost(guint32 production_cost) 57 {d_production_cost = production_cost;} 58 59 //! Set the gold pieces needed to add this Army to a city's production. setNewProductionCost(guint32 new_production_cost)60 void setNewProductionCost(guint32 new_production_cost) 61 {d_new_production_cost = new_production_cost;} 62 63 //! Sets the armyset id for this army. setArmyset(guint32 id)64 void setArmyset(guint32 id) {d_armyset = id;}; 65 66 //! Set the army bonus of the army prototype. setArmyBonus(guint32 bonus)67 void setArmyBonus(guint32 bonus) {d_army_bonus = bonus;}; 68 69 //! Set the move bonus. setMoveBonus(guint32 bonus)70 void setMoveBonus(guint32 bonus) {d_move_bonus = bonus;}; 71 72 //! Set the movement points of the army. setMaxMoves(guint32 moves)73 void setMaxMoves(guint32 moves) {d_max_moves = moves;}; 74 75 //! Set the sight of the army. setSight(guint32 sight)76 void setSight(guint32 sight) {d_sight = sight;}; 77 78 //! Set the name of the Army. setName(Glib::ustring name)79 void setName(Glib::ustring name){d_name = name;} 80 81 //! Set how many turns this unit type needs to be produced. setProduction(guint32 production)82 void setProduction(guint32 production){d_production = production;}; 83 84 85 // Get Methods 86 87 //! Returns the descriptive text of this Army. getDescription()88 Glib::ustring getDescription() const {return _(d_description.c_str());} 89 90 //! Returns how much gold making one of these army units costs. getProductionCost()91 guint32 getProductionCost() const {return d_production_cost;} 92 93 //! Returns how much gold setting up the production costs 94 /** 95 * @return The amount of gold pieces required to add this Army 96 * into the City's suite of 4 production slots. 97 */ getNewProductionCost()98 guint32 getNewProductionCost() const {return d_new_production_cost;} 99 100 //! Returns the armyset id for this army. getArmyset()101 guint32 getArmyset() const {return d_armyset;}; 102 103 //! Returns the name of the Army. getName()104 Glib::ustring getName() const {return _(d_name.c_str());}; 105 106 //! Returns how many turns this Army needs to be produced. getProduction()107 guint32 getProduction() const {return d_production;}; 108 109 protected: 110 //! Callback method for loading this object from an opened file. 111 bool saveData(XML_Helper* helper) const; 112 113 //! The name of the Army unit. e.g. Scouts. 114 Glib::ustring d_name; 115 116 //! The description of the Army unit. 117 Glib::ustring d_description; 118 119 //! How many gold pieces needed to create an army of this kind. 120 /** 121 * Every time an army unit is created of this kind, it costs the 122 * player this many gold pieces. 123 */ 124 guint32 d_production_cost; 125 126 //! How many gold pieces needed to add this Army to a city's production. 127 /** 128 * If d_production_cost is over zero, then the Army can be purchased. 129 * If not, then the Army unit cannot be incorporated into a 130 * City's production at any price. 131 * 132 * This value does not change during gameplay. 133 */ 134 guint32 d_new_production_cost; 135 136 //! How many turns the Army unit takes to be produced in a City. 137 /** 138 * This value must be above 0. Normal values for d_production are 139 * 1 through 4. 140 * This value does not change during gameplay. 141 */ 142 guint32 d_production; 143 144 //! The armyset to which this army prototype belongs. 145 guint32 d_armyset; 146 147 }; 148 149 #endif // ARMY_PROTO_BASE_H 150