Changeset 7f884ea in network-game for common/WorldMap.cpp
- Timestamp:
- Jan 24, 2014, 12:27:15 AM (11 years ago)
- Branches:
- master
- Children:
- f66d04f
- Parents:
- e70b66b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/WorldMap.cpp
re70b66b r7f884ea 49 49 for (int x=0; x<this->width; x++) { 50 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);51 case STRUCTURE_BLUE_FLAG: 52 this->addObject(OBJECT_BLUE_FLAG, x*25+12, y*25+12); 53 53 break; 54 case WorldMap::STRUCTURE_RED_FLAG:55 this->addObject( WorldMap::OBJECT_RED_FLAG, x*25+12, y*25+12);54 case STRUCTURE_RED_FLAG: 55 this->addObject(OBJECT_RED_FLAG, x*25+12, y*25+12); 56 56 break; 57 case WorldMap::STRUCTURE_NONE:57 case STRUCTURE_NONE: 58 58 break; 59 59 } … … 62 62 } 63 63 64 WorldMap::TerrainType WorldMap::getElement(int x, int y)64 TerrainType WorldMap::getElement(int x, int y) 65 65 { 66 66 return (*(*vctMap)[x])[y]; … … 72 72 } 73 73 74 WorldMap::StructureType WorldMap::getStructure(int x, int y)74 StructureType WorldMap::getStructure(int x, int y) 75 75 { 76 76 return (*(*vctStructures)[x])[y]; … … 118 118 119 119 // used by the server to create new objects 120 void WorldMap::addObject( WorldMap::ObjectType t, int x, int y) {120 void WorldMap::addObject(ObjectType t, int x, int y) { 121 121 unsigned int id; 122 122 vector<WorldMap::Object>::iterator it; … … 137 137 138 138 // used by the client to update object positions or create objects it has not seen before 139 void WorldMap::updateObject(unsigned int id, WorldMap::ObjectType t, int x, int y) {139 void WorldMap::updateObject(unsigned int id, ObjectType t, int x, int y) { 140 140 vector<WorldMap::Object>::iterator it; 141 141 bool foundObject = false; … … 143 143 cout << "Searching for object to update" << endl; 144 144 switch (t) { 145 case WorldMap::OBJECT_BLUE_FLAG:145 case OBJECT_BLUE_FLAG: 146 146 cout << "BLUE_FLAG" << endl; 147 147 break; 148 case WorldMap::OBJECT_RED_FLAG:148 case OBJECT_RED_FLAG: 149 149 cout << "RED_FLAG" << endl; 150 150 break; 151 case WorldMap::OBJECT_NONE:151 case OBJECT_NONE: 152 152 cout << "OBJECY_NONE" << endl; 153 153 break; … … 159 159 cout << "Found object with id " << id << endl; 160 160 switch (it->type) { 161 case WorldMap::OBJECT_BLUE_FLAG:161 case OBJECT_BLUE_FLAG: 162 162 cout << "BLUE_FLAG" << endl; 163 163 break; 164 case WorldMap::OBJECT_RED_FLAG:164 case OBJECT_RED_FLAG: 165 165 cout << "RED_FLAG" << endl; 166 166 break; 167 case WorldMap::OBJECT_NONE:167 case OBJECT_NONE: 168 168 cout << "OBJECY_NONE" << endl; 169 169 break;
Note:
See TracChangeset
for help on using the changeset viewer.