Previously the verification has been been scheduled in SetState of the previous 
frame.

This patch causes regressions as it assumes that there are no "recations".
Which reactions I mean in this case actions which get scheduled as a result of 
the physics frame calculaton.

Follow up patches will remove those reactions.
---
 src/game/game.cpp |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/game/game.cpp b/src/game/game.cpp
index f62dbb6..47cd16d 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -518,6 +518,15 @@ void Game::MainLoop()
       // Refresh clock value
       RefreshClock();
 
+      // The action which verifys the random seed must be the first action 
sheduled!
+      // Otherwise the following could happen:
+      // 1. Action C gets sheduled which draws values from the random source.
+      // 2. Action V gets sheduled which verifies that random seed is X.
+      // 3. Action C gets executed: As a result the random seed has changed to 
another value Y.
+      // 4. Action V gets executed: It fails as the random seed is no longer X 
but Y.
+      if (Network::GetInstance()->IsTurnMaster())
+        RandomSync().Verify();
+
       if (Time::GetInstance()->Read() % 1000 == 20 && 
Network::GetInstance()->IsGameMaster())
         PingClient();
     }
@@ -664,15 +673,6 @@ void Game::SetState(game_loop_state_t new_state, bool 
begin_game) const
   // already in good state, nothing to do
   if ((state == new_state) && !begin_game) return;
 
-
-  // The action which verifys the random seed must be the first action 
sheduled!
-  // Otherwise the following could happen:
-  // 1. Action C gets sheduled which draws values from the random source.
-  // 2. Action V gets sheduled which verifies that random seed is X.
-  // 3. Action C gets executed: As a result the random seed has changed to 
another value Y.
-  // 4. Action V gets executed: It fails as the random seed is no longer X but 
Y.
-  RandomSync().Verify();
-
   // Send information about energy and position of every characters
   // ONLY at the beginning of a new turn!
   // (else you can send unstable information of a character which is moving)
-- 
1.6.0.4


_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à