Browse Source

Fix build

Ivan Savenko 1 year ago
parent
commit
8aaa9e63dd
3 changed files with 7 additions and 6 deletions
  1. 6 3
      lib/MetaString.cpp
  2. 0 2
      lib/mapObjects/CGHeroInstance.h
  3. 1 1
      scripting/lua/api/BonusSystem.cpp

+ 6 - 3
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++]));

+ 0 - 2
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);

+ 1 - 1
scripting/lua/api/BonusSystem.cpp

@@ -143,7 +143,7 @@ int BonusProxy::getDescription(lua_State * L)
 	std::shared_ptr<const Bonus> 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)