Ivan Savenko 4 месяцев назад
Родитель
Сommit
e06c0e8de0

+ 1 - 1
client/battle/BattleConsole.cpp

@@ -94,7 +94,7 @@ std::vector<std::string> BattleConsole::getVisibleText() const
 	return {logEntries[scrollPosition - 1], logEntries[scrollPosition]};
 }
 
-std::vector<std::string> BattleConsole::splitText(const std::string & text)
+std::vector<std::string> BattleConsole::splitText(const std::string & text) const
 {
 	std::vector<std::string> lines;
 	std::vector<std::string> output;

+ 1 - 1
client/battle/BattleConsole.h

@@ -53,7 +53,7 @@ private:
 	bool enteringText;
 
 	/// splits text into individual strings for battle log
-	std::vector<std::string> splitText(const std::string & text);
+	std::vector<std::string> splitText(const std::string & text) const;
 
 	/// select line(s) that will be visible in UI
 	std::vector<std::string> getVisibleText() const;

+ 2 - 2
client/battle/BattleHero.cpp

@@ -31,7 +31,7 @@
 #include "../../lib/gameState/InfoAboutArmy.h"
 #include "../../lib/mapObjects/CGHeroInstance.h"
 
-const CGHeroInstance * BattleHero::instance()
+const CGHeroInstance * BattleHero::instance() const
 {
 	return hero;
 }
@@ -127,7 +127,7 @@ void BattleHero::heroLeftClicked()
 	}
 }
 
-void BattleHero::heroRightClicked()
+void BattleHero::heroRightClicked() const
 {
 	if(settings["battle"]["stickyHeroInfoWindows"].Bool())
 		return;

+ 2 - 2
client/battle/BattleHero.h

@@ -46,7 +46,7 @@ class BattleHero : public CIntObject
 
 	void render(Canvas & canvas); //prints next frame of animation to to
 public:
-	const CGHeroInstance * instance();
+	const CGHeroInstance * instance() const;
 
 	void setPhase(EHeroAnimType newPhase); //sets phase of hero animation
 
@@ -60,7 +60,7 @@ public:
 	void play();
 
 	void heroLeftClicked();
-	void heroRightClicked();
+	void heroRightClicked() const;
 
 	BattleHero(const BattleInterface & owner, const CGHeroInstance * hero, bool defender);
 };

+ 3 - 3
client/battle/BattleResultWindow.cpp

@@ -42,12 +42,12 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
 	background->setPlayerColor(owner.playerID);
 	pos = center(background->pos);
 
-	exit = std::make_shared<CButton>(Point(384, 505), AnimationPath::builtin("iok6432.def"), std::make_pair("", ""), [&](){ bExitf();}, EShortcut::GLOBAL_ACCEPT);
+	exit = std::make_shared<CButton>(Point(384, 505), AnimationPath::builtin("iok6432.def"), std::make_pair("", ""), [this](){ bExitf();}, EShortcut::GLOBAL_ACCEPT);
 	exit->setBorderColor(Colors::METALLIC_GOLD);
 
 	if(allowReplay || owner.cb->getStartInfo()->extraOptionsInfo.unlimitedReplay)
 	{
-		repeat = std::make_shared<CButton>(Point(24, 505), AnimationPath::builtin("icn6432.def"), std::make_pair("", ""), [&](){ bRepeatf();}, EShortcut::GLOBAL_CANCEL);
+		repeat = std::make_shared<CButton>(Point(24, 505), AnimationPath::builtin("icn6432.def"), std::make_pair("", ""), [this](){ bRepeatf();}, EShortcut::GLOBAL_CANCEL);
 		repeat->setBorderColor(Colors::METALLIC_GOLD);
 		labels.push_back(std::make_shared<CLabel>(232, 520, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->translate("vcmi.battleResultsWindow.applyResultsLabel")));
 	}
@@ -79,7 +79,7 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
 	for(auto i : {BattleSide::ATTACKER, BattleSide::DEFENDER})
 	{
 		auto heroInfo = owner.cb->getBattle(br.battleID)->battleGetHeroInfo(i);
-		const int xs[] = {21, 392};
+		const std::array xs = {21, 392};
 
 		if(heroInfo.portraitSource.isValid()) //attacking hero
 		{

+ 2 - 2
client/battle/HeroInfoWindow.cpp

@@ -17,7 +17,7 @@
 #include "../../lib/gameState/InfoAboutArmy.h"
 #include "../../lib/texts/CGeneralTextHandler.h"
 
-HeroInfoBasicPanel::HeroInfoBasicPanel(const InfoAboutHero & hero, Point * position, bool initializeBackground)
+HeroInfoBasicPanel::HeroInfoBasicPanel(const InfoAboutHero & hero, const Point * position, bool initializeBackground)
 	: CIntObject(0)
 {
 	OBJECT_CONSTRUCTION;
@@ -84,7 +84,7 @@ void HeroInfoBasicPanel::show(Canvas & to)
 	CIntObject::show(to);
 }
 
-HeroInfoWindow::HeroInfoWindow(const InfoAboutHero & hero, Point * position)
+HeroInfoWindow::HeroInfoWindow(const InfoAboutHero & hero, const Point * position)
 	: CWindowObject(RCLICK_POPUP | SHADOW_DISABLED, ImagePath::builtin("CHRPOP"))
 {
 	OBJECT_CONSTRUCTION;

+ 5 - 2
client/battle/HeroInfoWindow.h

@@ -13,7 +13,10 @@
 
 class CLabel;
 class CAnimImage;
+
+VCMI_LIB_NAMESPACE_BEGIN
 struct InfoAboutHero;
+VCMI_LIB_NAMESPACE_END
 
 class HeroInfoBasicPanel : public CIntObject //extracted from InfoWindow to fit better as non-popup embed element
 {
@@ -23,7 +26,7 @@ private:
 	std::vector<std::shared_ptr<CAnimImage>> icons;
 
 public:
-	HeroInfoBasicPanel(const InfoAboutHero & hero, Point * position, bool initializeBackground = true);
+	HeroInfoBasicPanel(const InfoAboutHero & hero, const Point * position, bool initializeBackground = true);
 
 	void show(Canvas & to) override;
 
@@ -37,5 +40,5 @@ private:
 	std::shared_ptr<HeroInfoBasicPanel> content;
 
 public:
-	HeroInfoWindow(const InfoAboutHero & hero, Point * position);
+	HeroInfoWindow(const InfoAboutHero & hero, const Point * position);
 };

+ 1 - 1
client/battle/QuickSpellPanel.cpp

@@ -55,7 +55,7 @@ std::vector<std::tuple<SpellID, bool>> QuickSpellPanel::getSpells() const
 		{
 			id = SpellID::decode(spellIdentifier);
 		}
-		catch(const IdentifierResolutionException & e)
+		catch(const IdentifierResolutionException &)
 		{
 			id = SpellID::NONE;
 		}

+ 2 - 2
client/battle/StackQueue.cpp

@@ -31,8 +31,8 @@
 #include "../../lib/texts/TextOperations.h"
 
 StackQueue::StackQueue(bool Embedded, BattleInterface & owner)
-	: embedded(Embedded),
-	owner(owner)
+	: owner(owner)
+	, embedded(Embedded)
 {
 	OBJECT_CONSTRUCTION;
 

+ 1 - 1
client/gui/CIntObject.cpp

@@ -121,7 +121,7 @@ void CIntObject::enable()
 	recActions = ALL_ACTIONS;
 }
 
-bool CIntObject::isDisabled()
+bool CIntObject::isDisabled() const
 {
 	return recActions == NO_ACTIONS;
 }

+ 1 - 1
client/gui/CIntObject.h

@@ -74,7 +74,7 @@ public:
 	/// activates if needed, all activity enabled (Warning: may not be symmetric with disable if recActions was limited!)
 	void enable();
 	/// returns true if element was disabled via disable() call
-	bool isDisabled();
+	bool isDisabled() const;
 
 	/// deactivates or activates UI element based on flag
 	void setEnabled(bool on);