~ubuntu-branches/ubuntu/maverick/lordsawar/maverick

« back to all changes in this revision

Viewing changes to src/armybase.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2010-04-10 09:29:33 UTC
  • mfrom: (1.1.9 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100410092933-23uq4dxig30kmtcw
Tags: 0.1.8-1
* New upstream release.
* Add misc:Depends for -data package.
* Bump Standards Version to 3.8.4. (No changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// Copyright (C) 2000, 2001, 2003 Michael Bartl
2
2
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Ulf Lorenz
3
3
// Copyright (C) 2004, 2005 Andrea Paternesi
4
 
// Copyright (C) 2007, 2008 Ben Asselstine
 
4
// Copyright (C) 2007, 2008, 2009 Ben Asselstine
5
5
// Copyright (C) 2007, 2008 Ole Laursen
6
6
//
7
7
//  This program is free software; you can redistribute it and/or modify
63
63
          //! Provides a +1 strength to all Army units in a fortified Stack.
64
64
          FORTIFY            = 0x00002000,
65
65
        };
66
 
        static guint32 bonusFlagsFromString(const std::string str);
67
 
        static std::string bonusFlagsToString(const guint32 bonus);
68
 
        static ArmyBase::Bonus bonusFlagFromString(const std::string str);
69
 
        static std::string bonusFlagToString(const ArmyBase::Bonus bonus);
70
66
        
71
67
        //! Various kinds of statistics that an instance of Army unit has.
72
68
        /**
92
88
          MOVES_MULTIPLIER = 9,
93
89
        };
94
90
 
95
 
        static guint32 moveFlagsFromString(const std::string str);
96
 
        static std::string moveFlagsToString(const guint32 move_bonus);
97
 
 
98
91
        //! Copy constructor.
99
92
        ArmyBase(const ArmyBase& army);
100
93
 
105
98
        ArmyBase();
106
99
 
107
100
        //! Destructor.
108
 
        ~ArmyBase();
109
 
 
110
 
        // Set functions:
 
101
        virtual ~ArmyBase();
 
102
 
 
103
 
 
104
        // Set Methods
111
105
        
112
106
        //! Set how much gold this unit requires per turn.
113
107
        void setUpkeep(guint32 upkeep){d_upkeep = upkeep;}
115
109
        //! Set the strength of the army.
116
110
        void setStrength(guint32 strength) {d_strength = strength;}
117
111
 
118
 
        // Get functions
 
112
        //! Set how much XP this unit is worth when killed.
 
113
        void setXpReward(double xp_value){d_xp_value = xp_value;}
 
114
 
 
115
 
 
116
        // Get Methods
119
117
        
120
118
        //! Returns how many gold pieces this Army needs per turn.
121
119
        guint32 getUpkeep() const {return d_upkeep;}
140
138
        guint32 getStrength() const {return d_strength;}
141
139
 
142
140
        //! Get the distance this army can see on a hidden map.
 
141
        /**
 
142
         * As this army walks on the map, it defogs the map with this radius.
 
143
         */
143
144
        guint32 getSight() const {return d_sight;}
144
145
 
 
146
        //! Gets an easy to read string that represents the army's bonuses.
145
147
        std::string getArmyBonusDescription() const;
146
148
 
147
 
        //! Set how much XP this unit is worth when killed.
148
 
        void setXpReward(double xp_value){d_xp_value = xp_value;}
149
 
 
150
149
        //! Returns the number of XP that killing this Army garners it's killer.
151
150
        double getXpReward() const {return d_xp_value;}
 
151
 
 
152
        // Static Methods
 
153
 
 
154
        //! Convert an ArmyBase::Bonus string to a bitwise OR'd value.
 
155
        /**
 
156
         * Converts a string containing the string representations of one
 
157
         * or more ArmyBase::Bonus values to a bitwise OR'd value of those
 
158
         * ArmyBase::Bonus values.  The terms are separated with a pipe `|'.
 
159
         */
 
160
        static guint32 bonusFlagsFromString(const std::string str);
 
161
 
 
162
        //! Convert a series of ArmyBase::Bonus enum values to a string.
 
163
        /**
 
164
         * Converts a bitwise OR'd value that represents many ArmyBase::Bonus
 
165
         * enumerated values into a string, where the terms are separated by a
 
166
         * pipe `|'.
 
167
         */
 
168
        static std::string bonusFlagsToString(const guint32 bonus);
 
169
 
 
170
        //! Convert an ArmyBase::Bonus string to it's enum value.
 
171
        /**
 
172
         * Converts a string containing a string representation of an 
 
173
         * ArmyBase::Bonus enumerated value, and converts it to it's enumerated
 
174
         * value.
 
175
         */
 
176
        static ArmyBase::Bonus bonusFlagFromString(const std::string str);
 
177
 
 
178
        //! Convert an ArmyBase::Bonus enum value to a string.
 
179
        static std::string bonusFlagToString(const ArmyBase::Bonus bonus);
 
180
 
 
181
        //! Convert a Tile::Type string to a bitwise OR'd value.
 
182
        /**
 
183
         * Converts a string containing the string representations of one
 
184
         * or more Tile::Type values to a bitwise OR'd value of those
 
185
         * Tile::Type values.  The terms are separated with a pipe `|'.
 
186
         */
 
187
        static guint32 moveFlagsFromString(const std::string str);
 
188
 
 
189
        //! Convert a series of Tile::Type enumerated values to a string.
 
190
        /**
 
191
         * Converts a bitwise OR'd value that represents many Tile::Type
 
192
         * enumerated values into a string, where the terms are separated by a
 
193
         * pipe `|'.
 
194
         */
 
195
        static std::string moveFlagsToString(const guint32 move_bonus);
 
196
 
152
197
    protected:
153
198
 
154
199
        //! Generic method for saving Army base data.