From 8aaa9e63ddd7ca18e9eaf18ecd1c6d76c927f64f Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 9 Apr 2024 18:56:28 +0300 Subject: [PATCH] Fix build --- lib/MetaString.cpp | 9 ++++++--- lib/mapObjects/CGHeroInstance.h | 2 -- scripting/lua/api/BonusSystem.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/MetaString.cpp b/lib/MetaString.cpp index e6417c57d..92d84e851 100644 --- a/lib/MetaString.cpp +++ b/lib/MetaString.cpp @@ -170,10 +170,13 @@ DLL_LINKAGE std::string MetaString::toString() const case EMessage::REPLACE_POSITIVE_NUMBER: if (dst.find("%+d") != std::string::npos) { - if (numbers[nums] > 0) - boost::replace_first(dst, "%+d", '+' + std::to_string(numbers[nums++])); + int64_t value = numbers[nums]; + if (value > 0) + boost::replace_first(dst, "%+d", '+' + std::to_string(value)); else - boost::replace_first(dst, "%+d", std::to_string(numbers[nums++])); + boost::replace_first(dst, "%+d", std::to_string(value)); + + nums++; } else boost::replace_first(dst, "%d", std::to_string(numbers[nums++])); diff --git a/lib/mapObjects/CGHeroInstance.h b/lib/mapObjects/CGHeroInstance.h index 875a4f7f8..b929ef7e0 100644 --- a/lib/mapObjects/CGHeroInstance.h +++ b/lib/mapObjects/CGHeroInstance.h @@ -155,8 +155,6 @@ public: std::string getClassNameTranslated() const; std::string getClassNameTextID() const; -public: - bool hasSpellbook() const; int maxSpellLevel() const; void addSpellToSpellbook(const SpellID & spell); diff --git a/scripting/lua/api/BonusSystem.cpp b/scripting/lua/api/BonusSystem.cpp index f15acebec..0822e41bc 100644 --- a/scripting/lua/api/BonusSystem.cpp +++ b/scripting/lua/api/BonusSystem.cpp @@ -143,7 +143,7 @@ int BonusProxy::getDescription(lua_State * L) std::shared_ptr object; if(!S.tryGet(1, object)) return S.retNil(); - return LuaStack::quickRetStr(L, object->description); + return LuaStack::quickRetStr(L, object->description.toString()); } int BonusProxy::toJsonNode(lua_State * L)