Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Core/GameEngine/Include/Common/AudioEventInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ enum AudioType CPP_11(: Int)
AT_SoundEffect
};

extern const char *theAudioPriorityNames[];
extern const char* const theAudioPriorityNames[];
enum AudioPriority CPP_11(: Int)
{
AP_LOWEST,
AP_LOW,
AP_NORMAL,
AP_HIGH,
AP_CRITICAL
AP_CRITICAL,

AP_COUNT
};

extern const char *theSoundTypeNames[];
extern const char *const theSoundTypeNames[];
enum SoundType CPP_11(: Int)
{
ST_UI = 0x0001,
Expand All @@ -72,7 +74,7 @@ enum SoundType CPP_11(: Int)
ST_EVERYONE = 0x0100,
};

extern const char *theAudioControlNames[];
extern const char *const theAudioControlNames[];
enum AudioControl CPP_11(: Int)
{
AC_LOOP = 0x0001,
Expand Down
5 changes: 3 additions & 2 deletions Core/GameEngine/Include/GameClient/ClientRandomValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ class GameClientRandomVariable
*/
enum DistributionType
{
CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS
CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS,
DISTRIBUTION_COUNT
};

static const char *DistributionTypeNames[];
static const char *const DistributionTypeNames[];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the GameClientRandomVariable and GameLogicRandomVariable classes should be abstracted and combined into a single class in common.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, seems unnecessary to have duplicate implementations. Is beyond the scope of this change however.


/// define the range of random values, and the distribution of values
void setRange( Real low, Real high, DistributionType type = UNIFORM );
Expand Down
5 changes: 3 additions & 2 deletions Core/GameEngine/Include/GameLogic/LogicRandomValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ class GameLogicRandomVariable
*/
enum DistributionType
{
CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS
CONSTANT, UNIFORM, GAUSSIAN, TRIANGULAR, LOW_BIAS, HIGH_BIAS,
DISTRIBUTION_COUNT
};

static const char *DistributionTypeNames[];
static const char *const DistributionTypeNames[];

/// define the range of random values, and the distribution of values
void setRange( Real low, Real high, DistributionType type = UNIFORM );
Expand Down
7 changes: 4 additions & 3 deletions Core/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static void parsePitchShift( INI* ini, void *instance, void *store, const void*

// STATIC DEFINIITIONS ////////////////////////////////////////////////////////////////////////////

const char *theAudioPriorityNames[] =
const char *const theAudioPriorityNames[] =
{
"LOWEST",
"LOW",
Expand All @@ -188,8 +188,9 @@ const char *theAudioPriorityNames[] =
"CRITICAL",
NULL
};
static_assert(ARRAY_SIZE(theAudioPriorityNames) == AP_COUNT + 1, "Incorrect array size");

const char *theSoundTypeNames[] =
const char *const theSoundTypeNames[] =
{
"UI",
"WORLD",
Expand All @@ -203,7 +204,7 @@ const char *theSoundTypeNames[] =
NULL
};

const char *theAudioControlNames[] =
const char *const theAudioControlNames[] =
{
"LOOP",
"RANDOM",
Expand Down
6 changes: 4 additions & 2 deletions Core/GameEngine/Source/Common/RandomValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,11 @@ DEBUG_LOG(( "%d: GetGameAudioRandomValueReal = %f, %s line %d",
// GameClientRandomVariable
//

/*static*/ const char *GameClientRandomVariable::DistributionTypeNames[] =
const char *const GameClientRandomVariable::DistributionTypeNames[] =
{
"CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL
};
static_assert(ARRAY_SIZE(GameClientRandomVariable::DistributionTypeNames) == GameClientRandomVariable::DISTRIBUTION_COUNT + 1, "Incorrect array size");

/**
define the range of random values, and the distribution of values
Expand Down Expand Up @@ -395,10 +396,11 @@ Real GameClientRandomVariable::getValue( void ) const
// GameLogicRandomVariable
//

/*static*/ const char *GameLogicRandomVariable::DistributionTypeNames[] =
const char *const GameLogicRandomVariable::DistributionTypeNames[] =
{
"CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS", NULL
};
static_assert(ARRAY_SIZE(GameLogicRandomVariable::DistributionTypeNames) == GameLogicRandomVariable::DISTRIBUTION_COUNT + 1, "Incorrect array size");

/**
define the range of random values, and the distribution of values
Expand Down
29 changes: 15 additions & 14 deletions Core/Libraries/Source/WWVegas/WW3D2/rendobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,6 @@ template<class T> class DynamicVectorClass;
// "unreferenced formal parameter"
#pragma warning(disable : 4100)

#ifdef DEFINE_W3DANIMMODE_NAMES
static const char* TheAnimModeNames[] =
{
"MANUAL",
"LOOP",
"ONCE",
"LOOP_PINGPONG",
"LOOP_BACKWARDS",
"ONCE_BACKWARDS",
NULL
};
#endif


//////////////////////////////////////////////////////////////////////////////////
// RenderObjClass
// This is the interface for all objects that get rendered by WW3D.
Expand Down Expand Up @@ -336,6 +322,8 @@ class RenderObjClass : public RefCountClass , public PersistClass, public MultiL
ANIM_MODE_LOOP_PINGPONG,
ANIM_MODE_LOOP_BACKWARDS, //make sure only backwards playing animations after this one
ANIM_MODE_ONCE_BACKWARDS,

ANIM_MODE_COUNT
};

virtual void Set_Animation( void ) { }
Expand Down Expand Up @@ -653,6 +641,19 @@ WWINLINE bool RenderObjClass::Is_Transform_Identity_No_Validity_Check() const
}


#ifdef DEFINE_W3DANIMMODE_NAMES
static const char* const TheAnimModeNames[] =
{
"MANUAL",
"LOOP",
"ONCE",
"LOOP_PINGPONG",
"LOOP_BACKWARDS",
"ONCE_BACKWARDS",
NULL
};
static_assert(ARRAY_SIZE(TheAnimModeNames) == RenderObjClass::ANIM_MODE_COUNT + 1, "Incorrect array size");
#endif


#endif
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static unsigned FreeCount;
** Name for each memory category. I'm padding the array with some "undefined" strings in case
** someone forgets to set the name when adding a new category.
*/
static const char * _MemoryCategoryNames[] =
static const char *const _MemoryCategoryNames[] =
{
"UNKNOWN",
"Geometry",
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWLib/Except.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static StackWalkType _StackWalk = NULL;
static SymFunctionTableAccessType _SymFunctionTableAccess = NULL;
static SymGetModuleBaseType _SymGetModuleBase = NULL;

static char const *ImagehelpFunctionNames[] =
static char const *const ImagehelpFunctionNames[] =
{
"SymCleanup",
"SymGetSymFromAddr",
Expand Down
7 changes: 7 additions & 0 deletions Core/Libraries/Source/WWVegas/WWLib/WWCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

#include "stringex.h"


// This macro serves as a general way to determine the number of elements within an array.
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0]))
#endif


#if defined(_MSC_VER) && _MSC_VER < 1300
typedef unsigned MemValueType;
#else
Expand Down
7 changes: 0 additions & 7 deletions Core/Libraries/Source/WWVegas/WWLib/always.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,6 @@ template <class T> T max(T a,T b)
#define NULL 0
#endif

/**********************************************************************
** This macro serves as a general way to determine the number of elements
** within an array.
*/
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) int(sizeof(x)/sizeof(x[0]))
#endif

#ifndef size_of
#define size_of(typ,id) sizeof(((typ*)0)->id)
Expand Down
3 changes: 2 additions & 1 deletion Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ char CPUDetectClass::ProcessorString[48];

const char* CPUDetectClass::Get_Processor_Manufacturer_Name()
{
static const char* ManufacturerNames[] = {
static const char* const ManufacturerNames[] = {
"<Unknown>",
"Intel",
"UMC",
Expand All @@ -131,6 +131,7 @@ const char* CPUDetectClass::Get_Processor_Manufacturer_Name()
"Rise",
"Transmeta"
};
static_assert(ARRAY_SIZE(ManufacturerNames) == MANUFACTURER_COUNT, "Incorrect array size");

return ManufacturerNames[ProcessorManufacturer];
}
Expand Down
4 changes: 3 additions & 1 deletion Core/Libraries/Source/WWVegas/WWLib/cpudetect.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class CPUDetectClass
MANUFACTURER_NEXTGEN,
MANUFACTURER_VIA,
MANUFACTURER_RISE,
MANUFACTURER_TRANSMETA
MANUFACTURER_TRANSMETA,

MANUFACTURER_COUNT
} ProcessorManufacturerType;

typedef enum
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/debug/debug_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static union
#undef DBGHELP

#define DBGHELP(name,ret,par) #name,
static char const *DebughelpFunctionNames[] =
static char const *const DebughelpFunctionNames[] =
{
#include "debug_stack.inl"
NULL
Expand Down
7 changes: 4 additions & 3 deletions Generals/Code/GameEngine/Include/Common/BitFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class BitFlags
{
private:
std::bitset<NUMBITS> m_bits;
static const char* s_bitNameList[];

public:
CPP_11(static constexpr size_t NumBits = NUMBITS);
static const char* const s_bitNameList[];

/*
just a little syntactic sugar so that there is no "foo = 0" compatible constructor
Expand Down Expand Up @@ -261,7 +262,7 @@ class BitFlags
return true;
}

static const char** getBitNames()
static const char* const* getBitNames()
{
return s_bitNameList;
}
Expand All @@ -274,7 +275,7 @@ class BitFlags
static Int getSingleBitFromName(const char* token)
{
Int i = 0;
for(const char** name = s_bitNameList; *name; ++name, ++i )
for(const char* const* name = s_bitNameList; *name; ++name, ++i )
{
if( stricmp( *name, token ) == 0 )
{
Expand Down
15 changes: 9 additions & 6 deletions Generals/Code/GameEngine/Include/Common/GameCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,20 @@ enum
// NOTE NOTE NOTE: Keep TheVeterencyNames in sync with these.
enum VeterancyLevel CPP_11(: Int)
{
LEVEL_REGULAR = 0,
LEVEL_REGULAR,
LEVEL_VETERAN,
LEVEL_ELITE,
LEVEL_HEROIC,

LEVEL_COUNT,
LEVEL_INVALID,

LEVEL_FIRST = LEVEL_REGULAR,
LEVEL_FIRST = 0,
LEVEL_LAST = LEVEL_HEROIC
};

// TheVeterancyNames is defined in GameCommon.cpp
extern const char *TheVeterancyNames[];
extern const char *const TheVeterancyNames[];

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
Expand All @@ -211,6 +211,7 @@ enum CommandSourceType CPP_11(: Int)
CMD_FROM_AI,
CMD_FROM_DOZER, // Special rare command when the dozer originates a command to attack a mine. Mines are not ai-attackable, and it seems deceitful for the dozer to generate a player or script command. jba.

COMMAND_SOURCE_TYPE_COUNT
};

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -478,14 +479,16 @@ inline Real stdAngleDiff(Real a1, Real a2)
// NOTE NOTE NOTE: Keep TheRelationShipNames in sync with this enum
enum Relationship CPP_11(: Int)
{
ENEMIES = 0,
ENEMIES,
NEUTRAL,
ALLIES
ALLIES,

RELATIONSHIP_COUNT
};


// TheRelationShipNames is defined in Common/GameCommon.cpp
extern const char *TheRelationshipNames[];
extern const char *const TheRelationshipNames[];

#endif // _GAMECOMMON_H_

2 changes: 2 additions & 0 deletions Generals/Code/GameEngine/Include/Common/GameLOD.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ enum CpuType CPP_11(: Int)
P3,
P4,
K7,

CPU_MAX
};

//Keep this in sync with VideoNames in Gamelod.cpp
Expand Down
13 changes: 7 additions & 6 deletions Generals/Code/GameEngine/Include/Common/GameType.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,18 @@ class INI;
//-------------------------------------------------------------------------------------------------
enum TimeOfDay CPP_11(: Int)
{
TIME_OF_DAY_INVALID = 0,
TIME_OF_DAY_FIRST = 1,
TIME_OF_DAY_MORNING = TIME_OF_DAY_FIRST,
TIME_OF_DAY_INVALID,

TIME_OF_DAY_MORNING,
TIME_OF_DAY_AFTERNOON,
TIME_OF_DAY_EVENING,
TIME_OF_DAY_NIGHT,

TIME_OF_DAY_COUNT
TIME_OF_DAY_COUNT,
TIME_OF_DAY_FIRST = TIME_OF_DAY_MORNING,
};

extern const char *TimeOfDayNames[];
extern const char *const TimeOfDayNames[];
// defined in Common/GameType.cpp

//-------------------------------------------------------------------------------------------------
Expand All @@ -89,7 +90,7 @@ enum Weather CPP_11(: Int)
WEATHER_COUNT
};

extern const char *WeatherNames[];
extern const char *const WeatherNames[];

enum Scorches CPP_11(: Int)
{
Expand Down
7 changes: 4 additions & 3 deletions Generals/Code/GameEngine/Include/Common/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,23 @@ class INI;
//-------------------------------------------------------------------------------------------------
enum GeometryType CPP_11(: Int)
{
GEOMETRY_SPHERE = 0, ///< partition/collision testing as sphere. (majorRadius = radius)
GEOMETRY_SPHERE, ///< partition/collision testing as sphere. (majorRadius = radius)
GEOMETRY_CYLINDER, ///< partition/collision testing as cylinder. (majorRadius = radius, height = height)
GEOMETRY_BOX, ///< partition/collision testing as rectangular box (majorRadius = half len in forward dir; minorRadius = half len in side dir; height = height)

GEOMETRY_NUM_TYPES,
GEOMETRY_FIRST = GEOMETRY_SPHERE
GEOMETRY_FIRST = 0
};

#ifdef DEFINE_GEOMETRY_NAMES
static const char *GeometryNames[] =
static const char *const GeometryNames[] =
{
"SPHERE",
"CYLINDER",
"BOX",
NULL
};
static_assert(ARRAY_SIZE(GeometryNames) == GEOMETRY_NUM_TYPES + 1, "Incorrect array size");
#endif // end DEFINE_GEOMETRY_NAMES

//-------------------------------------------------------------------------------------------------
Expand Down
Loading
Loading