Kaynağa Gözat

Fix more includes and move SideInBattle / SiegeInfo into battle

Arseniy Shestakov 8 yıl önce
ebeveyn
işleme
2ce02202c1

+ 4 - 4
lib/VCMI_lib.cbp

@@ -145,6 +145,10 @@
 		<Unit filename="battle/CPlayerBattleCallback.h" />
 		<Unit filename="battle/ReachabilityInfo.cpp" />
 		<Unit filename="battle/ReachabilityInfo.h" />
+		<Unit filename="battle/SideInBattle.cpp" />
+		<Unit filename="battle/SideInBattle.h" />
+		<Unit filename="battle/SiegeInfo.cpp" />
+		<Unit filename="battle/SiegeInfo.h" />
 		<Unit filename="CArtHandler.cpp" />
 		<Unit filename="CArtHandler.h" />
 		<Unit filename="CBonusTypeHandler.cpp" />
@@ -215,10 +219,6 @@
 		<Unit filename="ResourceSet.cpp" />
 		<Unit filename="ResourceSet.h" />
 		<Unit filename="ScopeGuard.h" />
-		<Unit filename="SideInBattle.cpp" />
-		<Unit filename="SideInBattle.h" />
-		<Unit filename="SiegeInfo.cpp" />
-		<Unit filename="SiegeInfo.h" />
 		<Unit filename="StartInfo.h" />
 		<Unit filename="StdInc.h">
 			<Option compile="1" />

+ 4 - 4
lib/VCMI_lib.vcxproj

@@ -211,8 +211,8 @@
     <ClCompile Include="serializer\JsonDeserializer.cpp" />
     <ClCompile Include="serializer\JsonSerializeFormat.cpp" />
     <ClCompile Include="serializer\JsonSerializer.cpp" />
-    <ClCompile Include="SideInBattle.cpp" />
-    <ClCompile Include="SiegeInfo.cpp" />
+    <ClCompile Include="battle\SideInBattle.cpp" />
+    <ClCompile Include="battle\SiegeInfo.cpp" />
     <ClCompile Include="spells\CSpellHandler.cpp" />
     <ClCompile Include="spells\ISpellMechanics.cpp" />
     <ClCompile Include="spells\AdventureSpellMechanics.cpp" />
@@ -415,8 +415,8 @@
     <ClInclude Include="serializer\JsonDeserializer.h" />
     <ClInclude Include="serializer\JsonSerializeFormat.h" />
     <ClInclude Include="serializer\JsonSerializer.h" />
-    <ClInclude Include="SideInBattle.h" />
-    <ClInclude Include="SiegeInfo.h" />
+    <ClInclude Include="battle\SideInBattle.h" />
+    <ClInclude Include="battle\SiegeInfo.h" />
     <ClInclude Include="spells\AdventureSpellMechanics.h" />
     <ClInclude Include="spells\BattleSpellMechanics.h" />
     <ClInclude Include="spells\CDefaultSpellMechanics.h" />

+ 4 - 4
lib/VCMI_lib.vcxproj.filters

@@ -267,8 +267,8 @@
     <ClCompile Include="serializer\CTypeList.cpp" />
     <ClCompile Include="serializer\Connection.cpp" />
     <ClCompile Include="CStack.cpp" />
-    <ClCompile Include="SideInBattle.cpp" />
-    <ClCompile Include="SiegeInfo.cpp" />
+    <ClCompile Include="battle\SideInBattle.cpp" />
+    <ClCompile Include="battle\SiegeInfo.cpp" />
     <ClCompile Include="battle\BattleInfo.cpp" />
   </ItemGroup>
   <ItemGroup>
@@ -686,10 +686,10 @@
     <ClInclude Include="CStack.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="SideInBattle.h">
+    <ClInclude Include="battle\SideInBattle.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="SiegeInfo.h">
+    <ClInclude Include="battle\SiegeInfo.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>

+ 2 - 2
lib/battle/AccessibilityInfo.cpp

@@ -7,9 +7,9 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "AccessibilityInfo.h"
-#include "CStack.h"
+#include "../CStack.h"
 
 bool AccessibilityInfo::accessible(BattleHex tile, const CStack * stack) const
 {

+ 2 - 2
lib/battle/BattleAction.cpp

@@ -8,9 +8,9 @@
  *
  */
 
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "BattleAction.h"
-#include "CStack.h"
+#include "../CStack.h"
 
 using namespace Battle;
 

+ 2 - 2
lib/battle/BattleAttackInfo.cpp

@@ -7,9 +7,9 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "BattleAttackInfo.h"
-#include "CStack.h"
+#include "../CStack.h"
 
 
 BattleAttackInfo::BattleAttackInfo(const CStack * Attacker, const CStack * Defender, bool Shooting)

+ 1 - 1
lib/battle/BattleHex.cpp

@@ -7,7 +7,7 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "BattleHex.h"
 
 BattleHex::BattleHex() : hex(INVALID) {}

+ 6 - 6
lib/battle/BattleInfo.cpp

@@ -7,13 +7,13 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "BattleInfo.h"
-#include "CStack.h"
-#include "CHeroHandler.h"
-#include "NetPacks.h"
-#include "filesystem/Filesystem.h"
-#include "mapObjects/CGTownInstance.h"
+#include "../CStack.h"
+#include "../CHeroHandler.h"
+#include "../NetPacks.h"
+#include "../filesystem/Filesystem.h"
+#include "../mapObjects/CGTownInstance.h"
 
 const CStack * BattleInfo::getNextStack() const
 {

+ 5 - 5
lib/battle/CBattleInfoCallback.cpp

@@ -7,13 +7,13 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "CBattleInfoCallback.h"
-#include "CStack.h"
+#include "../CStack.h"
 #include "BattleInfo.h"
-#include "NetPacks.h"
-#include "spells/CSpellHandler.h"
-#include "mapObjects/CGTownInstance.h"
+#include "../NetPacks.h"
+#include "../spells/CSpellHandler.h"
+#include "../mapObjects/CGTownInstance.h"
 
 namespace SiegeStuffThatShouldBeMovedToHandlers // <=== TODO
 {

+ 4 - 4
lib/battle/CBattleInfoEssentials.cpp

@@ -7,12 +7,12 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "CBattleInfoEssentials.h"
-#include "CStack.h"
+#include "../CStack.h"
 #include "BattleInfo.h"
-#include "NetPacks.h"
-#include "mapObjects/CGTownInstance.h"
+#include "../NetPacks.h"
+#include "../mapObjects/CGTownInstance.h"
 
 ETerrainType CBattleInfoEssentials::battleTerrainType() const
 {

+ 2 - 2
lib/battle/CCallbackBase.cpp

@@ -7,10 +7,10 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "CCallbackBase.h"
 #include "BattleInfo.h"
-#include "CGameState.h"
+#include "../CGameState.h"
 
 bool CCallbackBase::duringBattle() const
 {

+ 5 - 5
lib/battle/CObstacleInstance.cpp

@@ -1,9 +1,9 @@
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "CObstacleInstance.h"
-#include "CHeroHandler.h"
-#include "CTownHandler.h"
-#include "VCMI_Lib.h"
-#include "spells/CSpellHandler.h"
+#include "../CHeroHandler.h"
+#include "../CTownHandler.h"
+#include "../VCMI_Lib.h"
+#include "../spells/CSpellHandler.h"
 
 /*
  * CObstacleInstance.cpp, part of VCMI engine

+ 3 - 3
lib/battle/CPlayerBattleCallback.cpp

@@ -7,10 +7,10 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "CPlayerBattleCallback.h"
-#include "CStack.h"
-#include "CGameState.h"
+#include "../CStack.h"
+#include "../CGameState.h"
 
 bool CPlayerBattleCallback::battleCanFlee() const
 {

+ 2 - 2
lib/battle/ReachabilityInfo.cpp

@@ -8,9 +8,9 @@
  *
  */
 
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "ReachabilityInfo.h"
-#include "CStack.h"
+#include "../CStack.h"
 
 
 ReachabilityInfo::Parameters::Parameters()

+ 3 - 3
lib/SideInBattle.cpp → lib/battle/SideInBattle.cpp

@@ -7,9 +7,9 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "SideInBattle.h"
-#include "mapObjects/CArmedInstance.h"
+#include "../mapObjects/CArmedInstance.h"
 
 SideInBattle::SideInBattle()
 {
@@ -20,7 +20,7 @@ SideInBattle::SideInBattle()
 	enchanterCounter = 0;
 }
 
-void SideInBattle::init(const CGHeroInstance *Hero, const CArmedInstance *Army)
+void SideInBattle::init(const CGHeroInstance * Hero, const CArmedInstance * Army)
 {
 	hero = Hero;
 	armyObject = Army;

+ 4 - 4
lib/SideInBattle.h → lib/battle/SideInBattle.h

@@ -8,7 +8,7 @@
  *
  */
 #pragma once
-#include "GameConstants.h"
+#include "../GameConstants.h"
 
 class CGHeroInstance;
 class CArmedInstance;
@@ -16,15 +16,15 @@ class CArmedInstance;
 struct DLL_LINKAGE SideInBattle
 {
 	PlayerColor color;
-	const CGHeroInstance *hero; //may be NULL if army is not commanded by hero
-	const CArmedInstance *armyObject; //adv. map object with army that participates in battle; may be same as hero
+	const CGHeroInstance * hero; //may be NULL if army is not commanded by hero
+	const CArmedInstance * armyObject; //adv. map object with army that participates in battle; may be same as hero
 
 	ui8 castSpellsCount; //how many spells each side has cast this turn
 	std::vector<const CSpell *> usedSpellsHistory; //every time hero casts spell, it's inserted here -> eagle eye skill
 	si16 enchanterCounter; //tends to pass through 0, so sign is needed
 
 	SideInBattle();
-	void init(const CGHeroInstance *Hero, const CArmedInstance *Army);
+	void init(const CGHeroInstance * Hero, const CArmedInstance * Army);
 
 
 	template <typename Handler> void serialize(Handler &h, const int version)

+ 12 - 8
lib/SiegeInfo.cpp → lib/battle/SiegeInfo.cpp

@@ -7,13 +7,13 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-#include "StdInc.h"
+#include "../StdInc.h"
 #include "SiegeInfo.h"
 
 
 SiegeInfo::SiegeInfo()
 {
-	for (int i = 0; i < wallState.size(); ++i)
+	for(int i = 0; i < wallState.size(); ++i)
 	{
 		wallState[i] = EWallState::NONE;
 	}
@@ -22,14 +22,18 @@ SiegeInfo::SiegeInfo()
 
 EWallState::EWallState SiegeInfo::applyDamage(EWallState::EWallState state, unsigned int value)
 {
-	if (value == 0)
+	if(value == 0)
 		return state;
 
-	switch (applyDamage(state, value - 1))
+	switch(applyDamage(state, value - 1))
 	{
-	case EWallState::INTACT    : return EWallState::DAMAGED;
-	case EWallState::DAMAGED   : return EWallState::DESTROYED;
-	case EWallState::DESTROYED : return EWallState::DESTROYED;
-	default: return EWallState::NONE;
+	case EWallState::INTACT:
+		return EWallState::DAMAGED;
+	case EWallState::DAMAGED:
+		return EWallState::DESTROYED;
+	case EWallState::DESTROYED:
+		return EWallState::DESTROYED;
+	default:
+		return EWallState::NONE;
 	}
 }

+ 1 - 1
lib/SiegeInfo.h → lib/battle/SiegeInfo.h

@@ -8,7 +8,7 @@
  *
  */
 #pragma once
-#include "GameConstants.h"
+#include "../GameConstants.h"
 
 //only for use in BattleInfo
 struct DLL_LINKAGE SiegeInfo