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

Improve formatting, update other config information about includes.

This commit is contained in:
FeniksFire 2017-06-26 18:50:35 +02:00
parent 4113bdab01
commit 8ccdda6d2d
22 changed files with 226 additions and 204 deletions

View File

@ -125,16 +125,28 @@
<Unit filename="../Version.h" />
<Unit filename="../include/vstd/CLoggerBase.h" />
<Unit filename="AI_Base.h" />
<Unit filename="BattleAction.cpp" />
<Unit filename="BattleAction.h" />
<Unit filename="BattleHex.cpp" />
<Unit filename="BattleHex.h" />
<Unit filename="BattleInfo.cpp" />
<Unit filename="BattleInfo.h" />
<Unit filename="battle/BattleAction.cpp" />
<Unit filename="battle/BattleAction.h" />
<Unit filename="battle/BattleHex.cpp" />
<Unit filename="battle/BattleHex.h" />
<Unit filename="battle/BattleInfo.cpp" />
<Unit filename="battle/BattleInfo.h" />
<Unit filename="battle/AccessibilityInfo.cpp" />
<Unit filename="battle/AccessibilityInfo.h" />
<Unit filename="battle/BattleAttackInfo.cpp" />
<Unit filename="battle/BattleAttackInfo.h" />
<Unit filename="battle/CBattleInfoCallback.cpp" />
<Unit filename="battle/CBattleInfoCallback.h" />
<Unit filename="battle/CBattleInfoEssentials.cpp" />
<Unit filename="battle/CBattleInfoEssentials.h" />
<Unit filename="battle/CCallbackBase.cpp" />
<Unit filename="battle/CCallbackBase.h" />
<Unit filename="battle/CPlayerBattleCallback.cpp" />
<Unit filename="battle/CPlayerBattleCallback.h" />
<Unit filename="battle/ReachabilityInfo.cpp" />
<Unit filename="battle/ReachabilityInfo.h" />
<Unit filename="CArtHandler.cpp" />
<Unit filename="CArtHandler.h" />
<Unit filename="CBattleCallback.cpp" />
<Unit filename="CBattleCallback.h" />
<Unit filename="CBonusTypeHandler.cpp" />
<Unit filename="CBonusTypeHandler.h" />
<Unit filename="CBuildingHandler.cpp" />
@ -161,8 +173,8 @@
<Unit filename="CMakeLists.txt" />
<Unit filename="CModHandler.cpp" />
<Unit filename="CModHandler.h" />
<Unit filename="CObstacleInstance.cpp" />
<Unit filename="CObstacleInstance.h" />
<Unit filename="battle/CObstacleInstance.cpp" />
<Unit filename="battle/CObstacleInstance.h" />
<Unit filename="CPathfinder.cpp" />
<Unit filename="CPathfinder.h" />
<Unit filename="CPlayerState.h" />

View File

@ -168,9 +168,16 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="BattleAction.cpp" />
<ClCompile Include="BattleHex.cpp" />
<ClCompile Include="BattleInfo.cpp" />
<ClCompile Include="battle\BattleAction.cpp" />
<ClCompile Include="battle\BattleHex.cpp" />
<ClCompile Include="battle\BattleInfo.cpp" />
<ClCompile Include="battle\AccessibilityInfo.cpp" />
<ClCompile Include="battle\BattleAttackInfo.cpp" />
<ClCompile Include="battle\CBattleInfoCallback.cpp" />
<ClCompile Include="battle\CBattleInfoEssentials.cpp" />
<ClCompile Include="battle\CCallbackBase.cpp" />
<ClCompile Include="battle\CPlayerBattleCallback.cpp" />
<ClCompile Include="battle\ReachabilityInfo.cpp" />
<ClCompile Include="CArtHandler.cpp" />
<ClCompile Include="CBonusTypeHandler.cpp" />
<ClCompile Include="CBuildingHandler.cpp" />
@ -183,7 +190,7 @@
<ClCompile Include="CGeneralTextHandler.cpp" />
<ClCompile Include="CHeroHandler.cpp" />
<ClCompile Include="CModHandler.cpp" />
<ClCompile Include="CObstacleInstance.cpp" />
<ClCompile Include="battle\CObstacleInstance.cpp" />
<ClCompile Include="CPathfinder.cpp" />
<ClCompile Include="CStack.cpp" />
<ClCompile Include="CThreadHelper.cpp" />
@ -262,7 +269,6 @@
<ClCompile Include="logging\CLogger.cpp" />
<ClCompile Include="logging\CBasicLogConfigurator.cpp" />
<ClCompile Include="HeroBonus.cpp" />
<ClCompile Include="CBattleCallback.cpp" />
<ClCompile Include="IGameCallback.cpp" />
<ClCompile Include="CGameInfoCallback.cpp" />
<ClCompile Include="JsonNode.cpp" />
@ -290,9 +296,16 @@
<ClInclude Include="..\Global.h" />
<ClInclude Include="..\Version.h" />
<ClInclude Include="AI_Base.h" />
<ClInclude Include="BattleAction.h" />
<ClInclude Include="BattleHex.h" />
<ClInclude Include="BattleInfo.h" />
<ClInclude Include="battle\BattleAction.h" />
<ClInclude Include="battle\BattleHex.h" />
<ClInclude Include="battle\BattleInfo.h" />
<ClInclude Include="battle\AccessibilityInfo.h" />
<ClInclude Include="battle\BattleAttackInfo.h" />
<ClInclude Include="battle\CBattleInfoCallback.h" />
<ClInclude Include="battle\CBattleInfoEssentials.h" />
<ClInclude Include="battle\CCallbackBase.h" />
<ClInclude Include="battle\CPlayerBattleCallback.h" />
<ClInclude Include="battle\ReachabilityInfo.h" />
<ClInclude Include="CArtHandler.h" />
<ClInclude Include="CBonusTypeHandler.h" />
<ClInclude Include="CBuildingHandler.h" />
@ -306,7 +319,7 @@
<ClInclude Include="CGeneralTextHandler.h" />
<ClInclude Include="CHeroHandler.h" />
<ClInclude Include="CModHandler.h" />
<ClInclude Include="CObstacleInstance.h" />
<ClInclude Include="battle\CObstacleInstance.h" />
<ClInclude Include="CondSh.h" />
<ClInclude Include="ConstTransitivePtr.h" />
<ClInclude Include="CPathfinder.h" />
@ -376,7 +389,6 @@
<ClInclude Include="logging\CBasicLogConfigurator.h" />
<ClInclude Include="GameConstants.h" />
<ClInclude Include="HeroBonus.h" />
<ClInclude Include="CBattleCallback.h" />
<ClInclude Include="IGameCallback.h" />
<ClInclude Include="CGameInfoCallback.h" />
<ClInclude Include="IGameEventsReceiver.h" />

View File

@ -31,7 +31,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="BattleAction.cpp" />
<ClCompile Include="battle\BattleAction.cpp" />
<ClCompile Include="CArtHandler.cpp" />
<ClCompile Include="CBuildingHandler.cpp" />
<ClCompile Include="CCreatureHandler.cpp" />
@ -49,14 +49,20 @@
<ClCompile Include="ResourceSet.cpp" />
<ClCompile Include="CGameInterface.cpp" />
<ClCompile Include="JsonNode.cpp" />
<ClCompile Include="BattleHex.cpp" />
<ClCompile Include="battle\BattleHex.cpp" />
<ClCompile Include="CConsoleHandler.cpp" />
<ClCompile Include="CThreadHelper.cpp" />
<ClCompile Include="StdInc.cpp" />
<ClCompile Include="CObstacleInstance.cpp" />
<ClCompile Include="battle\CObstacleInstance.cpp" />
<ClCompile Include="CModHandler.cpp" />
<ClCompile Include="CConfigHandler.cpp" />
<ClCompile Include="CBattleCallback.cpp" />
<ClCompile Include="battle\AccessibilityInfo.cpp" />
<ClCompile Include="battle\BattleAttackInfo.cpp" />
<ClCompile Include="battle\CBattleInfoCallback.cpp" />
<ClCompile Include="battle\CBattleInfoEssentials.cpp" />
<ClCompile Include="battle\CCallbackBase.cpp" />
<ClCompile Include="battle\CPlayerBattleCallback.cpp" />
<ClCompile Include="battle\ReachabilityInfo.cpp" />
<ClCompile Include="Mapping\CCampaignHandler.cpp" />
<ClCompile Include="GameConstants.cpp" />
<ClCompile Include="VCMIDirs.cpp" />
@ -263,7 +269,7 @@
<ClCompile Include="CStack.cpp" />
<ClCompile Include="SideInBattle.cpp" />
<ClCompile Include="SiegeInfo.cpp" />
<ClCompile Include="BattleInfo.cpp" />
<ClCompile Include="battle\BattleInfo.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="CCreatureSet.h">
@ -317,10 +323,10 @@
<ClInclude Include="CTownHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BattleAction.h">
<ClInclude Include="battle\BattleAction.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CObstacleInstance.h">
<ClInclude Include="battle\CObstacleInstance.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="IGameEventsReceiver.h">
@ -344,7 +350,7 @@
<ClInclude Include="AI_Base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BattleHex.h">
<ClInclude Include="battle\BattleHex.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CConsoleHandler.h">
@ -380,7 +386,25 @@
<ClInclude Include="CConfigHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CBattleCallback.h">
<ClInclude Include="AccessibilityInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BattleAttackInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CBattleInfoCallback.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CBattleInfoEssentials.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CCallbackBase.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CPlayerBattleCallback.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ReachabilityInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Mapping\CCampaignHandler.h">
@ -656,7 +680,7 @@
<ClInclude Include="serializer\Connection.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BattleInfo.h">
<ClInclude Include="battle\BattleInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CStack.h">

View File

@ -40,7 +40,6 @@ bool AccessibilityInfo::occupiable(const CStack *stack, BattleHex tile) const
//obviously, we can occupy tile by standing on it
if(accessible(tile, stack))
return true;
if(stack->doubleWide())
{
//Check the tile next to -> if stack stands there, it'll also occupy considered hex
@ -48,6 +47,5 @@ bool AccessibilityInfo::occupiable(const CStack *stack, BattleHex tile) const
if(accessible(anotherTile, stack))
return true;
}
return false;
}

View File

@ -13,9 +13,7 @@
class CStack;
//Accessibility is property of hex in battle. It doesn't depend on stack, side's perspective and so on.
namespace EAccessibility
{
enum EAccessibility
enum class EAccessibility
{
ACCESSIBLE,
ALIVE_STACK,
@ -25,9 +23,9 @@ enum EAccessibility
UNAVAILABLE, //indestructible wall parts, special battlefields (like boat-to-boat)
SIDE_COLUMN //used for first and last columns of hexes that are unavailable but wat machines can stand there
};
}
typedef std::array<EAccessibility::EAccessibility, GameConstants::BFIELD_SIZE> TAccessibilityArray;
typedef std::array<EAccessibility, GameConstants::BFIELD_SIZE> TAccessibilityArray;
struct DLL_LINKAGE AccessibilityInfo : TAccessibilityArray
{

View File

@ -15,8 +15,6 @@
#include "spells/CSpellHandler.h"
#include "mapObjects/CGTownInstance.h"
#define RETURN_IF_NOT_BATTLE(X) if(!duringBattle()) {logGlobal->errorStream() << __FUNCTION__ << " called when no battle!"; return X; }
namespace SiegeStuffThatShouldBeMovedToHandlers // <=== TODO
{
static void retreiveTurretDamageRange(const CGTownInstance * town, const CStack * turret, double & outMinDmg, double & outMaxDmg)
@ -101,7 +99,7 @@ ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleCanCastSpell(con
RETURN_IF_NOT_BATTLE(ESpellCastProblem::INVALID);
if(caster == nullptr)
{
logGlobal->errorStream() << "CBattleInfoCallback::battleCanCastSpell: no spellcaster.";
logGlobal->error("CBattleInfoCallback::battleCanCastSpell: no spellcaster.");
return ESpellCastProblem::INVALID;
}
const PlayerColor player = caster->getOwner();
@ -450,11 +448,11 @@ std::vector<BattleHex> CBattleInfoCallback::battleGetAvailableHexes(const CStack
// Return true if given hex has at least one available neighbour.
// Available hexes are already present in ret vector.
auto availableNeighbor = boost::find_if(ret, [=] (BattleHex availableHex)
{ return BattleHex::mutualPosition(hex, availableHex) >= 0; });
{
return BattleHex::mutualPosition(hex, availableHex) >= 0;
});
return availableNeighbor != ret.end();
};
for(const CStack * otherSt : battleAliveStacks(stack->attackerOwned))
{
if(!otherSt->isValidTarget(false))
@ -635,12 +633,10 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo &info) c
additiveBonus += inc;
}
//applying jousting bonus
if(info.attackerBonuses->hasBonusOfType(Bonus::JOUSTING) && !info.defenderBonuses->hasBonusOfType(Bonus::CHARGE_IMMUNITY))
additiveBonus += info.chargedFields * 0.05;
//handling secondary abilities and artifacts giving premies to them
if(info.shooting)
additiveBonus += info.attackerBonuses->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::ARCHERY) / 100.0;
@ -864,7 +860,7 @@ AccessibilityInfo CBattleInfoCallback::getAccesibility() const
//gate -> should be before stacks
if(battleGetSiegeLevel() > 0)
{
EAccessibility::EAccessibility accessability = EAccessibility::ACCESSIBLE;
EAccessibility accessability = EAccessibility::ACCESSIBLE;
switch(battleGetGateState())
{
case EGateState::CLOSED:
@ -950,7 +946,6 @@ ReachabilityInfo CBattleInfoCallback::makeBFS(const AccessibilityInfo &accessibi
const std::set<BattleHex> quicksands = getStoppers(params.perspective);
//const bool twoHexCreature = params.doubleWide;
std::queue<BattleHex> hexq; //bfs queue
//first element
@ -1291,7 +1286,6 @@ si8 CBattleInfoCallback::battleHasDistancePenalty(const IBonusBearer *bonusBeare
for(auto hex : dstStack->getHexes())
if(BattleHex::getDistance(shooterPosition, hex) <= GameConstants::BATTLE_PENALTY_DISTANCE)
return false;
//TODO what about two-hex shooters?
}
else
@ -1354,7 +1348,6 @@ ui32 CBattleInfoCallback::battleGetSpellCost(const CSpell * sp, const CGHeroInst
si32 manaReduction = 0;
si32 manaIncrease = 0;
for(auto stack : battleAliveStacks())
{
if(stack->owner == caster->tempOwner && stack->hasBonusOfType(Bonus::CHANGES_SPELL_COST_FOR_ALLY))
@ -1375,9 +1368,7 @@ const CStack * CBattleInfoCallback::getStackIf(std::function<bool(const CStack*)
RETURN_IF_NOT_BATTLE(nullptr);
auto stacks = battleGetAllStacks();
auto stackItr = range::find_if(stacks, pred);
return stackItr == stacks.end()
? nullptr
: *stackItr;
return stackItr == stacks.end() ? nullptr : *stackItr;
}
si8 CBattleInfoCallback::battleHasShootingPenalty(const CStack * stack, BattleHex destHex)

View File

@ -30,7 +30,6 @@ struct DLL_LINKAGE AttackableTiles
}
};
class DLL_LINKAGE CBattleInfoCallback : public virtual CBattleInfoEssentials
{
public:
@ -38,7 +37,6 @@ public:
{
RANDOM_GENIE, RANDOM_AIMED
};
//battle
boost::optional<int> battleIsFinished() const; //return none if battle is ongoing; otherwise the victorious side (0/1) or 2 if it is a draw
@ -47,7 +45,6 @@ public:
void battleGetStackQueue(std::vector<const CStack *> &out, const int howMany, const int turn = 0, int lastMoved = -1) const;
void battleGetStackCountOutsideHexes(bool *ac) const; // returns hexes which when in front of a stack cause us to move the amount box back
std::vector<BattleHex> battleGetAvailableHexes(const CStack * stack, bool addOccupiable, std::vector<BattleHex> * attackable = nullptr) const; //returns hexes reachable by creature with id ID (valid movement destinations), DOES contain stack current position
int battleGetSurrenderCost(PlayerColor Player) const; //returns cost of surrendering battle, -1 if surrendering is not possible
@ -90,7 +87,6 @@ public:
si8 battleHasShootingPenalty(const CStack * stack, BattleHex destHex);
si8 battleCanTeleportTo(const CStack * stack, BattleHex destHex, int telportLevel) const; //checks if teleportation of given stack to given position can take place
//convenience methods using the ones above
bool isInTacticRange(BattleHex dest) const;
si8 battleGetTacticDist() const; //returns tactic distance for calling player or 0 if this player is not in tactic phase (for ALL_KNOWING actual distance for tactic side)

View File

@ -14,8 +14,6 @@
#include "NetPacks.h"
#include "mapObjects/CGTownInstance.h"
#define RETURN_IF_NOT_BATTLE(X) if(!duringBattle()) {logGlobal->errorStream() << __FUNCTION__ << " called when no battle!"; return X; }
ETerrainType CBattleInfoEssentials::battleTerrainType() const
{
RETURN_IF_NOT_BATTLE(ETerrainType::WRONG);
@ -42,7 +40,7 @@ std::vector<std::shared_ptr<const CObstacleInstance> > CBattleInfoEssentials::ba
{
if(!!player && *perspective != battleGetMySide())
{
logGlobal->errorStream() << "Unauthorized access attempt!";
logGlobal->error("Unauthorized access attempt!");
assert(0); //I want to notice if that happens
//perspective = battleGetMySide();
}
@ -111,22 +109,17 @@ TStacks CBattleInfoEssentials::battleAliveStacks(ui8 side) const
int CBattleInfoEssentials::battleGetMoatDmg() const
{
RETURN_IF_NOT_BATTLE(0);
auto town = getBattle()->town;
if(!town)
return 0;
return town->town->moatDamage;
}
const CGTownInstance * CBattleInfoEssentials::battleGetDefendedTown() const
{
RETURN_IF_NOT_BATTLE(nullptr);
if(!getBattle() || getBattle()->town == nullptr)
return nullptr;
return getBattle()->town;
}
@ -210,13 +203,11 @@ const CArmedInstance * CBattleInfoEssentials::battleGetArmyObject(ui8 side) cons
logGlobal->errorStream() << "FIXME: " << __FUNCTION__ << " wrong argument!";
return nullptr;
}
if(!battleDoWeKnowAbout(side))
{
logGlobal->errorStream() << "FIXME: " << __FUNCTION__ << " access check ";
return nullptr;
}
return getBattle()->sides[side].armyObject;
}
@ -228,7 +219,6 @@ InfoAboutHero CBattleInfoEssentials::battleGetHeroInfo( ui8 side ) const
logGlobal->warnStream() << __FUNCTION__ << ": side " << (int)side << " does not have hero!";
return InfoAboutHero();
}
InfoAboutHero::EInfoLevel infoLevel = battleDoWeKnowAbout(side) ? InfoAboutHero::EInfoLevel::DETAILED : InfoAboutHero::EInfoLevel::BASIC;
return InfoAboutHero(hero, infoLevel);
}

View File

@ -10,6 +10,8 @@
#pragma once
#include "GameConstants.h"
#define RETURN_IF_NOT_BATTLE(X) if(!duringBattle()) {logGlobal->errorStream() << __FUNCTION__ << " called when no battle!"; return X; }
class CGameState;
struct BattleInfo;

View File

@ -11,7 +11,6 @@
#include "CPlayerBattleCallback.h"
#include "CStack.h"
#include "CGameState.h"
#define RETURN_IF_NOT_BATTLE(X) if(!duringBattle()) {logGlobal->errorStream() << __FUNCTION__ << " called when no battle!"; return X; }
bool CPlayerBattleCallback::battleCanFlee() const
{