don't use enum class until we remove tolua++

This commit is contained in:
Tim Felgentreff 2022-03-03 22:43:07 +01:00
parent b3b3f87cfb
commit 2b10b273fd
4 changed files with 22 additions and 12 deletions

View file

@ -44,7 +44,7 @@
/*----------------------------------------------------------------------------
-- Declarations
----------------------------------------------------------------------------*/
enum class FogOfWarTypes { cTiled, cEnhanced, cTiledLegacy, cNumOfTypes }; /// Types of the fog of war
ENUM_CLASS FogOfWarTypes { cTiled, cEnhanced, cTiledLegacy, cNumOfTypes }; /// Types of the fog of war
class CFogOfWar
{
public:

View file

@ -68,7 +68,7 @@ public:
char PlyName[NetPlayerNameSize]; /// Name of player
};
enum class SlotOption : uint8_t {
ENUM_CLASS SlotOption : uint8_t {
Available,
Computer,
Closed

View file

@ -43,6 +43,16 @@
#include <functional>
#include <variant>
/*----------------------------------------------------------------------------
-- TODO: Remove this once we move off of tolua++ and can properly support strongly typed enums
----------------------------------------------------------------------------*/
#if 1
// using tolua++
#define ENUM_CLASS enum
#else
#define ENUM_CLASS enum class
#endif
/*----------------------------------------------------------------------------
-- Settings
----------------------------------------------------------------------------*/
@ -87,9 +97,9 @@ constexpr int8_t SettingsPresetMapDefault = -1; /// Special: Use map supplied
** can rescue them. If the city center is rescued, than all units
** of this player are rescued.
*/
enum class PlayerTypes : int8_t {
ENUM_CLASS PlayerTypes : int8_t {
MapDefault = SettingsPresetMapDefault, /// use default
Unset = 0, /// not set
PlayerUnset = 0, /// not set
PlayerNeutral = 2, /// neutral
PlayerNobody = 3, /// unused slot
PlayerComputer = 4, /// computer player
@ -144,7 +154,7 @@ struct SettingsPresets {
}
};
enum class RevealTypes : uint8_t {
ENUM_CLASS RevealTypes : uint8_t {
cNoRevelation,
cAllUnits,
cBuildingsOnly
@ -153,7 +163,7 @@ enum class RevealTypes : uint8_t {
/**
** Single or multiplayer settings
*/
enum class NetGameTypes : uint8_t {
ENUM_CLASS NetGameTypes : uint8_t {
SettingsSinglePlayerGame,
SettingsMultiPlayerGame,
Unset
@ -162,7 +172,7 @@ enum class NetGameTypes : uint8_t {
/**
** GameType settings
*/
enum class GameTypes : int8_t {
ENUM_CLASS GameTypes : int8_t {
SettingsGameTypeMapDefault = SettingsPresetMapDefault,
SettingsGameTypeMelee = 0,
SettingsGameTypeFreeForAll,
@ -187,14 +197,14 @@ enum class GameTypes : int8_t {
/// Map revealing modes: cHidden - unrevealed, cKnown - you can see unexplored tiles, but they are darker than explored
/// cExplored - all tiles became explored, and covered only by the fog of war if it's enabled.
enum class MapRevealModes : uint8_t {
ENUM_CLASS MapRevealModes : uint8_t {
cHidden = 0,
cKnown,
cExplored,
cNumOfModes
};
enum class FieldOfViewTypes : uint8_t {
ENUM_CLASS FieldOfViewTypes : uint8_t {
cShadowCasting,
cSimpleRadial,
NumOfTypes

View file

@ -371,7 +371,7 @@ void InitPlayers()
{
for (int p = 0; p < PlayerMax; ++p) {
Players[p].Index = p;
if (Players[p].Type == PlayerTypes::Unset) {
if (Players[p].Type == PlayerTypes::PlayerUnset) {
Players[p].Type = PlayerTypes::PlayerNobody;
}
}
@ -769,7 +769,7 @@ void CPlayer::Clear()
{
Index = 0;
Name.clear();
Type = PlayerTypes::Unset;
Type = PlayerTypes::PlayerUnset;
Race = 0;
AiName.clear();
Team = 0;
@ -1291,7 +1291,7 @@ void DebugPlayers()
const char *playertype;
switch (Players[i].Type) {
case PlayerTypes::Unset: playertype = "unset "; break;
case PlayerTypes::PlayerUnset: playertype = "unset "; break;
case PlayerTypes::PlayerNeutral: playertype = "neutral "; break;
case PlayerTypes::PlayerNobody: playertype = "nobody "; break;
case PlayerTypes::PlayerComputer: playertype = "computer "; break;