Changeset 10105 for code/branches/towerdefenseHS14/src/modules/towerdefense
- Timestamp:
- Nov 3, 2014, 4:33:54 PM (10 years ago)
- Location:
- code/branches/towerdefenseHS14/src/modules/towerdefense
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/src/modules/towerdefense/CMakeLists.txt
r10091 r10105 5 5 TowerDefenseHUDController.cc 6 6 TowerDefensePlayerStats.cc 7 TowerTurret.cc 7 TDCoordinate.cc 8 Enemy.cc 9 8 10 ) 9 11 -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
r10091 r10105 78 78 #include "TowerTurret.h" 79 79 #include "TowerDefenseCenterpoint.h" 80 80 //#include "TDCoordinate.h" 81 81 #include "worldentities/SpawnPoint.h" 82 82 #include "worldentities/pawns/Pawn.h" … … 131 131 132 132 const int kInitialTowerCount = 3; 133 Coordinate initialTowerCoordinates[kInitialTowerCount] = {{3,2}, {8,5}, {12,10}};134 133 135 134 for (int i = 0; i < kInitialTowerCount; i++) 136 135 { 137 Coordinate coordinate = initialTowerCoordinates[i]; 138 addTower(coordinate.x, coordinate.y); 136 //{{3,2}, {8,5}, {12,10}}; old coordinates 137 TDCoordinate* coordinate = new TDCoordinate(i,(i*2)); 138 addTower(coordinate->x, coordinate->y); 139 139 } 140 140 … … 144 144 } 145 145 146 void TowerDefense::addEnemy(){} 147 148 146 149 void TowerDefense::end() 147 150 { … … 150 153 ChatManager::message("Match is over"); 151 154 } 155 156 152 157 153 158 void TowerDefense::addTower(int x, int y) … … 184 189 185 190 // Add tower to coordinatesStack 186 Coordinate newTowerCoordinates = {x, y}; 191 TDCoordinate newTowerCoordinates; 192 newTowerCoordinates.x=x; 193 newTowerCoordinates.y=y; 194 195 187 196 addedTowersCoordinates_.push_back(newTowerCoordinates); 188 197 … … 205 214 bool TowerDefense::towerExists(int x, int y) 206 215 { 207 for(std::vector< Coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it)208 { 209 Coordinate currentCoordinates = (Coordinate) (*it);216 for(std::vector<TDCoordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it) 217 { 218 TDCoordinate currentCoordinates = (TDCoordinate) (*it); 210 219 if (currentCoordinates.x == x && currentCoordinates.y == y) 211 220 return true; -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
r10091 r10105 37 37 #ifndef _TowerDefense_H__ 38 38 #define _TowerDefense_H__ 39 39 #include "TDCoordinate.h" 40 40 #include "towerdefense/TowerDefensePrereqs.h" 41 41 #include "gametypes/Deathmatch.h" … … 51 51 virtual ~TowerDefense(); 52 52 53 void addEnemy(); 53 54 virtual void start(); //<! The function is called when the gametype starts 54 55 virtual void end(); … … 86 87 bool towerExists(int x, int y); 87 88 88 typedef struct {89 int x;90 int y;91 } Coordinate;92 89 93 std::vector< Coordinate> addedTowersCoordinates_;90 std::vector<TDCoordinate> addedTowersCoordinates_; 94 91 std::vector<TowerTurret*> towers_; 95 92 };
Note: See TracChangeset
for help on using the changeset viewer.