mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
a1a5bc28c2
Mixed line endings cause problems when exporting patches with git-format-patch and then trying to "git am" a patch with mixed and non-matching line endings. In such a situation git will fail to apply the patch. This commit runs the dos2unix tools on the remaining files with CRLF (\r\n) line endings to convert them to line-feeds (\n) only. Files that are Windows specific like *.vcxproj and *.props files were not converted. Closes: #3073
61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
/*
|
|
* ReachabilityInfo.h, part of VCMI engine
|
|
*
|
|
* Authors: listed in file AUTHORS in main folder
|
|
*
|
|
* License: GNU General Public License v2.0 or later
|
|
* Full text of license available in license.txt file, in main folder
|
|
*
|
|
*/
|
|
#pragma once
|
|
#include "BattleHex.h"
|
|
#include "CBattleInfoEssentials.h"
|
|
#include "AccessibilityInfo.h"
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
// Reachability info is result of BFS calculation. It's dependent on stack (it's owner, whether it's flying),
|
|
// startPosition and perpective.
|
|
struct DLL_LINKAGE ReachabilityInfo
|
|
{
|
|
using TDistances = std::array<uint32_t, GameConstants::BFIELD_SIZE>;
|
|
using TPredecessors = std::array<BattleHex, GameConstants::BFIELD_SIZE>;
|
|
|
|
enum { INFINITE_DIST = 1000000 };
|
|
|
|
struct DLL_LINKAGE Parameters
|
|
{
|
|
ui8 side = 0;
|
|
bool doubleWide = false;
|
|
bool flying = false;
|
|
bool ignoreKnownAccessible = false; //Ignore obstacles if it is in accessible hexes
|
|
std::vector<BattleHex> knownAccessible; //hexes that will be treated as accessible, even if they're occupied by stack (by default - tiles occupied by stack we do reachability for, so it doesn't block itself)
|
|
|
|
BattleHex startPosition; //assumed position of stack
|
|
BattlePerspective::BattlePerspective perspective = BattlePerspective::ALL_KNOWING; //some obstacles (eg. quicksands) may be invisible for some side
|
|
|
|
Parameters() = default;
|
|
Parameters(const battle::Unit * Stack, BattleHex StartPosition);
|
|
};
|
|
|
|
Parameters params;
|
|
AccessibilityInfo accessibility;
|
|
TDistances distances;
|
|
TPredecessors predecessors;
|
|
|
|
ReachabilityInfo();
|
|
|
|
bool isReachable(BattleHex hex) const;
|
|
|
|
uint32_t distToNearestNeighbour(
|
|
const std::vector<BattleHex> & targetHexes,
|
|
BattleHex * chosenHex = nullptr) const;
|
|
|
|
uint32_t distToNearestNeighbour(
|
|
const battle::Unit * attacker,
|
|
const battle::Unit * defender,
|
|
BattleHex * chosenHex = nullptr) const;
|
|
};
|
|
|
|
VCMI_LIB_NAMESPACE_END
|