- Timestamp:
- May 25, 2013, 8:31:40 PM (11 years ago)
- Branches:
- master
- Children:
- 7553db9
- Parents:
- a6066e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
ra6066e8 re4c60ba 151 151 case WorldMap::TERRAIN_OCEAN: 152 152 case WorldMap::TERRAIN_ROCK: 153 { 153 154 it->second.pos = oldPos; 154 155 it->second.target.x = it->second.pos.x; … … 156 157 broadcastMove = true; 157 158 break; 159 } 158 160 default: 159 161 // if there are no obstacles, do nothing 162 break; 163 } 164 165 WorldMap::ObjectType flagType; 166 POSITION pos; 167 switch(gameMap->getStructure(it->second.pos.x/25, it->second.pos.y/25)) { 168 case WorldMap::STRUCTURE_BLUE_FLAG: 169 { 170 if (!it->second.team == 0 || !it->second.hasRedFlag) 171 break; 172 else { 173 it->second.hasRedFlag = false; 174 flagType = WorldMap::OBJECT_RED_FLAG; 175 pos = gameMap->getStructureLocation(WorldMap::STRUCTURE_RED_FLAG); 176 } 177 } 178 case WorldMap::STRUCTURE_RED_FLAG: 179 { 180 if (!it->second.team == 1 || !it->second.hasBlueFlag) 181 break; 182 else { 183 it->second.hasBlueFlag = false; 184 flagType = WorldMap::OBJECT_BLUE_FLAG; 185 pos = gameMap->getStructureLocation(WorldMap::STRUCTURE_BLUE_FLAG); 186 } 187 188 // all code from here to the break is executed for both cases of the switch 189 190 // send an OBJECT message to add the flag back to its spawn point 191 pos.x = pos.x*25+12; 192 pos.y = pos.y*25+12; 193 gameMap->addObject(flagType, pos.x, pos.y); 194 195 serverMsg.type = MSG_TYPE_OBJECT; 196 gameMap->getObjects()->back().serialize(serverMsg.buffer); 197 198 map<unsigned int, Player>::iterator it2; 199 for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++) 200 { 201 if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 ) 202 error("sendMessage"); 203 } 204 205 // this means a PLAYER message will be send 206 broadcastMove = true; 207 208 break; 209 } 210 default: 160 211 break; 161 212 }
Note:
See TracChangeset
for help on using the changeset viewer.