From dd227d24c365f353034a5beb35ad9f65aa56669d Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 17 Apr 2023 16:19:56 +0300 Subject: [PATCH] Formatting and cleanup --- client/ClientCommandManager.cpp | 2 -- client/PlayerLocalState.cpp | 10 ++++---- client/PlayerLocalState.h | 25 ++++++++++--------- .../adventureMap/CAdventureMapInterface.cpp | 4 --- client/adventureMap/CAdventureOptions.cpp | 2 -- client/adventureMap/CInGameConsole.cpp | 1 - client/mapView/MapRendererContext.cpp | 1 - 7 files changed, 18 insertions(+), 27 deletions(-) diff --git a/client/ClientCommandManager.cpp b/client/ClientCommandManager.cpp index b2c999286..39bd9ce38 100644 --- a/client/ClientCommandManager.cpp +++ b/client/ClientCommandManager.cpp @@ -8,12 +8,10 @@ * */ #include "StdInc.h" - #include "ClientCommandManager.h" #include "Client.h" #include "adventureMap/CInGameConsole.h" -#include "adventureMap/CAdventureMapInterface.h" #include "CPlayerInterface.h" #include "PlayerLocalState.h" #include "CServerHandler.h" diff --git a/client/PlayerLocalState.cpp b/client/PlayerLocalState.cpp index 1a5517b23..cf36aef6d 100644 --- a/client/PlayerLocalState.cpp +++ b/client/PlayerLocalState.cpp @@ -117,13 +117,13 @@ const CGTownInstance * PlayerLocalState::getCurrentTown() const const CArmedInstance * PlayerLocalState::getCurrentArmy() const { - if (currentSelection) + if(currentSelection) return dynamic_cast(currentSelection); else return nullptr; } -void PlayerLocalState::setSelection(const CArmedInstance *selection) +void PlayerLocalState::setSelection(const CArmedInstance * selection) { currentSelection = selection; } @@ -133,7 +133,7 @@ bool PlayerLocalState::isHeroSleeping(const CGHeroInstance * hero) const return vstd::contains(sleepingHeroes, hero); } -void PlayerLocalState::setHeroAsleep(const CGHeroInstance *hero) +void PlayerLocalState::setHeroAsleep(const CGHeroInstance * hero) { assert(hero); assert(vstd::contains(wanderingHeroes, hero)); @@ -158,7 +158,7 @@ const std::vector & PlayerLocalState::getWanderingHeroes const CGHeroInstance * PlayerLocalState::getWanderingHero(size_t index) { - if (index < wanderingHeroes.size()) + if(index < wanderingHeroes.size()) return wanderingHeroes[index]; return nullptr; } @@ -185,7 +185,7 @@ const std::vector & PlayerLocalState::getOwnedTowns() const CGTownInstance * PlayerLocalState::getOwnedTown(size_t index) { - if (index < ownedTowns.size()) + if(index < ownedTowns.size()) return ownedTowns[index]; return nullptr; } diff --git a/client/PlayerLocalState.h b/client/PlayerLocalState.h index d9c8f2b6c..a2c57c282 100644 --- a/client/PlayerLocalState.h +++ b/client/PlayerLocalState.h @@ -34,9 +34,9 @@ class PlayerLocalState std::vector wanderingHeroes; //our heroes on the adventure map (not the garrisoned ones) std::vector ownedTowns; //our towns on the adventure map - void saveHeroPaths(std::map & paths); void loadHeroPaths(std::map & paths); + public: struct SpellbookLastSetting { @@ -46,7 +46,8 @@ public: int spellbookLastTabBattle = 4; int spellbookLastTabAdvmap = 4; - template void serialize( Handler &h, const int version ) + template + void serialize(Handler & h, const int version) { h & spellbookLastPageBattle; h & spellbokLastPageAdvmap; @@ -71,15 +72,15 @@ public: void addWanderingHero(const CGHeroInstance * hero); void removeWanderingHero(const CGHeroInstance * hero); - void setPath(const CGHeroInstance *h, const CGPath & path); - bool setPath(const CGHeroInstance *h, const int3 & destination); + void setPath(const CGHeroInstance * h, const CGPath & path); + bool setPath(const CGHeroInstance * h, const int3 & destination); - const CGPath & getPath(const CGHeroInstance *h) const; - bool hasPath(const CGHeroInstance *h) const; + const CGPath & getPath(const CGHeroInstance * h) const; + bool hasPath(const CGHeroInstance * h) const; - void removeLastNode(const CGHeroInstance *h); - void erasePath(const CGHeroInstance *h); - void verifyPath(const CGHeroInstance *h); + void removeLastNode(const CGHeroInstance * h); + void erasePath(const CGHeroInstance * h); + void verifyPath(const CGHeroInstance * h); /// Returns currently selected object const CGHeroInstance * getCurrentHero() const; @@ -87,10 +88,10 @@ public: const CArmedInstance * getCurrentArmy() const; /// Changes currently selected object - void setSelection(const CArmedInstance *selection); + void setSelection(const CArmedInstance * selection); - template - void serialize( Handler &h, int version ) + template + void serialize(Handler & h, int version) { //WARNING: this code is broken and not used. See CClient::loadGame std::map pathsMap; //hero -> dest diff --git a/client/adventureMap/CAdventureMapInterface.cpp b/client/adventureMap/CAdventureMapInterface.cpp index fe423d64e..2dd82600b 100644 --- a/client/adventureMap/CAdventureMapInterface.cpp +++ b/client/adventureMap/CAdventureMapInterface.cpp @@ -27,7 +27,6 @@ #include "../windows/GUIClasses.h" #include "../windows/InfoWindows.h" #include "../CGameInfo.h" -#include "../CMusicHandler.h" #include "../CPlayerInterface.h" #include "../lobby/CSavingScreen.h" #include "../render/CAnimation.h" @@ -48,9 +47,6 @@ #include "../../lib/mapObjects/CGTownInstance.h" #include "../../lib/CPathfinder.h" #include "../../lib/mapping/CMap.h" -#include "../../lib/UnlockGuard.h" -#include "../../lib/TerrainHandler.h" -#include #define ADVOPT (conf.go()->ac) diff --git a/client/adventureMap/CAdventureOptions.cpp b/client/adventureMap/CAdventureOptions.cpp index 238ecf487..a880e2757 100644 --- a/client/adventureMap/CAdventureOptions.cpp +++ b/client/adventureMap/CAdventureOptions.cpp @@ -11,8 +11,6 @@ #include "StdInc.h" #include "CAdventureOptions.h" -#include "CAdventureMapInterface.h" - #include "../CGameInfo.h" #include "../CPlayerInterface.h" #include "../PlayerLocalState.h" diff --git a/client/adventureMap/CInGameConsole.cpp b/client/adventureMap/CInGameConsole.cpp index 27ac0b257..6008eaf76 100644 --- a/client/adventureMap/CInGameConsole.cpp +++ b/client/adventureMap/CInGameConsole.cpp @@ -16,7 +16,6 @@ #include "../CPlayerInterface.h" #include "../PlayerLocalState.h" #include "../ClientCommandManager.h" -#include "../adventureMap/CAdventureMapInterface.h" #include "../gui/CGuiHandler.h" #include "../render/Colors.h" diff --git a/client/mapView/MapRendererContext.cpp b/client/mapView/MapRendererContext.cpp index 442cdbc67..c1dd42d72 100644 --- a/client/mapView/MapRendererContext.cpp +++ b/client/mapView/MapRendererContext.cpp @@ -18,7 +18,6 @@ #include "../CGameInfo.h" #include "../CPlayerInterface.h" #include "../PlayerLocalState.h" -#include "../adventureMap/CAdventureMapInterface.h" #include "../../lib/CPathfinder.h" #include "../../lib/Point.h"