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

Method doMiscUpkeep

source/gamemap/GameMap.cpp:1099–1298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1097}
1098
1099unsigned long int GameMap::doMiscUpkeep(double timeSinceLastTurn)
1100{
1101 Tile *tempTile;
1102 Ogre::Timer stopwatch;
1103 unsigned long int timeTaken;
1104
1105 // We check if it is pay day
1106 mTimePayDay += timeSinceLastTurn;
1107 if((mTimePayDay >= ConfigManager::getSingleton().getTimePayDay()))
1108 {
1109 mTimePayDay = 0;
1110 // We only notify players with a dungeon temple
1111 for(Player* player : getPlayers())
1112 {
1113 if(!player->getIsHuman())
1114 continue;
1115 if(player->getHasLost())
1116 continue;
1117
1118 // We notify the player if he owns a fighter only
1119 bool isCreatureSeat = false;
1120 for(Creature* creature : mCreatures)
1121 {
1122 if(creature->getSeat() != player->getSeat())
1123 continue;
1124
1125 if(creature->getDefinition()->isWorker())
1126 continue;
1127
1128 isCreatureSeat = true;
1129 break;
1130 }
1131
1132 if(!isCreatureSeat)
1133 continue;
1134
1135 ServerNotification *serverNotification = new ServerNotification(
1136 ServerNotificationType::chatServer, player);
1137 serverNotification->mPacket << "It's pay day !" << EventShortNoticeType::majorGameEvent;
1138 ODServer::getSingleton().queueServerNotification(serverNotification);
1139 }
1140
1141 for(Creature* creature : mCreatures)
1142 {
1143 creature->itsPayDay();
1144 }
1145 }
1146
1147 // Loop over all the filled seats in the game and check all the unfinished goals for each seat.
1148 // Add any seats with no remaining goals to the winningSeats vector.
1149 for (Seat* seat : mSeats)
1150 {
1151 if(seat->getPlayer() == nullptr)
1152 continue;
1153
1154 // Check the previously completed goals to make sure they are still met.
1155 seat->checkAllCompletedGoals();
1156

Callers

nothing calls this directly

Calls 15

getTimePayDayMethod · 0.80
getIsHumanMethod · 0.80
getHasLostMethod · 0.80
isWorkerMethod · 0.80
getDefinitionMethod · 0.80
itsPayDayMethod · 0.80
checkAllGoalsMethod · 0.80
numFailedGoalsMethod · 0.80
isAliveMethod · 0.80
clearTilesWithVisionMethod · 0.80

Tested by

no test coverage detected