| [9110] | 1 | /* | 
|---|
 | 2 |  *   ORXONOX - the hottest 3D action shooter ever to exist | 
|---|
 | 3 |  *                    > www.orxonox.net < | 
|---|
 | 4 |  * | 
|---|
 | 5 |  * | 
|---|
 | 6 |  *   License notice: | 
|---|
 | 7 |  * | 
|---|
 | 8 |  *   This program is free software; you can redistribute it and/or | 
|---|
 | 9 |  *   modify it under the terms of the GNU General Public License | 
|---|
 | 10 |  *   as published by the Free Software Foundation; either version 2 | 
|---|
 | 11 |  *   of the License, or (at your option) any later version. | 
|---|
 | 12 |  * | 
|---|
 | 13 |  *   This program is distributed in the hope that it will be useful, | 
|---|
 | 14 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
 | 15 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
 | 16 |  *   GNU General Public License for more details. | 
|---|
 | 17 |  * | 
|---|
 | 18 |  *   You should have received a copy of the GNU General Public License | 
|---|
 | 19 |  *   along with this program; if not, write to the Free Software | 
|---|
 | 20 |  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
|---|
 | 21 |  * | 
|---|
 | 22 |  *   Author: | 
|---|
 | 23 |  *      ... | 
|---|
 | 24 |  *   Co-authors: | 
|---|
 | 25 |  *      ... | 
|---|
 | 26 |  * | 
|---|
 | 27 |  */ | 
|---|
 | 28 |  | 
|---|
 | 29 |  | 
|---|
 | 30 | #ifndef _TowerDefenseCenterpoint_H__ | 
|---|
 | 31 | #define _TowerDefenseCenterpoint_H__ | 
|---|
 | 32 |  | 
|---|
| [9112] | 33 | #include "towerdefense/TowerDefensePrereqs.h" | 
|---|
| [9110] | 34 |  | 
|---|
 | 35 | #include <string> | 
|---|
 | 36 | #include <util/Math.h> | 
|---|
| [10629] | 37 | #include "TowerDefenseTower.h" | 
|---|
| [9175] | 38 | #include "worldentities/MobileEntity.h" | 
|---|
| [9110] | 39 |  | 
|---|
 | 40 | namespace orxonox | 
|---|
 | 41 | { | 
|---|
| [11099] | 42 |     /** | 
|---|
 | 43 |     @brief | 
|---|
 | 44 |     See TowerDefenseReadme.txt for Information. | 
|---|
 | 45 |     @ingroup TowerDefense | 
|---|
 | 46 |     */ | 
|---|
| [9175] | 47 |     class _TowerDefenseExport TowerDefenseCenterpoint : public MobileEntity | 
|---|
| [9110] | 48 |     { | 
|---|
 | 49 |         public: | 
|---|
| [9667] | 50 |             TowerDefenseCenterpoint(Context* context); | 
|---|
| [9110] | 51 |             virtual ~TowerDefenseCenterpoint() {} | 
|---|
 | 52 |  | 
|---|
| [11071] | 53 |             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; | 
|---|
| [9272] | 54 |  | 
|---|
| [9110] | 55 |             /** | 
|---|
| [9141] | 56 |             @brief The width and hight in number of tiles. Default is 15 for both. | 
|---|
| [9110] | 57 |             */ | 
|---|
 | 58 |             void setWidth(unsigned int width) | 
|---|
 | 59 |                 { this->width_ = width; } | 
|---|
| [9272] | 60 |             unsigned int getWidth(void) const | 
|---|
| [9110] | 61 |                 { return this->width_; } | 
|---|
 | 62 |             void setHeight(unsigned int height) | 
|---|
 | 63 |                 { this->height_ = height; } | 
|---|
| [9272] | 64 |             unsigned int getHeight(void) const | 
|---|
| [9110] | 65 |                 { return this->height_; } | 
|---|
| [10629] | 66 |             void setFields(const std::string& newFields) | 
|---|
 | 67 |                 { this->fields_ = newFields; trimString(&fields_); } | 
|---|
 | 68 |             const std::string& getFields() const | 
|---|
 | 69 |                 { return this->fields_; }                     | 
|---|
| [10622] | 70 |             void setSelecterTemplate(const std::string& newTemplate) | 
|---|
 | 71 |                 { this->selecterTemplate_ = newTemplate; } | 
|---|
 | 72 |             const std::string& getSelecterTemplate() const | 
|---|
 | 73 |                 { return this->selecterTemplate_; }    | 
|---|
| [10629] | 74 |  | 
|---|
 | 75 |             void setTower1Template(const std::string& newTemplate) | 
|---|
 | 76 |                 { this->towerTemplates_[0] = newTemplate;} | 
|---|
 | 77 |             const std::string& getTower1Template() const | 
|---|
 | 78 |                 { return this->towerTemplates_[0]; }   | 
|---|
 | 79 |             void setTower2Template(const std::string& newTemplate) | 
|---|
 | 80 |                 { this->towerTemplates_[1] = newTemplate; } | 
|---|
 | 81 |             const std::string& getTower2Template() const | 
|---|
 | 82 |                 { return this->towerTemplates_[1]; } | 
|---|
 | 83 |             void setTower3Template(const std::string& newTemplate) | 
|---|
 | 84 |                 { this->towerTemplates_[2] = newTemplate; } | 
|---|
 | 85 |             const std::string& getTower3Template() const | 
|---|
 | 86 |                 { return this->towerTemplates_[2]; }  | 
|---|
 | 87 |             void setTower4Template(const std::string& newTemplate) | 
|---|
 | 88 |                 { this->towerTemplates_[3] = newTemplate; } | 
|---|
 | 89 |             const std::string& getTower4Template() const | 
|---|
 | 90 |                 { return this->towerTemplates_[3]; } | 
|---|
 | 91 |             void setTower5Template(const std::string& newTemplate) | 
|---|
 | 92 |                 { this->towerTemplates_[4] = newTemplate; } | 
|---|
 | 93 |             const std::string& getTower5Template() const | 
|---|
 | 94 |                 { return this->towerTemplates_[4]; }   | 
|---|
 | 95 |  | 
|---|
 | 96 |             void setTower1Cost(const int& newCost) | 
|---|
 | 97 |                 { this->towerCosts_[0] = newCost;} | 
|---|
 | 98 |             const int& getTower1Cost() const | 
|---|
 | 99 |                 { return this->towerCosts_[0]; }   | 
|---|
 | 100 |             void setTower2Cost(const int& newCost) | 
|---|
 | 101 |                 { this->towerCosts_[1] = newCost; } | 
|---|
 | 102 |             const int& getTower2Cost() const | 
|---|
 | 103 |                 { return this->towerCosts_[1]; } | 
|---|
 | 104 |             void setTower3Cost(const int& newCost) | 
|---|
 | 105 |                 { this->towerCosts_[2] = newCost; } | 
|---|
 | 106 |             const int& getTower3Cost() const | 
|---|
 | 107 |                 { return this->towerCosts_[2]; }  | 
|---|
 | 108 |             void setTower4Cost(const int& newCost) | 
|---|
 | 109 |                 { this->towerCosts_[3] = newCost; } | 
|---|
 | 110 |             const int& getTower4Cost() const | 
|---|
 | 111 |                 { return this->towerCosts_[3]; } | 
|---|
 | 112 |             void setTower5Cost(const int& newCost) | 
|---|
 | 113 |                 { this->towerCosts_[4] = newCost; } | 
|---|
 | 114 |             const int& getTower5Cost() const | 
|---|
 | 115 |                 { return this->towerCosts_[4]; } | 
|---|
 | 116 |  | 
|---|
 | 117 |             const int getTowerCost(int upgrade) const; | 
|---|
 | 118 |                                              | 
|---|
 | 119 |  | 
|---|
| [9110] | 120 |             /** | 
|---|
| [9272] | 121 |                 @brief How to convert to world coordinates, e.g. that 0,15 is not at -8,-8 but at -80,-80 (if scale would be 10) | 
|---|
 | 122 |             */ | 
|---|
 | 123 |             void setTileScale(unsigned int tileScale) | 
|---|
 | 124 |                 { this->tileScale_ = tileScale; } | 
|---|
 | 125 |  | 
|---|
 | 126 |             unsigned int getTileScale(void) const | 
|---|
 | 127 |                 { return this->tileScale_; } | 
|---|
 | 128 |  | 
|---|
| [9110] | 129 |         private: | 
|---|
| [9141] | 130 |             void checkGametype(); | 
|---|
| [10629] | 131 |             void trimString(std::string*); | 
|---|
| [10622] | 132 |             std::string selecterTemplate_; | 
|---|
| [10629] | 133 |             std::string towerTemplates_[5]; | 
|---|
 | 134 |             int towerCosts_[5]; | 
|---|
 | 135 |             std::string fields_; | 
|---|
| [9110] | 136 |             unsigned int width_; | 
|---|
 | 137 |             unsigned int height_; | 
|---|
| [9272] | 138 |             unsigned int tileScale_; | 
|---|
| [9110] | 139 |     }; | 
|---|
 | 140 | } | 
|---|
 | 141 |  | 
|---|
 | 142 | #endif /* _TowerDefenseCenterpoint_H__ */ | 
|---|