From 940bdcee3ed9abdb08a2b436dcdae2abd00e0e4f Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 24 Aug 2023 23:34:28 +0300 Subject: [PATCH] Fixes according to review --- lib/NetPackVisitor.h | 2 +- lib/NetPacksLib.cpp | 2 +- server/processors/TurnOrderProcessor.cpp | 10 +++++----- server/processors/TurnOrderProcessor.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/NetPackVisitor.h b/lib/NetPackVisitor.h index bf740e46b..44f25dc1c 100644 --- a/lib/NetPackVisitor.h +++ b/lib/NetPackVisitor.h @@ -27,7 +27,7 @@ public: virtual void visitPlayerBlocked(PlayerBlocked & pack) {} virtual void visitPlayerCheated(PlayerCheated & pack) {} virtual void visitYourTurn(YourTurn & pack) {} - virtual void visitYourTurn(DaysWithoutTown & pack) {} + virtual void visitDaysWithoutTown(DaysWithoutTown & pack) {} virtual void visitTurnTimeUpdate(TurnTimeUpdate & pack) {} virtual void visitEntitiesChanged(EntitiesChanged & pack) {} virtual void visitSetResources(SetResources & pack) {} diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index e296c2273..7a1a90463 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -110,7 +110,7 @@ void YourTurn::visitTyped(ICPackVisitor & visitor) void DaysWithoutTown::visitTyped(ICPackVisitor & visitor) { - visitor.visitYourTurn(*this); + visitor.visitDaysWithoutTown(*this); } void EntitiesChanged::visitTyped(ICPackVisitor & visitor) diff --git a/server/processors/TurnOrderProcessor.cpp b/server/processors/TurnOrderProcessor.cpp index 9790e59d8..df57a0167 100644 --- a/server/processors/TurnOrderProcessor.cpp +++ b/server/processors/TurnOrderProcessor.cpp @@ -108,7 +108,7 @@ void TurnOrderProcessor::doStartPlayerTurn(PlayerColor which) void TurnOrderProcessor::doEndPlayerTurn(PlayerColor which) { - assert(playerMakingTurn(which)); + assert(isPlayerMakingTurn(which)); assert(gameHandler->getPlayerStatus(which) == EPlayerStatus::INGAME); actingPlayers.erase(which); @@ -149,7 +149,7 @@ void TurnOrderProcessor::onPlayerEndsGame(PlayerColor which) bool TurnOrderProcessor::onPlayerEndsTurn(PlayerColor which) { - if (!playerMakingTurn(which)) + if (!isPlayerMakingTurn(which)) { gameHandler->complain("Can not end turn for player that is not acting!"); return false; @@ -197,17 +197,17 @@ void TurnOrderProcessor::tryStartTurnsForPlayers() } } -bool TurnOrderProcessor::playerAwaitsTurn(PlayerColor which) const +bool TurnOrderProcessor::isPlayerAwaitsTurn(PlayerColor which) const { return vstd::contains(awaitingPlayers, which); } -bool TurnOrderProcessor::playerMakingTurn(PlayerColor which) const +bool TurnOrderProcessor::isPlayerMakingTurn(PlayerColor which) const { return vstd::contains(actingPlayers, which); } -bool TurnOrderProcessor::playerAwaitsNewDay(PlayerColor which) const +bool TurnOrderProcessor::isPlayerAwaitsNewDay(PlayerColor which) const { return vstd::contains(actedPlayers, which); } diff --git a/server/processors/TurnOrderProcessor.h b/server/processors/TurnOrderProcessor.h index c4b158704..af91bc547 100644 --- a/server/processors/TurnOrderProcessor.h +++ b/server/processors/TurnOrderProcessor.h @@ -37,9 +37,9 @@ class TurnOrderProcessor : boost::noncopyable void doStartPlayerTurn(PlayerColor which); void doEndPlayerTurn(PlayerColor which); - bool playerAwaitsTurn(PlayerColor which) const; - bool playerMakingTurn(PlayerColor which) const; - bool playerAwaitsNewDay(PlayerColor which) const; + bool isPlayerAwaitsTurn(PlayerColor which) const; + bool isPlayerMakingTurn(PlayerColor which) const; + bool isPlayerAwaitsNewDay(PlayerColor which) const; public: TurnOrderProcessor(CGameHandler * owner);