From edd5d117344b5e5746987a2e64174fb29fae13f4 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 8 May 2023 23:37:31 +0300 Subject: [PATCH] Fix issues discovered by self-review --- client/adventureMap/AdventureMapInterface.h | 15 +++++++++++---- client/lobby/CLobbyScreen.cpp | 2 +- config/widgets/adventureMap.json | 18 +++++++++--------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/client/adventureMap/AdventureMapInterface.h b/client/adventureMap/AdventureMapInterface.h index f3795ebbf..d5d9dfd0f 100644 --- a/client/adventureMap/AdventureMapInterface.h +++ b/client/adventureMap/AdventureMapInterface.h @@ -58,7 +58,8 @@ private: /// if true, then scrolling was blocked via ctrl and should not restart until player move cursor outside scrolling area bool scrollingWasBlocked; - const CSpell *spellBeingCasted; //nullptr if none + /// spell for which player is selecting target, or nullptr if none + const CSpell *spellBeingCasted; std::shared_ptr mapAudio; std::shared_ptr widget; @@ -66,10 +67,14 @@ private: private: void setState(EAdventureState state); - void adjustActiveness(); //should be called every time at AI/human turn transition; blocks GUI during AI turn - const IShipyard * ourInaccessibleShipyard(const CGObjectInstance *obj) const; //checks if obj is our ashipyard and cursor is 0,0 -> returns shipyard or nullptr else + /// updates active state of game window whenever game state changes + void adjustActiveness(); + /// checks if obj is our ashipyard and cursor is 0,0 -> returns shipyard or nullptr else + const IShipyard * ourInaccessibleShipyard(const CGObjectInstance *obj) const; + + /// check and if necessary reacts on scrolling by moving cursor to screen edge void handleMapScrollingUpdate(); void showMoveDetailsInStatusbar(const CGHeroInstance & hero, const CGPathNode & pathNode); @@ -78,10 +83,12 @@ private: /// exits currently opened world view mode and returns to normal map void exitCastingMode(); + + /// casts current spell at specified location void performSpellcasting(const int3 & castTarget); protected: - // CIntObject interface implementation + /// CIntObject interface implementation void activate() override; void deactivate() override; diff --git a/client/lobby/CLobbyScreen.cpp b/client/lobby/CLobbyScreen.cpp index 4ca4230d4..f3c901d5c 100644 --- a/client/lobby/CLobbyScreen.cpp +++ b/client/lobby/CLobbyScreen.cpp @@ -51,7 +51,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType) buttonOptions = std::make_shared(Point(411, 510), "GSPBUTT.DEF", CGI->generaltexth->zelp[46], std::bind(&CLobbyScreen::toggleTab, this, tabOpt), EShortcut::LOBBY_ADDITIONAL_OPTIONS); }; - buttonChat = std::make_shared(Point(619, 83), "GSPBUT2.DEF", CGI->generaltexth->zelp[48], std::bind(&CLobbyScreen::toggleChat, this), EShortcut::LOBBY_HIDE_CHAT); + buttonChat = std::make_shared(Point(619, 80), "GSPBUT2.DEF", CGI->generaltexth->zelp[48], std::bind(&CLobbyScreen::toggleChat, this), EShortcut::LOBBY_HIDE_CHAT); buttonChat->addTextOverlay(CGI->generaltexth->allTexts[532], FONT_SMALL); switch(screenType) diff --git a/config/widgets/adventureMap.json b/config/widgets/adventureMap.json index 25a793dfc..c73932bf2 100644 --- a/config/widgets/adventureMap.json +++ b/config/widgets/adventureMap.json @@ -452,7 +452,7 @@ // Resource & Data bar { "type": "adventurePlayerTexture", - "name" : "backgroundBottomCenter", + "name" : "backgroundLeftOfResourceDateBar", "image" : "DiBoxBck.pcx", "area" : { "left": 3, "bottom" : 4, "right" : 797, "height" : 21 } }, @@ -599,7 +599,7 @@ }, { "type": "adventureMapIcon", - "name": "worldViewIconOre", + "name": "worldViewIconMineOre", "image" : "VwSymbol.def", "index" : 7, "perPlayer" : 19, @@ -641,7 +641,7 @@ // World view - resources icons { "type": "adventureMapIcon", - "name": "worldViewIconMineWood", + "name": "worldViewIconResourceWood", "image" : "VwSymbol.def", "index" : 12, "perPlayer" : 19, @@ -649,7 +649,7 @@ }, { "type": "adventureMapIcon", - "name": "worldViewIconMineMercury", + "name": "worldViewIconResourceMercury", "image" : "VwSymbol.def", "index" : 13, "perPlayer" : 19, @@ -657,7 +657,7 @@ }, { "type": "adventureMapIcon", - "name": "worldViewIconOre", + "name": "worldViewIconResourceOre", "image" : "VwSymbol.def", "index" : 14, "perPlayer" : 19, @@ -665,7 +665,7 @@ }, { "type": "adventureMapIcon", - "name": "worldViewIconMineSulfur", + "name": "worldViewIconResourceSulfur", "image" : "VwSymbol.def", "index" : 15, "perPlayer" : 19, @@ -673,7 +673,7 @@ }, { "type": "adventureMapIcon", - "name": "worldViewIconMineCrystal", + "name": "worldViewIconResourceCrystal", "image" : "VwSymbol.def", "index" : 16, "perPlayer" : 19, @@ -681,7 +681,7 @@ }, { "type": "adventureMapIcon", - "name": "worldViewIconMineGems", + "name": "worldViewIconResourceGems", "image" : "VwSymbol.def", "index" : 17, "perPlayer" : 19, @@ -689,7 +689,7 @@ }, { "type": "adventureMapIcon", - "name": "worldViewIconMineGold", + "name": "worldViewIconResourceGold", "image" : "VwSymbol.def", "index" : 18, "perPlayer" : 19,