- Timestamp:
- Oct 10, 2015, 4:34:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc
r10624 r10629 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/XMLPort.h" 38 #include "core/class/Super.h" 38 39 39 40 #include "TowerDefense.h" … … 72 73 XMLPortParam(TowerDefenseCenterpoint, "tileScale", setTileScale, getTileScale, xmlelement, mode); 73 74 XMLPortParam(TowerDefenseCenterpoint, "selecterTemplate", setSelecterTemplate, getSelecterTemplate, xmlelement, mode); 74 75 //TODO: add XMLPortObject(TowerDefenseCenterpoint, WorldEntity, "waypoints", addWaypoint, getWaypoint, xmlelement, mode); 76 // This was copied and shightly modified from WaypointController.cc ; there are no getters and setters and no membervariable yet 77 // The centerpoint should have all waypoints for "attached" to it. By using this function you can seperately add waypoints 78 // When you spawn a new enemy you should let it be controlled by a WaypointController. And that controller should get the waypoints. 79 80 // Alternatively you can manage the waypoints directly in TowerDefense.cc 75 XMLPortParam(TowerDefenseCenterpoint, "tower1Template", setTower1Template, getTower1Template, xmlelement, mode); 76 XMLPortParam(TowerDefenseCenterpoint, "tower2Template", setTower2Template, getTower2Template, xmlelement, mode); 77 XMLPortParam(TowerDefenseCenterpoint, "tower3Template", setTower3Template, getTower3Template, xmlelement, mode); 78 XMLPortParam(TowerDefenseCenterpoint, "tower4Template", setTower4Template, getTower4Template, xmlelement, mode); 79 XMLPortParam(TowerDefenseCenterpoint, "tower5Template", setTower5Template, getTower5Template, xmlelement, mode); 80 XMLPortParam(TowerDefenseCenterpoint, "fields", setFields, getFields, xmlelement, mode); 81 XMLPortParam(TowerDefenseCenterpoint, "tower1Cost", setTower1Cost, getTower1Cost, xmlelement, mode); 82 XMLPortParam(TowerDefenseCenterpoint, "tower2Cost", setTower2Cost, getTower2Cost, xmlelement, mode); 83 XMLPortParam(TowerDefenseCenterpoint, "tower3Cost", setTower3Cost, getTower3Cost, xmlelement, mode); 84 XMLPortParam(TowerDefenseCenterpoint, "tower4Cost", setTower4Cost, getTower4Cost, xmlelement, mode); 85 XMLPortParam(TowerDefenseCenterpoint, "tower5Cost", setTower5Cost, getTower5Cost, xmlelement, mode); 81 86 } 82 87 … … 94 99 } 95 100 } 101 102 /** 103 @brief 104 Removes all blanks, tabs and returns from the string passed. 105 */ 106 void TowerDefenseCenterpoint::trimString(std::string* str) 107 { 108 std::string* trimmed = new std::string(""); 109 int length = str->size(); 110 char temp; 111 for (int i = 0; i < length; ++ i) 112 { 113 temp = str->at(i); 114 if (temp != ' ' && temp != '\t' && temp != '\n') 115 { 116 trimmed->push_back(temp); 117 } 118 } 119 120 *str = *trimmed; 121 } 122 123 const int TowerDefenseCenterpoint::getTowerCost(int upgrade) const 124 { 125 return towerCosts_[(upgrade%5)]; 126 } 96 127 }
Note: See TracChangeset
for help on using the changeset viewer.