Created a NetworkGameObserver class able to extend the serialization code of GameObserver to synchronize and forward game actions on the network

Fixes in GameObserver serialization/deserialization code
Fixes in JNetwork and JSocket on windows
Various code cleanup (currentGamePhase access in particular)
Updated GUI code to re-enable a basic network GUI
Activated threaded tests on Windows. It uses 4 threads by default.
This commit is contained in:
Xawotihs@gmail.com
2013-01-22 22:39:49 +00:00
parent ada0a1555d
commit 9db8478dfe
18 changed files with 493 additions and 269 deletions

View File

@@ -160,7 +160,7 @@ int TestSuiteAI::Act(float dt)
phaseToGo = i;
}
}
if(observer->currentGamePhase != phaseToGo)
if(observer->getCurrentGamePhase() != phaseToGo)
suite->currentAction--;
else
{
@@ -340,11 +340,11 @@ void TestSuiteGame::assertGame()
int error = 0;
bool wasAI = false;
if (observer->currentGamePhase != endState.phase)
if (observer->getCurrentGamePhase() != endState.phase)
{
sprintf(result, "<span class=\"error\">==phase problem. Expected [ %s ](%i), got [ %s ](%i)==</span><br />",
Constants::MTGPhaseNames[endState.phase],endState.phase,
Constants::MTGPhaseNames[observer->currentGamePhase], observer->currentGamePhase);
Constants::MTGPhaseNames[observer->getCurrentGamePhase()], observer->getCurrentGamePhase());
Log(result);
error++;
}
@@ -560,6 +560,8 @@ int TestSuite::loadNext()
thread_count = QThread::idealThreadCount();
#elif defined(IOS)
thread_count = 6;
#else
thread_count = 4;
#endif
for(size_t i = 0; i < (thread_count-1); i++)
mWorkerThread.push_back(new boost::thread(ThreadProc, this));
@@ -819,7 +821,7 @@ void TestSuiteGame::initGame()
{
DebugTrace("TESTSUITE Init Game");
observer->phaseRing->goToPhase(initState.phase, observer->players[0], false);
observer->currentGamePhase = initState.phase;
observer->setCurrentGamePhase(initState.phase);
observer->resetStartupGame();