1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

CPathfinder: use struct instead of enum for options

Suggested by @DjWarmonger as better alternative from performance standpoint while struct still more organized than bunch of variables.
Other reason of change it's that in future we may need non-boolean options, e.g for patrol movement and some new pathfinder usages.
This commit is contained in:
ArseniyShestakov
2015-10-24 15:34:27 +03:00
parent 6934c6bc95
commit 939b3c05a1
2 changed files with 31 additions and 21 deletions

View File

@@ -279,17 +279,19 @@ struct DLL_EXPORT DuelParameters
class CPathfinder : private CGameInfoCallback
{
private:
enum class EOptions
struct PathfinderOptions
{
FLYING,
WALKING_ON_SEA,
EMBARK_AND_DISEMBARK,
TELEPORT_TWO_WAY, // Two-way monoliths and Subterranean Gate
TELEPORT_ONE_WAY, // One-way monoliths with one known exit only
TELEPORT_ONE_WAY_RANDOM, // One-way monoliths with more than one known exit
TELEPORT_WHIRLPOOL // Force enabled if hero protected or unaffected (have one stack of one creature)
bool useFlying;
bool useWaterWalking;
bool useEmbarkAndDisembark;
bool useTeleportTWoWay; // Two-way monoliths and Subterranean Gate
bool useTeleportOneWay; // One-way monoliths with one known exit only
bool useTeleportOneWayRandom; // One-way monoliths with more than one known exit
bool useTeleportWhirlpool; // Force enabled if hero protected or unaffected (have one stack of one creature)
PathfinderOptions();
};
std::set<EOptions> options;
PathfinderOptions options;
CPathsInfo &out;
const CGHeroInstance *hero;