1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-11 11:31:52 +02:00

Expanded cursors enum to include all possible values

This commit is contained in:
Ivan Savenko 2022-12-16 11:22:58 +02:00
parent 864990db13
commit 291bb9b204
3 changed files with 46 additions and 6 deletions

View File

@ -15,13 +15,35 @@ struct SDL_Texture;
namespace ECursor
{
enum ECursorTypes { ADVENTURE, COMBAT, DEFAULT, SPELLBOOK };
enum ECursorTypes {
ADVENTURE, // set of various cursors for adventure map
COMBAT, // set of various cursors for combat
DEFAULT, // default arror and hourglass cursors
SPELLBOOK // animated cursor for spellcasting
};
enum EBattleCursors { COMBAT_BLOCKED, COMBAT_MOVE, COMBAT_FLY, COMBAT_SHOOT,
COMBAT_HERO, COMBAT_QUERY, COMBAT_POINTER,
//various attack frames
COMBAT_SHOOT_PENALTY = 15, COMBAT_SHOOT_CATAPULT, COMBAT_HEAL,
COMBAT_SACRIFICE, COMBAT_TELEPORT};
enum EBattleCursors {
COMBAT_BLOCKED = 0,
COMBAT_MOVE = 1,
COMBAT_FLY = 2,
COMBAT_SHOOT = 3,
COMBAT_HERO = 4,
COMBAT_QUERY = 5,
COMBAT_POINTER = 6,
COMBAT_HIT_NORTHEAST = 7,
COMBAT_HIT_EAST = 8,
COMBAT_HIT_SOUTHEAST = 9,
COMBAT_HIT_SOUTHWEST = 10,
COMBAT_HIT_WEST = 11,
COMBAT_HIT_NORTHWEST = 12,
COMBAT_HIT_NORTH = 13,
COMBAT_HIT_SOUTH = 14,
COMBAT_SHOOT_PENALTY = 15,
COMBAT_SHOOT_CATAPULT = 16,
COMBAT_HEAL = 17,
COMBAT_SACRIFICE = 18,
COMBAT_TELEPORT = 19
};
}
/// handles mouse cursor

View File

@ -140,6 +140,17 @@ std::vector<BattleHex> BattleHex::neighbouringTiles() const
return ret;
}
std::vector<BattleHex> BattleHex::allNeighbouringTiles() const
{
std::vector<BattleHex> ret;
ret.resize(6);
for(EDir dir = EDir(0); dir <= EDir(5); dir = EDir(dir+1))
ret[dir] = cloneInDirection(dir, false);
return ret;
}
signed char BattleHex::mutualPosition(BattleHex hex1, BattleHex hex2)
{
for(EDir dir = EDir(0); dir <= EDir(5); dir = EDir(dir+1))

View File

@ -74,7 +74,14 @@ struct DLL_LINKAGE BattleHex //TODO: decide if this should be changed to class f
BattleHex& operator+=(EDir dir);
BattleHex cloneInDirection(EDir dir, bool hasToBeValid = true) const;
BattleHex operator+(EDir dir) const;
/// returns all valid neighbouring tiles
std::vector<BattleHex> neighbouringTiles() const;
/// returns all tiles, unavailable tiles will be set as invalid
/// order of returned tiles matches EDir enim
std::vector<BattleHex> allNeighbouringTiles() const;
static signed char mutualPosition(BattleHex hex1, BattleHex hex2);
static char getDistance(BattleHex hex1, BattleHex hex2);
static void checkAndPush(BattleHex tile, std::vector<BattleHex> & ret);