1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix more includes and move SideInBattle / SiegeInfo into battle

This commit is contained in:
Arseniy Shestakov 2017-06-29 02:02:05 +03:00
parent ab4c848169
commit 2ce02202c1
18 changed files with 66 additions and 62 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@
* *
*/ */
#pragma once #pragma once
#include "GameConstants.h" #include "../GameConstants.h"
class CGHeroInstance; class CGHeroInstance;
class CArmedInstance; class CArmedInstance;
@ -16,15 +16,15 @@ class CArmedInstance;
struct DLL_LINKAGE SideInBattle struct DLL_LINKAGE SideInBattle
{ {
PlayerColor color; PlayerColor color;
const CGHeroInstance *hero; //may be NULL if army is not commanded by 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 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 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 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 si16 enchanterCounter; //tends to pass through 0, so sign is needed
SideInBattle(); 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) template <typename Handler> void serialize(Handler &h, const int version)

View File

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

View File

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