This patch is become useless with r6623 from yourself :) Thanks,
Matt (gentildemon) Florian Köberle a écrit : > When receiving a ping a non turn master knows that there were no further > actions and can continue the game. > --- > src/game/game.cpp | 10 +++++++++- > src/game/game.h | 3 +++ > 2 files changed, 12 insertions(+), 1 deletions(-) > > diff --git a/src/game/game.cpp b/src/game/game.cpp > index 70df1d8..e7ca30c 100644 > --- a/src/game/game.cpp > +++ b/src/game/game.cpp > @@ -223,6 +223,7 @@ Game::Game(): > delay(0), > time_of_next_frame(0), > time_of_next_phy_frame(0), > + tick_count_of_next_ping(0), > character_already_chosen(false), > m_current_turn(0) > { } > @@ -248,7 +249,7 @@ void Game::Init() > > FOR_ALL_CHARACTERS(team, character) > (*character).ResetDamageStats(); > - > + tick_count_of_next_ping = 0; // 0 = as early as possible > SetState(END_TURN, true); // begin with a small pause > } > > @@ -525,6 +526,13 @@ void Game::MainLoop() > > if (Time::GetInstance()->Read() % 1000 == 20 && > Network::GetInstance()->IsGameMaster()) > PingClient(); > + > + uint current_tick_count = SDL_GetTicks(); > + if (current_tick_count >= tick_count_of_next_ping && > Network::GetInstance()->IsTurnMaster()) { > + tick_count_of_next_ping = current_tick_count + MS_BETWEEN_PINGS; > + Action a(Action::ACTION_NETWORK_PING); > + Network::GetInstance()->SendActionToAll(a); > + } > StatStart("Game:RefreshInput()"); > RefreshInput(); > StatStop("Game:RefreshInput()"); > diff --git a/src/game/game.h b/src/game/game.h > index 0ef790e..e83d9c9 100644 > --- a/src/game/game.h > +++ b/src/game/game.h > @@ -77,6 +77,9 @@ private: > uint time_of_next_frame; > // Time to compute the next physic engine frame > uint time_of_next_phy_frame; > + uint tick_count_of_next_ping; > + // Real time milliseconds intervall in which the turn master pings the > other players. > + static const uint MS_BETWEEN_PINGS = 100; > > bool character_already_chosen; > > _______________________________________________ Wormux-dev mailing list Wormux-dev@gna.org https://mail.gna.org/listinfo/wormux-dev