From: <geo...@us...> - 2013-10-28 04:49:24
|
Revision: 6489 http://sourceforge.net/p/freeorion/code/6489 Author: geoffthemedio Date: 2013-10-28 04:49:21 +0000 (Mon, 28 Oct 2013) Log Message: ----------- Bombardment state resetting, to prevent inconsistencies between server and clients. Modified Paths: -------------- trunk/FreeOrion/server/ServerApp.cpp Modified: trunk/FreeOrion/server/ServerApp.cpp =================================================================== --- trunk/FreeOrion/server/ServerApp.cpp 2013-10-28 00:52:29 UTC (rev 6488) +++ trunk/FreeOrion/server/ServerApp.cpp 2013-10-28 04:49:21 UTC (rev 6489) @@ -2127,6 +2127,22 @@ } } } + + /** Removes bombardment state info from objects. Actual effects of + * bombardment are handled during */ + void CleanUpBombardmentStateInfo() { + for (ObjectMap::iterator<Ship> it = GetUniverse().Objects().begin<Ship>(); + it != GetUniverse().Objects().end<Ship>(); ++it) + { it->ClearBombardPlanet(); } + for (ObjectMap::iterator<Planet> it = GetUniverse().Objects().begin<Planet>(); + it != GetUniverse().Objects().end<Planet>(); ++it) + { + if (it->IsAboutToBeBombarded()) { + //Logger().debugStream() << "CleanUpBombardmentStateInfo: " << it->Name() << " was about to be bombarded"; + it->ResetIsAboutToBeBombarded(); + } + } + } } void ServerApp::PreCombatProcessTurns() { @@ -2141,6 +2157,10 @@ // inform players of order execution m_networking.SendMessage(TurnProgressMessage(Message::PROCESSING_ORDERS)); + // clear bombardment state before executing orders, so result after is only + // determined by what orders set. + CleanUpBombardmentStateInfo(); + // execute orders for (std::map<int, OrderSet*>::iterator it = m_turn_sequence.begin(); it != m_turn_sequence.end(); ++it) { OrderSet* order_set = it->second; @@ -2409,7 +2429,7 @@ if (GetOptionsDB().Get<bool>("verbose-logging")) { - Logger().debugStream() << "!!!!!!!!!!!!!!!!!!!!!!BEFORE TURN PROCESSING EFFECTS APPLICATION"; + Logger().debugStream() << "!!!!!!! BEFORE TURN PROCESSING EFFECTS APPLICATION"; Logger().debugStream() << objects.Dump(); } @@ -2418,7 +2438,7 @@ m_universe.ApplyAllEffectsAndUpdateMeters(); if (GetOptionsDB().Get<bool>("verbose-logging")) { - Logger().debugStream() << "!!!!!!!!!!!!!!!!!!!!!!AFTER TURN PROCESSING EFFECTS APPLICATION"; + Logger().debugStream() << "!!!!!!! AFTER TURN PROCESSING EFFECTS APPLICATION"; Logger().debugStream() << objects.Dump(); } @@ -2446,12 +2466,12 @@ if (!empires.Eliminated(it->first)) { Empire* empire = it->second; empire->UpdateAvailableLanes(); - empire->UpdateUnobstructedFleets(); // must be done after *all* noneliminated empires have updated their unobstructed systems + empire->UpdateUnobstructedFleets(); // must be done after *all* noneliminated empires have updated their unobstructed systems } } if (GetOptionsDB().Get<bool>("verbose-logging")) { - Logger().debugStream() << "!!!!!!!!!!!!!!!!!!!!!!AFTER UPDATING RESOURCE POOLS AND SUPPLY STUFF"; + Logger().debugStream() << "!!!!!!! AFTER UPDATING RESOURCE POOLS AND SUPPLY STUFF"; Logger().debugStream() << objects.Dump(); } @@ -2472,10 +2492,11 @@ if (GetOptionsDB().Get<bool>("verbose-logging")) { - Logger().debugStream() << "!!!!!!!!!!!!!!!!!!!!!!AFTER CHECKING QUEUE AND RESOURCE PROGRESS"; + Logger().debugStream() << "!!!!!!! AFTER CHECKING QUEUE AND RESOURCE PROGRESS"; Logger().debugStream() << objects.Dump(); } + // Execute meter-related effects on objects created this turn, so that new // UniverseObjects will have effects applied to them this turn, allowing // (for example) ships to have max fuel meters greater than 0 on the turn @@ -2483,7 +2504,7 @@ m_universe.ApplyMeterEffectsAndUpdateMeters(); if (GetOptionsDB().Get<bool>("verbose-logging")) { - Logger().debugStream() << "!!!!!!!!!!!!!!!!!!!!!!AFTER UPDATING METERS OF ALL OBJECTS"; + Logger().debugStream() << "!!!!!!! AFTER UPDATING METERS OF ALL OBJECTS"; Logger().debugStream() << objects.Dump(); } |