- Timestamp:
- Jan 22, 2014, 1:31:27 AM (11 years ago)
- Branches:
- master
- Children:
- 06fc7f7
- Parents:
- 204edcf
- Location:
- common
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Game.cpp
r204edcf r0678d60 162 162 vector<WorldMap::Object>* vctObjects = this->worldMap->getObjects(); 163 163 vector<WorldMap::Object>::iterator it; 164 int playerId = -1;164 int itemId = -1; 165 165 166 166 for (it = vctObjects->begin(); it != vctObjects->end(); it++) { … … 170 170 if (p->team == 1) { 171 171 p->hasBlueFlag = true; 172 playerId = it->id;172 itemId = it->id; 173 173 } 174 174 break; … … 176 176 if (p->team == 0) { 177 177 p->hasRedFlag = true; 178 playerId = it->id;178 itemId = it->id; 179 179 } 180 180 break; 181 } 182 183 if (playerId > -1) { 181 case WorldMap::OBJECT_NONE: 182 break; 183 } 184 185 if (itemId > -1) { 184 186 vctObjects->erase(it); 185 return playerId;186 } 187 } 188 } 189 190 return playerId;187 return itemId; 188 } 189 } 190 } 191 192 return itemId; 191 193 } 192 194 … … 214 216 215 217 bool Game::handleGameEvents() { 216 NETWORK_MSG serverMsg;217 218 map<unsigned int, Player*>::iterator it; 218 219 bool gameFinished = false; … … 325 326 } 326 327 328 break; 329 } 330 default: 331 { 327 332 break; 328 333 } -
common/MessageProcessor.cpp
r204edcf r0678d60 42 42 if (ret < 0) 43 43 error("sendMessage"); 44 else 45 44 45 return ret; 46 46 } 47 47 -
common/Player.cpp
r204edcf r0678d60 150 150 cout << "No class" << endl; 151 151 break; 152 dafault:153 cout << "nvalid class" << endl;154 break;155 152 } 156 153 } -
common/WorldMap.cpp
r204edcf r0678d60 45 45 } 46 46 47 void WorldMap::createObjectsFromStructures() { 48 for (int y=0; y<this->height; y++) { 49 for (int x=0; x<this->width; x++) { 50 switch (this->getStructure(x, y)) { 51 case WorldMap::STRUCTURE_BLUE_FLAG: 52 this->addObject(WorldMap::OBJECT_BLUE_FLAG, x*25+12, y*25+12); 53 break; 54 case WorldMap::STRUCTURE_RED_FLAG: 55 this->addObject(WorldMap::OBJECT_RED_FLAG, x*25+12, y*25+12); 56 break; 57 case WorldMap::STRUCTURE_NONE: 58 break; 59 } 60 } 61 } 62 } 63 47 64 WorldMap::TerrainType WorldMap::getElement(int x, int y) 48 65 { … … 71 88 pos.y = 0; 72 89 73 for ( int x=0; x<vctStructures->size(); x++) {74 for ( int y=0; y<(*vctStructures)[x]->size(); y++) {90 for (unsigned int x=0; x<vctStructures->size(); x++) { 91 for (unsigned int y=0; y<(*vctStructures)[x]->size(); y++) { 75 92 if ((*(*vctStructures)[x])[y] == t) { 76 93 pos.x = x; … … 131 148 case WorldMap::OBJECT_RED_FLAG: 132 149 cout << "RED_FLAG" << endl; 150 break; 151 case WorldMap::OBJECT_NONE: 152 cout << "OBJECY_NONE" << endl; 133 153 break; 134 154 } … … 145 165 cout << "RED_FLAG" << endl; 146 166 break; 167 case WorldMap::OBJECT_NONE: 168 cout << "OBJECY_NONE" << endl; 169 break; 147 170 } 148 171 it->pos.x = x; -
common/WorldMap.h
r204edcf r0678d60 54 54 ~WorldMap(); 55 55 56 void createObjectsFromStructures(); 57 56 58 TerrainType getElement(int x, int y); 57 59 void setElement(int x, int y, TerrainType type);
Note:
See TracChangeset
for help on using the changeset viewer.