MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / notifySeatsConfigured

Method notifySeatsConfigured

source/gamemap/GameMap.cpp:3209–3250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3207}
3208
3209void GameMap::notifySeatsConfigured()
3210{
3211 mTeamIds.clear();
3212 // We always add the rogue team id
3213 mTeamIds.push_back(0);
3214
3215 for(Seat* seat : mSeats)
3216 {
3217 if(seat->isRogueSeat())
3218 continue;
3219
3220 uint32_t teamIndex = 0;
3221 for(int teamId : mTeamIds)
3222 {
3223 if(teamId == seat->getTeamId())
3224 break;
3225
3226 ++teamIndex;
3227 }
3228
3229 // If the team id was not in the list, save it
3230 if(teamIndex == mTeamIds.size())
3231 mTeamIds.push_back(seat->getTeamId());
3232
3233 seat->setTeamIndex(teamIndex);
3234 }
3235
3236 uint32_t nbTeams = mTeamIds.size();
3237 for(int xxx = 0; xxx < getMapSizeX(); ++xxx)
3238 {
3239 for(int yyy = 0; yyy < getMapSizeY(); ++yyy)
3240 {
3241 Tile* tile = getTile(xxx, yyy);
3242 if(tile == nullptr)
3243 continue;
3244
3245 tile->setTeamsNumber(nbTeams);
3246 }
3247 }
3248 // Now that team ids are set and tiles are configured, we can compute floodfill
3249 enableFloodFill();
3250}
3251
3252void GameMap::fireGameSound(Tile& tile, const std::string& soundFamily)
3253{

Callers 1

Calls 5

clearMethod · 0.80
isRogueSeatMethod · 0.80
getTeamIdMethod · 0.80
setTeamIndexMethod · 0.80
setTeamsNumberMethod · 0.80

Tested by

no test coverage detected