Movement orders get transferred using NewAction.
If a user press "jump" and "move left" simultaneously while the character looks 
right then it matters if the character turns or jumps first.
Thus it must not happen that the turn master schedules the "move left" and 
executes the "jump" without scheduling. In such a case the non tun master would 
execute it the other way round as he received the jump order later.
---
 src/character/character.cpp    |   15 ++++++---------
 src/include/action_handler.cpp |    3 ---
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/character/character.cpp b/src/character/character.cpp
index cab8bf6..24404f5 100644
--- a/src/character/character.cpp
+++ b/src/character/character.cpp
@@ -1098,9 +1098,8 @@ void Character::HandleKeyPressed_Jump()
   ActiveTeam().crosshair.Hide();
 
   if (IsImmobile()) {
-    Action a(Action::ACTION_CHARACTER_JUMP);
-    Network::GetInstance()->SendActionToAll(a);
-    Jump();
+    Action *a = new Action(Action::ACTION_CHARACTER_JUMP);
+    ActionHandler::GetInstance()->NewAction(a);
   }
 }
 
@@ -1112,9 +1111,8 @@ void Character::HandleKeyPressed_HighJump()
   ActiveTeam().crosshair.Hide();
 
   if (IsImmobile()) {
-    Action a(Action::ACTION_CHARACTER_HIGH_JUMP);
-    Network::GetInstance()->SendActionToAll(a);
-    HighJump();
+    Action *a = new Action(Action::ACTION_CHARACTER_HIGH_JUMP);
+    ActionHandler::GetInstance()->NewAction(a);
   }
 }
 
@@ -1126,9 +1124,8 @@ void Character::HandleKeyPressed_BackJump()
   ActiveTeam().crosshair.Hide();
 
   if (IsImmobile()) {
-    Action a(Action::ACTION_CHARACTER_BACK_JUMP);
-    Network::GetInstance()->SendActionToAll(a);
-    BackJump();
+    Action *a = new Action(Action::ACTION_CHARACTER_BACK_JUMP);
+    ActionHandler::GetInstance()->NewAction(a);
   }
 }
 
diff --git a/src/include/action_handler.cpp b/src/include/action_handler.cpp
index 36eed52..ae17c3d 100644
--- a/src/include/action_handler.cpp
+++ b/src/include/action_handler.cpp
@@ -558,21 +558,18 @@ void WORMUX_DisconnectPlayer(Player& player)
 static void Action_Character_Jump (Action */*a*/)
 {
   Game::GetInstance()->SetCharacterChosen(true);
-  ASSERT(!ActiveTeam().IsLocal());
   ActiveCharacter().Jump();
 }
 
 static void Action_Character_HighJump (Action */*a*/)
 {
   Game::GetInstance()->SetCharacterChosen(true);
-  ASSERT(!ActiveTeam().IsLocal());
   ActiveCharacter().HighJump();
 }
 
 static void Action_Character_BackJump (Action */*a*/)
 {
   Game::GetInstance()->SetCharacterChosen(true);
-  ASSERT(!ActiveTeam().IsLocal());
   ActiveCharacter().BackJump();
 }
 
-- 
1.6.0.4


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

Répondre à