Kaynağa Gözat

vcmi: move bonuses to its own folder

Konstantin 2 yıl önce
ebeveyn
işleme
6fa1b2b19f

+ 2 - 2
AI/BattleAI/StackWithBonuses.cpp

@@ -36,9 +36,9 @@ void actualizeEffect(TBonusListPtr target, const Bonus & ef)
 	}
 }
 
-StackWithBonuses::StackWithBonuses(const HypotheticBattle * Owner, const CStack * Stack)
+StackWithBonuses::StackWithBonuses(const HypotheticBattle * Owner, const battle::CUnitState * Stack)
 	: battle::CUnitState(),
-	origBearer(Stack),
+	origBearer(Stack->getBonusBearer()),
 	owner(Owner),
 	type(Stack->unitType()),
 	baseAmount(Stack->unitBaseAmount()),

+ 2 - 8
AI/BattleAI/StackWithBonuses.h

@@ -14,16 +14,10 @@
 #include <vcmi/Environment.h>
 #include <vcmi/ServerCallback.h>
 
-#include "../../lib/HeroBonus.h"
+#include "../../lib/bonuses/HeroBonus.h"
 #include "../../lib/battle/BattleProxy.h"
 #include "../../lib/battle/CUnitState.h"
 
-VCMI_LIB_NAMESPACE_BEGIN
-
-class CStack;
-
-VCMI_LIB_NAMESPACE_END
-
 class HypotheticBattle;
 
 ///Fake random generator, used by AI to evaluate random server behavior
@@ -54,7 +48,7 @@ public:
 	std::vector<Bonus> bonusesToUpdate;
 	std::set<std::shared_ptr<Bonus>> bonusesToRemove;
 
-	StackWithBonuses(const HypotheticBattle * Owner, const CStack * Stack);
+	StackWithBonuses(const HypotheticBattle * Owner, const battle::CUnitState * Stack);
 
 	StackWithBonuses(const HypotheticBattle * Owner, const battle::UnitInfo & info);
 

+ 1 - 1
client/windows/CCreatureWindow.h

@@ -9,7 +9,7 @@
  */
 #pragma once
 
-#include "../../lib/HeroBonus.h"
+#include "../../lib/bonuses/HeroBonus.h"
 #include "../widgets/MiscWidgets.h"
 #include "CWindowObject.h"
 

+ 1 - 1
client/windows/CHeroWindow.h

@@ -11,7 +11,7 @@
 
 #include <vcmi/FactionMember.h>
 
-#include "../../lib/HeroBonus.h"
+#include "../../lib/bonuses/HeroBonus.h"
 #include "../widgets/CWindowWithArtifacts.h"
 #include "../widgets/CGarrisonInt.h"
 

+ 1 - 1
client/windows/GUIClasses.cpp

@@ -61,7 +61,7 @@
 #include "../lib/CStopWatch.h"
 #include "../lib/CTownHandler.h"
 #include "../lib/GameConstants.h"
-#include "../lib/HeroBonus.h"
+#include "../lib/bonuses/HeroBonus.h"
 #include "../lib/mapping/CMap.h"
 #include "../lib/NetPacksBase.h"
 #include "../lib/StartInfo.h"

+ 4 - 2
cmake_modules/VCMI_lib.cmake

@@ -27,6 +27,8 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/battle/SiegeInfo.cpp
 		${MAIN_LIB_DIR}/battle/Unit.cpp
 
+		${MAIN_LIB_DIR}/bonuses/HeroBonus.cpp
+
 		${MAIN_LIB_DIR}/events/ApplyDamage.cpp
 		${MAIN_LIB_DIR}/events/GameResumed.cpp
 		${MAIN_LIB_DIR}/events/ObjectVisitEnded.cpp
@@ -198,7 +200,6 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/CTownHandler.cpp
 		${MAIN_LIB_DIR}/GameConstants.cpp
 		${MAIN_LIB_DIR}/GameSettings.cpp
-		${MAIN_LIB_DIR}/HeroBonus.cpp
 		${MAIN_LIB_DIR}/IGameCallback.cpp
 		${MAIN_LIB_DIR}/IHandlerBase.cpp
 		${MAIN_LIB_DIR}/JsonDetail.cpp
@@ -300,6 +301,8 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/battle/SiegeInfo.h
 		${MAIN_LIB_DIR}/battle/Unit.h
 
+		${MAIN_LIB_DIR}/bonuses/HeroBonus.h
+
 		${MAIN_LIB_DIR}/events/ApplyDamage.h
 		${MAIN_LIB_DIR}/events/GameResumed.h
 		${MAIN_LIB_DIR}/events/ObjectVisitEnded.h
@@ -478,7 +481,6 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/FunctionList.h
 		${MAIN_LIB_DIR}/GameConstants.h
 		${MAIN_LIB_DIR}/GameSettings.h
-		${MAIN_LIB_DIR}/HeroBonus.h
 		${MAIN_LIB_DIR}/IBonusTypeHandler.h
 		${MAIN_LIB_DIR}/IGameCallback.h
 		${MAIN_LIB_DIR}/IGameEventsReceiver.h

+ 1 - 1
lib/BasicTypes.cpp

@@ -12,7 +12,7 @@
 
 #include "VCMI_Lib.h"
 #include "GameConstants.h"
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 
 #include <vcmi/Creature.h>
 #include <vcmi/Faction.h>

+ 1 - 1
lib/BattleFieldHandler.h

@@ -11,7 +11,7 @@
 
 #include <vcmi/EntityService.h>
 #include <vcmi/Entity.h>
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "GameConstants.h"
 #include "IHandlerBase.h"
 #include "battle/BattleHex.h"

+ 1 - 1
lib/CArtHandler.h

@@ -12,7 +12,7 @@
 #include <vcmi/Artifact.h>
 #include <vcmi/ArtifactService.h>
 
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "GameConstants.h"
 #include "IHandlerBase.h"
 

+ 1 - 1
lib/CBonusTypeHandler.h

@@ -12,7 +12,7 @@
 
 #include "IBonusTypeHandler.h"
 #include "IHandlerBase.h"
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

+ 1 - 1
lib/CCreatureHandler.h

@@ -9,7 +9,7 @@
  */
 #pragma once
 
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "ConstTransitivePtr.h"
 #include "ResourceSet.h"
 #include "GameConstants.h"

+ 1 - 1
lib/CCreatureSet.h

@@ -9,7 +9,7 @@
  */
 #pragma once
 
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "GameConstants.h"
 #include "CArtHandler.h"
 #include "CCreatureHandler.h"

+ 1 - 1
lib/CGameState.h

@@ -12,7 +12,7 @@
 #include "CCreatureHandler.h"
 #include "VCMI_Lib.h"
 
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "CCreatureSet.h"
 #include "ConstTransitivePtr.h"
 #include "IGameCallback.h"

+ 1 - 1
lib/CHeroHandler.h

@@ -16,7 +16,7 @@
 
 #include "../lib/ConstTransitivePtr.h"
 #include "GameConstants.h"
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "IHandlerBase.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 1 - 1
lib/CPathfinder.h

@@ -11,7 +11,7 @@
 
 #include "VCMI_Lib.h"
 #include "IGameCallback.h"
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "int3.h"
 
 #include <boost/heap/fibonacci_heap.hpp>

+ 1 - 1
lib/CPlayerState.h

@@ -12,7 +12,7 @@
 #include <vcmi/Player.h>
 #include <vcmi/Team.h>
 
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "ResourceSet.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 1 - 1
lib/CSkillHandler.h

@@ -12,7 +12,7 @@
 #include <vcmi/Skill.h>
 #include <vcmi/SkillService.h>
 
-#include "../lib/HeroBonus.h"
+#include "../lib/bonuses/HeroBonus.h"
 #include "GameConstants.h"
 #include "IHandlerBase.h"
 

+ 1 - 1
lib/CStack.h

@@ -10,7 +10,7 @@
 
 #pragma once
 #include "JsonNode.h"
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "CCreatureHandler.h" //todo: remove
 #include "battle/BattleHex.h"
 #include "mapObjects/CGHeroInstance.h" // for commander serialization

+ 1 - 1
lib/CTownHandler.cpp

@@ -23,7 +23,7 @@
 #include "filesystem/Filesystem.h"
 #include "mapObjects/CObjectClassesHandler.h"
 #include "mapObjects/CObjectHandler.h"
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "ResourceSet.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 1 - 1
lib/CTownHandler.h

@@ -19,7 +19,7 @@
 #include "IHandlerBase.h"
 #include "LogicalExpression.h"
 #include "battle/BattleHex.h"
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "Point.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 1 - 1
lib/JsonNode.cpp

@@ -13,7 +13,7 @@
 
 #include "ScopeGuard.h"
 
-#include "HeroBonus.h"
+#include "bonuses/HeroBonus.h"
 #include "filesystem/Filesystem.h"
 #include "VCMI_Lib.h" //for identifier resolution
 #include "CModHandler.h"

+ 1 - 1
lib/battle/BattleInfo.h

@@ -9,7 +9,7 @@
  */
 #pragma once
 #include "../int3.h"
-#include "../HeroBonus.h"
+#include "../bonuses/HeroBonus.h"
 #include "CBattleInfoCallback.h"
 #include "IBattleState.h"
 #include "SiegeInfo.h"

+ 1 - 1
lib/battle/DamageCalculator.cpp

@@ -13,7 +13,7 @@
 #include "CBattleInfoCallback.h"
 #include "Unit.h"
 
-#include "../HeroBonus.h"
+#include "../bonuses/HeroBonus.h"
 #include "../mapObjects/CGTownInstance.h"
 #include "../spells/CSpellHandler.h"
 #include "../GameSettings.h"

+ 1 - 1
lib/battle/Unit.h

@@ -13,7 +13,7 @@
 #include <vcmi/Creature.h>
 #include <vcmi/spells/Caster.h>
 
-#include "../HeroBonus.h"
+#include "../bonuses/HeroBonus.h"
 
 #include "IUnitInfo.h"
 #include "BattleHex.h"

+ 0 - 0
lib/HeroBonus.cpp → lib/bonuses/HeroBonus.cpp


+ 0 - 0
lib/HeroBonus.h → lib/bonuses/HeroBonus.h


+ 1 - 1
lib/mapObjects/CGTownInstance.cpp

@@ -12,6 +12,7 @@
 #include "CGTownInstance.h"
 #include "CObjectClassesHandler.h"
 #include "../spells/CSpellHandler.h"
+#include "../bonuses/HeroBonus.h"
 #include "../battle/IBattleInfoCallback.h"
 #include "../NetPacks.h"
 #include "../CConfigHandler.h"
@@ -23,7 +24,6 @@
 #include "../CPlayerState.h"
 #include "../TerrainHandler.h"
 #include "../serializer/JsonSerializeFormat.h"
-#include "../HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

+ 2 - 1
lib/mapObjects/CObjectHandler.h

@@ -12,10 +12,11 @@
 #include "ObjectTemplate.h"
 
 #include "../int3.h"
-#include "../HeroBonus.h"
 #include "../NetPacksBase.h"
 #include "../ResourceSet.h"
 
+#include "../bonuses/HeroBonus.h"
+
 VCMI_LIB_NAMESPACE_BEGIN
 
 class CGHeroInstance;

+ 2 - 1
lib/serializer/JsonUpdater.cpp

@@ -11,7 +11,8 @@
 #include "JsonUpdater.h"
 
 #include "../JsonNode.h"
-#include "../HeroBonus.h"
+
+#include "../bonuses/HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

+ 1 - 1
lib/spells/BonusCaster.cpp

@@ -14,8 +14,8 @@
 #include <vcmi/spells/Spell.h>
 
 #include "../NetPacksBase.h"
-#include "../HeroBonus.h"
 #include "../battle/Unit.h"
+#include "../bonuses/HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

+ 1 - 1
lib/spells/CSpellHandler.h

@@ -19,7 +19,7 @@
 #include "../int3.h"
 #include "../GameConstants.h"
 #include "../battle/BattleHex.h"
-#include "../HeroBonus.h"
+#include "../bonuses/HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

+ 1 - 1
lib/spells/ISpellMechanics.cpp

@@ -14,7 +14,7 @@
 #include "../CRandomGenerator.h"
 #include "../VCMI_Lib.h"
 
-#include "../HeroBonus.h"
+#include "../bonuses/HeroBonus.h"
 #include "../battle/CBattleInfoCallback.h"
 #include "../battle/IBattleState.h"
 #include "../battle/Unit.h"

+ 1 - 1
lib/spells/ISpellMechanics.h

@@ -16,7 +16,7 @@
 #include "../battle/Destination.h"
 #include "../int3.h"
 #include "../GameConstants.h"
-#include "../HeroBonus.h"
+#include "../bonuses/HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

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

@@ -15,7 +15,7 @@
 
 #include "../LuaStack.h"
 #include "../LuaCallWrapper.h"
-#include "../../../lib/HeroBonus.h"
+#include "../../../lib/bonuses/HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

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

@@ -11,7 +11,7 @@
 
 #include "BonusSystem.h"
 
-#include "../../../lib/HeroBonus.h"
+#include "../../../lib/bonuses/HeroBonus.h"
 
 #include "Registry.h"
 

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

@@ -15,7 +15,7 @@
 
 #include "../LuaStack.h"
 #include "../LuaCallWrapper.h"
-#include "../../../lib/HeroBonus.h"
+#include "../../../lib/bonuses/HeroBonus.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

+ 1 - 1
test/mock/mock_BonusBearer.h

@@ -10,7 +10,7 @@
 
 #pragma once
 
-#include "../../lib/HeroBonus.h"
+#include "../../lib/bonuses/HeroBonus.h"
 
 
 class BonusBearerMock : public IBonusBearer

+ 1 - 1
test/scripting/ScriptFixture.h

@@ -15,10 +15,10 @@
 #include <vcmi/events/EventBus.h>
 
 #include "../../lib/JsonNode.h"
-#include "../../lib/HeroBonus.h"
 #include "../../lib/ScriptHandler.h"
 #include "../../lib/NetPacksBase.h"
 #include "../../lib/battle/CBattleInfoCallback.h"
+#include "../../lib/bonuses/HeroBonus.h"
 
 #include "../mock/mock_ServerCallback.h"
 #include "../mock/mock_IBattleInfoCallback.h"