Skip to content

Commit

Permalink
Refine huge enum types (#3576)
Browse files Browse the repository at this point in the history
No functional changes

---------

Co-authored-by: xtremeqg <[email protected]>
  • Loading branch information
Linvail and xtremeqg authored Jan 21, 2025
1 parent 56833fe commit 4faba21
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 111 deletions.
97 changes: 49 additions & 48 deletions src/config_creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,54 +63,55 @@ enum CreatureModelFlags {
CMF_EventfulDeath = 0x080000, // The LAST_DEATH_EVENT[] script location is updated on death.
};

enum CreatureJobFlags {
Job_NULL = 0LL,
Job_TUNNEL = 1LL<<0,
Job_DIG = 1LL<<1,
Job_RESEARCH = 1LL<<2,
Job_TRAIN = 1LL<<3,
Job_MANUFACTURE = 1LL<<4,
Job_SCAVENGE = 1LL<<5,
Job_KINKY_TORTURE = 1LL<<6,
Job_JOIN_FIGHT = 1LL<<7,
Job_SEEK_THE_ENEMY = 1LL<<8,
Job_GUARD = 1LL<<9,
Job_GROUP = 1LL<<10, //This job doesn't do anything, to be implemented.
Job_BARRACK = 1LL<<11,
Job_TEMPLE_PRAY = 1LL<<12,
Job_FREEZE_PRISONERS = 1LL<<13,
Job_EXPLORE = 1LL<<14,
// Jobs which can't be assigned to a creature, are only working one time
Job_EXEMPT = 1LL<<15,
Job_TEMPLE_SACRIFICE = 1LL<<16,
Job_PAINFUL_TORTURE = 1LL<<17,
Job_CAPTIVITY = 1LL<<18,
Job_PLACE_IN_VAULT = 1LL<<19,
Job_TAKE_SALARY = 1LL<<20,
Job_TAKE_FEED = 1LL<<21,
Job_TAKE_SLEEP = 1LL<<22,
//TODO Nonexisting - TO ADD LATER - digger jobs
Job_MINE = 1LL<<23,
Job_CONVERT_GROUND = 1LL<<24,
Job_IMPROVE_GROUND = 1LL<<25,
Job_REINFORCE_WALL = 1LL<<26,
//TODO Nonexisting - TO ADD LATER - anger jobs
Job_KILL_OWN_CREATURE= 1LL<<27,
Job_DESTROY_OWN_ROOM = 1LL<<28,
Job_LEAVE_DUNGEON = 1LL<<29,
Job_STEAL_OWN_GOLD = 1LL<<30,
Job_DAMAGE_OWN_WALLS = 1LL<<31,
Job_MAD_PSYCHO = 1LL<<32,
Job_PERSUADE_LEAVE = 1LL<<33,
Job_JOIN_ENEMY = 1LL<<34,
//TODO Nonexisting - TO ADD LATER - hero objectives
Job_ATTACK_ROOM = 1LL<<35,
Job_ATTACK_CREATURE = 1LL<<36,
Job_ATTACK_DNHEART = 1LL<<37,
Job_STEAL_GOLD = 1LL<<38,
Job_STEAL_SPELLS = 1LL<<39,
Job_DEFEND_PARTY = 1LL<<40,
};
// Before C23 standard, we cannot specify the underlaying type (in this case we want 64bit int) of enum.
// Some compilers may handle it well but some may not. We use #define to avoid the portability issue.
// Refer https://open-std.org/JTC1/SC22/WG14/www/docs/n3030.htm
#define Job_NULL (0LL)
#define Job_TUNNEL (1LL << 0)
#define Job_DIG (1LL << 1)
#define Job_RESEARCH (1LL << 2)
#define Job_TRAIN (1LL << 3)
#define Job_MANUFACTURE (1LL << 4)
#define Job_SCAVENGE (1LL << 5)
#define Job_KINKY_TORTURE (1LL << 6)
#define Job_JOIN_FIGHT (1LL << 7)
#define Job_SEEK_THE_ENEMY (1LL << 8)
#define Job_GUARD (1LL << 9)
#define Job_GROUP (1LL << 10) //This job doesn't do anything, to be implemented.
#define Job_BARRACK (1LL << 11)
#define Job_TEMPLE_PRAY (1LL << 12)
#define Job_FREEZE_PRISONERS (1LL << 13)
#define Job_EXPLORE (1LL << 14)
// Jobs which can't be assigned to a creature, are only working one time
#define Job_EXEMPT (1LL << 15)
#define Job_TEMPLE_SACRIFICE (1LL << 16)
#define Job_PAINFUL_TORTURE (1LL << 17)
#define Job_CAPTIVITY (1LL << 18)
#define Job_PLACE_IN_VAULT (1LL << 19)
#define Job_TAKE_SALARY (1LL << 20)
#define Job_TAKE_FEED (1LL << 21)
#define Job_TAKE_SLEEP (1LL << 22)
//TODO Nonexisting - TO ADD LATER - digger jobs
#define Job_MINE (1LL << 23)
#define Job_CONVERT_GROUND (1LL << 24)
#define Job_IMPROVE_GROUND (1LL << 25)
#define Job_REINFORCE_WALL (1LL << 26)
//TODO Nonexisting - TO ADD LATER - anger jobs
#define Job_KILL_OWN_CREATURE (1LL << 27)
#define Job_DESTROY_OWN_ROOM (1LL << 28)
#define Job_LEAVE_DUNGEON (1LL << 29)
#define Job_STEAL_OWN_GOLD (1LL << 30)
#define Job_DAMAGE_OWN_WALLS (1LL << 31)
#define Job_MAD_PSYCHO (1LL << 32)
#define Job_PERSUADE_LEAVE (1LL << 33)
#define Job_JOIN_ENEMY (1LL << 34)
//TODO Nonexisting - TO ADD LATER - hero objectives
#define Job_ATTACK_ROOM (1LL << 35)
#define Job_ATTACK_CREATURE (1LL << 36)
#define Job_ATTACK_DNHEART (1LL << 37)
#define Job_STEAL_GOLD (1LL << 38)
#define Job_STEAL_SPELLS (1LL << 39)
#define Job_DEFEND_PARTY (1LL << 40)

enum JobKindFlags {
JoKF_None = 0x00000000,
Expand Down
67 changes: 33 additions & 34 deletions src/config_magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,72 +124,71 @@ enum ShotModelFlags {
ShMF_NeverBlock = 0x10000,
};

enum PowerCanCastFlags {
PwCast_None = 0x0000000000,
#define PwCast_None (0LL)
/** Allow casting the spell on enemy creatures kept in custody. */
PwCast_CustodyCrtrs = 0x0000000001,
#define PwCast_CustodyCrtrs (1LL << 1)
/** Allow casting the spell on owned creatures not captured by enemy. */
PwCast_OwnedCrtrs = 0x0000000002,
#define PwCast_OwnedCrtrs (1LL << 2)
/** Allow casting the spell on creatures of allied players. */
PwCast_AlliedCrtrs = 0x0000000004,
#define PwCast_AlliedCrtrs (1LL << 3)
/** Allow casting the spell on creatures of enemy players. */
PwCast_EnemyCrtrs = 0x0000000008,
#define PwCast_EnemyCrtrs (1LL << 4)
/** Allow casting the spell on creatures which are unconscious or dying. */
PwCast_NConscCrtrs = 0x0000000010,
#define PwCast_NConscCrtrs (1LL << 5)
/** Allow casting the spell on creatures which are bound by state (dragged, being sacrificed, teleported etc.). */
PwCast_BoundCrtrs = 0x0000000020,
#define PwCast_BoundCrtrs (1LL << 6)

/** Allow casting the spell on neutral walkable tiles - path, water, lava. */
PwCast_UnclmdGround = 0x0000000080,
#define PwCast_UnclmdGround (1LL << 7)
/** Allow casting the spell on neutral ground - rooms floor and neutral claimed ground. */
PwCast_NeutrlGround = 0x0000000100,
#define PwCast_NeutrlGround (1LL << 8)
/** Allow casting the spell on owned ground - rooms floor and claimed ground. */
PwCast_OwnedGround = 0x0000000200,
#define PwCast_OwnedGround (1LL << 9)
/** Allow casting the spell on allied players ground - rooms floor and claimed ground. */
PwCast_AlliedGround = 0x0000000400,
#define PwCast_AlliedGround (1LL << 10)
/** Allow casting the spell on enemy players ground - rooms floor and claimed ground. */
PwCast_EnemyGround = 0x0000000800,
#define PwCast_EnemyGround (1LL << 11)

/** Allow casting the spell on neutral tall slabs - earth, wall, gold. */
PwCast_NeutrlTall = 0x0000001000,
#define PwCast_NeutrlTall (1LL << 12)
/** Allow casting the spell on owned tall slabs - own fortified wall. */
PwCast_OwnedTall = 0x0000002000,
#define PwCast_OwnedTall (1LL << 13)
/** Allow casting the spell on tall slabs owned by allies - their fortified walls. */
PwCast_AlliedTall = 0x0000004000,
#define PwCast_AlliedTall (1LL << 14)
/** Allow casting the spell on tall slabs owned by enemies - their fortified walls. */
PwCast_EnemyTall = 0x0000008000,
#define PwCast_EnemyTall (1LL << 15)

/** Allow casting the spell on owned food things (chickens). */
PwCast_OwnedFood = 0x0000020000,
#define PwCast_OwnedFood (1LL << 16)
/** Allow casting the spell on neutral food things. */
PwCast_NeutrlFood = 0x0000040000,
#define PwCast_NeutrlFood (1LL << 17)
/** Allow casting the spell on enemy food things. */
PwCast_EnemyFood = 0x0000080000,
#define PwCast_EnemyFood (1LL << 18)
/** Allow casting the spell on owned gold things (piles,pots etc.). */
PwCast_OwnedGold = 0x0000100000,
#define PwCast_OwnedGold (1LL << 19)
/** Allow casting the spell on neutral gold things. */
PwCast_NeutrlGold = 0x0000200000,
#define PwCast_NeutrlGold (1LL << 20)
/** Allow casting the spell on enemy gold things. */
PwCast_EnemyGold = 0x0000400000,
#define PwCast_EnemyGold (1LL << 21)
/** Allow casting the spell on owned spell books. */
PwCast_OwnedSpell = 0x0000800000,
#define PwCast_OwnedSpell (1LL << 22)
/** Allow casting the spell on owned deployed trap things. */
PwCast_OwnedBoulders = 0x0001000000,
#define PwCast_OwnedBoulders (1LL << 23)
/** Allow casting the spell only after a small delay from previous cast. */
PwCast_NeedsDelay = 0x0004000000,
#define PwCast_NeedsDelay (1LL << 24)
/** Allow casting the spell only on claimable/fortificable slabs (for ground - path or claimed, for tall - earth or fortified). */
PwCast_Claimable = 0x0008000000,
#define PwCast_Claimable (1LL << 25)
/** Allow casting the spell on un-revealed tiles. */
PwCast_Unrevealed = 0x0010000000,
#define PwCast_Unrevealed (1LL << 26)
/** Allow casting the spell on temporarily revealed tiles (with SOE spell). */
PwCast_RevealedTemp = 0x0020000000,
#define PwCast_RevealedTemp (1LL << 27)
/** Allow casting if only one of map-related and thing-related conditions is met. */
PwCast_ThingOrMap = 0x0040000000,
#define PwCast_ThingOrMap (1LL << 28)
/** There are no map-related conditions - allow casting the spell anywhere on revealed map. */
PwCast_Anywhere = 0x0080000000,
PwCast_DiggersOnly = 0x0100000000,
PwCast_DiggersNot = 0x0200000000,
};
#define PwCast_Anywhere (1LL << 29)
#define PwCast_DiggersOnly (1LL << 30)
#define PwCast_DiggersNot (1LL << 31)

#define PwCast_AllCrtrs (PwCast_CustodyCrtrs|PwCast_OwnedCrtrs|PwCast_AlliedCrtrs|PwCast_EnemyCrtrs|PwCast_NConscCrtrs|PwCast_BoundCrtrs)
#define PwCast_AllFood (PwCast_OwnedFood|PwCast_NeutrlFood|PwCast_EnemyFood)
#define PwCast_AllGold (PwCast_OwnedGold|PwCast_NeutrlGold|PwCast_EnemyGold)
Expand Down
58 changes: 29 additions & 29 deletions src/thing_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,35 +94,35 @@ enum CreatureSelectCriteria {
* Flags which determine which target things can be hit by something.
*/
enum HitTargetFlagsList {
HitTF_None = 0x0000000000000000,//!< Zero flag
HitTF_EnemyCreatures = 0x0000000000000001,//!< Allow targeting enemy creatures.
HitTF_AlliedCreatures = 0x0000000000000002,//!< Allow targeting allied and neutral creatures.
HitTF_OwnedCreatures = 0x0000000000000004,//!< Allow targeting owned creatures.
HitTF_ArmourAffctdCreatrs = 0x0000000000000008,//!< Allow targeting creatures affected by Armour spell.
HitTF_PreventDmgCreatrs = 0x0000000000000010,//!< Allow targeting creatures with damage prevention flag, ie unconscious.
HitTF_EnemyShotsCollide = 0x0000000000000400,//!< Allow colliding with enemy shots which can be collided with.
HitTF_AlliedShotsCollide = 0x0000000000000800,//!< Allow colliding with allied and neutral shots which can be collided with.
HitTF_OwnedShotsCollide = 0x0000000000001000,//!< Allow colliding with own shots which can be collided with.
HitTF_EnemySoulContainer = 0x0000000000002000,//!< Allow targeting enemy soul containers.
HitTF_AlliedSoulContainer = 0x0000000000004000,//!< Allow targeting allied and neutral containers.
HitTF_OwnedSoulContainer = 0x0000000000008000,//!< Allow targeting own soul container.
HitTF_AnyWorkshopBoxes = 0x0000000000040000,//!< Allow targeting Workshop boxes owned by anyone.
HitTF_AnySpellbooks = 0x0000000000080000,//!< Allow targeting spellbook objects owned by anyone.
HitTF_AnyDnSpecialBoxes = 0x0000000000100000,//!< Allow targeting Dnungeon Special boxes owned by anyone.
HitTF_AnyGoldHoards = 0x0000000000200000,//!< Allow targeting Gold Hoards owned by anyone.
HitTF_AnyFoodObjects = 0x0000000000400000,//!< Allow targeting Food Objects owned by anyone.
HitTF_AnyGoldPiles = 0x0000000000800000,//!< Allow targeting gold laying on ground before storing in treasury, pots and piles.
HitTF_AnyDecorations = 0x0000000001000000,//!< Allow targeting things which are not used for anything, ie potions and barrels.
HitTF_EnemyDeployedDoors = 0x0000000002000000,//!< Allow targeting Enemy Deployed Doors.
HitTF_AlliedDeployedDoors = 0x0000000004000000,//!< Allow targeting Allied and neutral Deployed Doors.
HitTF_OwnedDeployedDoors = 0x0000000008000000,//!< Allow targeting Owned Deployed Doors.
HitTF_EnemyDeployedTraps = 0x0000000010000000,//!< Allow targeting enemy Deployed Traps.
HitTF_AlliedDeployedTraps = 0x0000000020000000,//!< Allow targeting allied and neutral deployed Traps.
HitTF_OwnedDeployedTraps = 0x0000000040000000,//!< Allow targeting Owned Deployed Traps.
HitTF_CreatureDeadBodies = 0x0000000080000000,//!< Allow targeting Creature Dead Bodies.
HitTF_EnemyDestructibleTraps = 0x0000000100000000,//!< Allow targeting enemy Deployed Traps.
HitTF_AlliedDestructibleTraps = 0x0000000200000000,//!< Allow targeting allied and neutral deployed Traps.
HitTF_OwnedDestructibleTraps = 0x0000000400000000,//!< Allow targeting Owned Deployed Traps.
HitTF_None = (0LL),//!< Zero flag
HitTF_EnemyCreatures = (1LL << 1),//!< Allow targeting enemy creatures.
HitTF_AlliedCreatures = (1LL << 2),//!< Allow targeting allied and neutral creatures.
HitTF_OwnedCreatures = (1LL << 3),//!< Allow targeting owned creatures.
HitTF_ArmourAffctdCreatrs = (1LL << 4),//!< Allow targeting creatures affected by Armour spell.
HitTF_PreventDmgCreatrs = (1LL << 5),//!< Allow targeting creatures with damage prevention flag, ie unconscious.
HitTF_EnemyShotsCollide = (1LL << 6),//!< Allow colliding with enemy shots which can be collided with.
HitTF_AlliedShotsCollide = (1LL << 7),//!< Allow colliding with allied and neutral shots which can be collided with.
HitTF_OwnedShotsCollide = (1LL << 8),//!< Allow colliding with own shots which can be collided with.
HitTF_EnemySoulContainer = (1LL << 9),//!< Allow targeting enemy soul containers.
HitTF_AlliedSoulContainer = (1LL << 10),//!< Allow targeting allied and neutral containers.
HitTF_OwnedSoulContainer = (1LL << 11),//!< Allow targeting own soul container.
HitTF_AnyWorkshopBoxes = (1LL << 12),//!< Allow targeting Workshop boxes owned by anyone.
HitTF_AnySpellbooks = (1LL << 13),//!< Allow targeting spellbook objects owned by anyone.
HitTF_AnyDnSpecialBoxes = (1LL << 14),//!< Allow targeting Dnungeon Special boxes owned by anyone.
HitTF_AnyGoldHoards = (1LL << 15),//!< Allow targeting Gold Hoards owned by anyone.
HitTF_AnyFoodObjects = (1LL << 16),//!< Allow targeting Food Objects owned by anyone.
HitTF_AnyGoldPiles = (1LL << 17),//!< Allow targeting gold laying on ground before storing in treasury, pots and piles.
HitTF_AnyDecorations = (1LL << 18),//!< Allow targeting things which are not used for anything, ie potions and barrels.
HitTF_EnemyDeployedDoors = (1LL << 19),//!< Allow targeting Enemy Deployed Doors.
HitTF_AlliedDeployedDoors = (1LL << 20),//!< Allow targeting Allied and neutral Deployed Doors.
HitTF_OwnedDeployedDoors = (1LL << 21),//!< Allow targeting Owned Deployed Doors.
HitTF_EnemyDeployedTraps = (1LL << 22),//!< Allow targeting enemy Deployed Traps.
HitTF_AlliedDeployedTraps = (1LL << 23),//!< Allow targeting allied and neutral deployed Traps.
HitTF_OwnedDeployedTraps = (1LL << 24),//!< Allow targeting Owned Deployed Traps.
HitTF_CreatureDeadBodies = (1LL << 25),//!< Allow targeting Creature Dead Bodies.
HitTF_EnemyDestructibleTraps = (1LL << 26),//!< Allow targeting enemy Deployed Traps.
HitTF_AlliedDestructibleTraps = (1LL << 27),//!< Allow targeting allied and neutral deployed Traps.
HitTF_OwnedDestructibleTraps = (1LL << 28),//!< Allow targeting Owned Deployed Traps.
};

/******************************************************************************/
Expand Down

0 comments on commit 4faba21

Please sign in to comment.