> Hm, I would have seen this patch at the end of the series, otherwise it > is ok. There was always a good reason to apply it early. For example I remember trying to move the wind patch forward, but it turned out that it didn't work correctly without this patch beeing applied. I didn't want to commit a sync removing patch without the other patches so I couldn't commit the wind patch earlier.
I moved this patch to the beginning of the patch list once, together with the wind patch. This means the commit message isn't valid anymore. I think I will change the commit message to: """"" Don't send ACTION_GAMELOOP_SET_STATE. This patch is required by the wind patch followed by this patch. As a nice side effect this patch makes the code simpler and reduce the network traffic. """"" > > (but remember I have not tested the patch-set) > > > Florian Köberle a écrit : >> Previous to this patch remote characters don't drop dynamites and >> grenades. >> This bug occurred from time to time previous to the last patch and >> occurred constantly since the last patch. >> >> Additionally this patch makes the code simpler and reduce the network >> traffic. >> --- >> lib/wormux/include/WORMUX_action.h | 1 - >> src/game/game.cpp | 41 >> +++++++++-------------------------- >> src/game/game.h | 7 ++--- >> src/include/action_handler.cpp | 7 ------ >> 4 files changed, 14 insertions(+), 42 deletions(-) >> >> diff --git a/lib/wormux/include/WORMUX_action.h >> b/lib/wormux/include/WORMUX_action.h >> index a64a515..b02c5e3 100644 >> --- a/lib/wormux/include/WORMUX_action.h >> +++ b/lib/wormux/include/WORMUX_action.h >> @@ -74,7 +74,6 @@ public: >> // ######################################################## >> ACTION_PLAYER_CHANGE_WEAPON, >> ACTION_PLAYER_CHANGE_CHARACTER, >> - ACTION_GAMELOOP_SET_STATE, >> ACTION_GAMELOOP_NEXT_TEAM, >> ACTION_GAME_CALCULATE_FRAME, >> >> diff --git a/src/game/game.cpp b/src/game/game.cpp >> index 47cd16d..c4b6fcd 100644 >> --- a/src/game/game.cpp >> +++ b/src/game/game.cpp >> @@ -632,11 +632,17 @@ bool Game::NewBox() >> return true; >> } >> >> - >> -void Game::Really_SetState(game_loop_state_t new_state) >> +void Game::SetState(game_loop_state_t new_state, bool begin_game) >> { >> + if (begin_game && >> + (Network::GetInstance()->IsGameMaster() || >> Network::GetInstance()->IsLocal())) >> + Network::GetInstance()->SetTurnMaster(true); >> + >> // already in good state, nothing to do >> - if (state == new_state) return; >> + if ((state == new_state) && !begin_game) return; >> + >> + MSG_DEBUG("game", "Ask for state %d", new_state); >> + >> state = new_state; >> >> Interface::GetInstance()->weapons_menu.Hide(); >> @@ -661,31 +667,6 @@ void Game::Really_SetState(game_loop_state_t >> new_state) >> } >> } >> >> -void Game::SetState(game_loop_state_t new_state, bool begin_game) const >> -{ >> - if (begin_game && >> - (Network::GetInstance()->IsGameMaster() || >> Network::GetInstance()->IsLocal())) >> - Network::GetInstance()->SetTurnMaster(true); >> - >> - if (!Network::GetInstance()->IsTurnMaster()) >> - return; >> - >> - // already in good state, nothing to do >> - if ((state == new_state) && !begin_game) return; >> - >> - // 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) >> - // See bug #10668 >> - if (Network::GetInstance()->IsTurnMaster() && new_state == PLAYING) >> - SyncCharacters(); >> - >> - MSG_DEBUG("game", "Ask for state %d", new_state); >> - Action *a = new Action(Action::ACTION_GAMELOOP_SET_STATE); >> - a->Push(new_state); >> - ActionHandler::GetInstance()->NewAction(a); >> -} >> - >> PhysicalObj* Game::GetMovingObject() const >> { >> if (!ActiveCharacter().IsImmobile()) >> @@ -736,7 +717,7 @@ bool Game::IsAnythingMoving() const >> } >> >> // Signal death of a character >> -void Game::SignalCharacterDeath (const Character *character) const >> +void Game::SignalCharacterDeath (const Character *character) >> { >> std::string txt; >> >> @@ -813,7 +794,7 @@ void Game::SignalCharacterDeath (const Character >> *character) const >> } >> >> // Signal falling or any kind of damage of a character >> -void Game::SignalCharacterDamage(const Character *character) const >> +void Game::SignalCharacterDamage(const Character *character) >> { >> MSG_DEBUG("game.endofturn", "%s has been hurt", >> character->GetName().c_str()); >> >> diff --git a/src/game/game.h b/src/game/game.h >> index c563b63..69b7a0c 100644 >> --- a/src/game/game.h >> +++ b/src/game/game.h >> @@ -139,16 +139,15 @@ public: >> >> // Read/Set State >> game_loop_state_t ReadState() const { return state; } >> - void SetState(game_loop_state_t new_state, bool begin_game=false) >> const; >> + void SetState(game_loop_state_t new_state, bool begin_game=false); >> >> void UserAsksForMenu() { ask_for_menu = true; }; >> - void Really_SetState(game_loop_state_t new_state); // called by the >> action_handler >> >> // Signal death of a player >> - void SignalCharacterDeath (const Character *character) const; >> + void SignalCharacterDeath (const Character *character); >> >> // Signal character damage >> - void SignalCharacterDamage(const Character *character) const; >> + void SignalCharacterDamage(const Character *character); >> >> // Bonus box handling >> bool NewBox(); >> diff --git a/src/include/action_handler.cpp >> b/src/include/action_handler.cpp >> index 7ba25a7..ac7c516 100644 >> --- a/src/include/action_handler.cpp >> +++ b/src/include/action_handler.cpp >> @@ -344,12 +344,6 @@ static void Action_DropBonusBox (Action *a) >> } >> } >> >> -static void Action_Game_SetState (Action *a) >> -{ >> - Game::game_loop_state_t state = Game::game_loop_state_t(a->PopInt()); >> - Game::GetInstance()->Really_SetState(state); >> -} >> - >> // ######################################################## >> >> static void Action_Rules_SetGameMode (Action *a) >> @@ -1006,7 +1000,6 @@ void Action_Handler_Init() >> ActionHandler::GetInstance()->Register >> (Action::ACTION_PLAYER_CHANGE_WEAPON, "PLAYER_change_weapon", >> &Action_Player_ChangeWeapon); >> ActionHandler::GetInstance()->Register >> (Action::ACTION_PLAYER_CHANGE_CHARACTER, "PLAYER_change_character", >> &Action_Player_ChangeCharacter); >> ActionHandler::GetInstance()->Register >> (Action::ACTION_GAMELOOP_NEXT_TEAM, "GAMELOOP_change_team", >> &Action_Game_NextTeam); >> - ActionHandler::GetInstance()->Register >> (Action::ACTION_GAMELOOP_SET_STATE, "GAMELOOP_set_state", >> &Action_Game_SetState); >> ActionHandler::GetInstance()->Register >> (Action::ACTION_GAME_CALCULATE_FRAME, "GAME_calculate_frame", >> &Action_Game_CalculateFrame); >> >> // ######################################################## >> > > > _______________________________________________ > Wormux-dev mailing list > Wormux-dev@gna.org > https://mail.gna.org/listinfo/wormux-dev > > _______________________________________________ Wormux-dev mailing list Wormux-dev@gna.org https://mail.gna.org/listinfo/wormux-dev