Skip to content

Commit

Permalink
Refactored global variables storage
Browse files Browse the repository at this point in the history
  • Loading branch information
ccw808 committed Jul 10, 2018
1 parent df11335 commit a08504b
Show file tree
Hide file tree
Showing 20 changed files with 235 additions and 235 deletions.
2 changes: 1 addition & 1 deletion Client/core/CConsoleLogger.cpp
Expand Up @@ -23,7 +23,7 @@ struct
uint uiNumBlanks;
const char* szDelim;
const char* szText;
} g_WordsToCheck[] = {
} const g_WordsToCheck[] = {
{2, "", "login "}, {2, "", "register "}, {2, "", "addaccount "}, {2, "", "chgpass "}, {2, "", "chgmypass "}, {1, "'", "password"},
};

Expand Down
2 changes: 1 addition & 1 deletion Client/core/CGUI.cpp
Expand Up @@ -22,7 +22,7 @@ CLocalGUI* CSingleton<CLocalGUI>::m_pSingleton = NULL;
#endif
#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))

const char* DEFAULT_SKIN_NAME = "Default"; // TODO: Change to whatever the default skin is if it changes
const char* const DEFAULT_SKIN_NAME = "Default"; // TODO: Change to whatever the default skin is if it changes

CLocalGUI::CLocalGUI(void)
{
Expand Down
388 changes: 194 additions & 194 deletions Client/core/CKeyBinds.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Client/core/CNickGen.cpp
Expand Up @@ -11,7 +11,7 @@
#include "time.h"

// These words are of a maximum length of 10 characters, capitalized, and stripped of whitespace
const char* CNickGen::m_szAdjectives[] = {
const char* const CNickGen::m_szAdjectives[] = {
"Aback", "Abaft", "Abandoned", "Abashed", "Aberrant", "Abhorrent", "Abiding", "Abject", "Ablaze", "Able", "Abnormal",
"Aboard", "Aboriginal", "Abortive", "Abounding", "Abrasive", "Abrupt", "Absent", "Absorbed", "Absorbing", "Abstracted", "Absurd",
"Abundant", "Abusive", "Acceptable", "Accessible", "Accidental", "Accurate", "Acid", "Acidic", "Acoustic", "Acrid", "Actually",
Expand Down Expand Up @@ -110,7 +110,7 @@ const char* CNickGen::m_szAdjectives[] = {
"Wretched", "Wrong", "Wry",
};

const char* CNickGen::m_szNouns[] = {
const char* const CNickGen::m_szNouns[] = {
"Aardvark", "Buffalo", "Alligator", "Ant", "Anteater", "Antelope", "Ape", "Armadillo", "Donkey", "Baboon", "Badger",
"Barracuda", "Bat", "Bear", "Beaver", "Bee", "Bison", "Boar", "Bush", "Butterfly", "Camel", "Calf",
"Cat", "Kitten", "Cattle", "Chamois", "Cheetah", "Chicken", "Chick", "Chimpanzee", "Infant", "Empress", "Troop",
Expand Down Expand Up @@ -204,4 +204,4 @@ SString CNickGen::GetRandomNickname(void)
int iAdjective = rand() % NICKGEN_NUM_ADJECTIVES;
int iNoun = rand() % NICKGEN_NUM_NOUNS;
return SString("%s%s%i", m_szAdjectives[iAdjective], m_szNouns[iNoun], rand() % 100);
}
}
6 changes: 3 additions & 3 deletions Client/core/CNickGen.h
Expand Up @@ -16,9 +16,9 @@
class CNickGen
{
public:
static const char* m_szAdjectives[NICKGEN_NUM_ADJECTIVES];
static const char* m_szNouns[NICKGEN_NUM_NOUNS];
static SString GetRandomNickname(void);
static const char* const m_szAdjectives[NICKGEN_NUM_ADJECTIVES];
static const char* const m_szNouns[NICKGEN_NUM_NOUNS];
static SString GetRandomNickname(void);
};

#endif
4 changes: 2 additions & 2 deletions Client/core/Graphics/CRenderItem.EffectParameters.cpp
Expand Up @@ -23,7 +23,7 @@ ADD_ENUM(STATE_GROUP_DEVICE_CAPS, "deviceCaps")
ADD_ENUM(STATE_GROUP_VERTEX_DECL, "vertexDeclState")
IMPLEMENT_ENUM_END("state-group")

STypeMapping TypeMappingList[] = {
const STypeMapping TypeMappingList[] = {
{TYPE_INT, D3DXPC_SCALAR, D3DXPT_INT, RegMap::Int2Int, 1},
{TYPE_D3DCOLOR, D3DXPC_SCALAR, D3DXPT_INT, RegMap::Int2Int, 1}, // Can be read as float4 or DWORD color
{TYPE_D3DCOLOR, D3DXPC_VECTOR, D3DXPT_FLOAT, RegMap::Int2Color, 4},
Expand All @@ -47,7 +47,7 @@ STypeMapping TypeMappingList[] = {
#define ADD_REGISTER(type,name) \
{offsetof(USING_STRUCT, name), USING_LIST, #name, type}

SRegisterInfo BigRegisterInfoList[] = {
const SRegisterInfo BigRegisterInfoList[] = {

#define USING_STRUCT CProxyDirect3DDevice9::SD3DRenderState
#define USING_LIST "RenderState"
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/TaskNamesSA.cpp
Expand Up @@ -11,7 +11,7 @@

#include "StdInc.h"

const char* sNoTaskName = "[NO TASK TYPE]";
const char* const sNoTaskName = "[NO TASK TYPE]";

const sTaskName TaskNames[1802] = {
{"TASK_SIMPLE_PLAYER_ON_FOOT"},
Expand Down
4 changes: 2 additions & 2 deletions Client/game_sa/TaskNamesSA.h
Expand Up @@ -14,10 +14,10 @@

struct sTaskName
{
const char* szName;
const char* const szName;
};

extern const char* sNoTaskName;
extern const char* const sNoTaskName;

extern const sTaskName TaskNames[1802];
#endif
28 changes: 14 additions & 14 deletions Client/loader/Dialogs.cpp
Expand Up @@ -28,26 +28,26 @@ static HWND hwndNoAvDialog = NULL;
//
//
///////////////////////////////////////////////////////////////////////////
const char* dialogStringsYes = _td("Yes");
const char* dialogStringsNo = _td("No");
const char* dialogStringsOk = _td("OK");
const char* dialogStringsQuit = _td("Quit");
const char* dialogStringsHelp = _td("Help");
const char* dialogStringsCancel = _td("Cancel");
const char* const dialogStringsYes = _td("Yes");
const char* const dialogStringsNo = _td("No");
const char* const dialogStringsOk = _td("OK");
const char* const dialogStringsQuit = _td("Quit");
const char* const dialogStringsHelp = _td("Help");
const char* const dialogStringsCancel = _td("Cancel");

struct SDialogItemInfo
{
int iItemId;
int iLeadingSpaces;
const char* szItemText;
int iItemId;
int iLeadingSpaces;
const char* const szItemText;
};

SDialogItemInfo g_ProgressDialogItems[] = {
const SDialogItemInfo g_ProgressDialogItems[] = {
{IDCANCEL, 0, dialogStringsCancel},
{-1},
};

SDialogItemInfo g_CrashedDialogItems[] = {
const SDialogItemInfo g_CrashedDialogItems[] = {
{0, 0, _td("MTA: San Andreas has encountered a problem")},
{IDC_CRASH_HEAD, 0, _td("Crash information")},
{IDC_SEND_DUMP_CHECK, 0, _td("Tick the check box to send this crash info to MTA devs using the 'internet'")},
Expand All @@ -58,7 +58,7 @@ SDialogItemInfo g_CrashedDialogItems[] = {
{-1},
};

SDialogItemInfo g_D3dDllDialogItems[] = {
const SDialogItemInfo g_D3dDllDialogItems[] = {
{0, 0, _td("MTA: San Andreas - Warning")},
{IDC_D3DDLL_TEXT1, 0, _td("Your Grand Theft Auto: San Andreas install directory contains a d3d9.dll file:")},
{IDC_D3DDLL_TEXT2, 0,
Expand All @@ -71,7 +71,7 @@ SDialogItemInfo g_D3dDllDialogItems[] = {
{-1},
};

SDialogItemInfo g_OptimusDialogItems[] = {
const SDialogItemInfo g_OptimusDialogItems[] = {
{0, 0, _td("MTA: San Andreas - Confusing options")},
{IDC_OPTIMUS_TEXT1, 0, _td("NVidia Optimus detected!")},
{IDC_OPTIMUS_TEXT2, 0, _td("Try each option and see what works:")},
Expand All @@ -90,7 +90,7 @@ SDialogItemInfo g_OptimusDialogItems[] = {
{-1},
};

SDialogItemInfo g_NoAvDialogItems[] = {
const SDialogItemInfo g_NoAvDialogItems[] = {
{0, 0, _td("MTA: San Andreas")},
{IDC_NOAV_TEXT1, 0, _td("Warning: Could not detect anti-virus product")},
{IDC_NOAV_TEXT2, 0,
Expand Down
4 changes: 2 additions & 2 deletions Client/mods/deathmatch/logic/CClientObjectManager.cpp
Expand Up @@ -12,7 +12,7 @@

// Generated by MTA10\utils\gentable\gentable_objmodels.cpp
// (Currently excludes peds (below 300) and vehicles)
static unsigned int g_uiValidObjectModels[] = {
static const unsigned int g_uiValidObjectModels[] = {
2, 0, 0, 0, 0, 0, 0, 0, 0, -4096, -1053185, 4194303, 16127, 0,
0, 0, 0, 0, 0, -128, -515899393, -134217729, -1, -1, 33554431, -1, -1, -1,
-14337, -1, -1, -129, -1, 1073741823, -1, -1, -1, -8387585, -1, -1, -1, -1,
Expand Down Expand Up @@ -64,7 +64,7 @@ static unsigned int g_uiValidObjectModels[] = {
// Generated by:
// 1. Extracting model names from object.dat which have a 'Collision Damage Effect' greater than 0
// 2. Converting model names to IDs using objects.xml
static unsigned short g_usBreakableModelList[] = {
static const unsigned short g_usBreakableModelList[] = {
625, 626, 627, 628, 629, 630, 631, 632, 633, 642, 643, 644, 646, 650, 716, 717, 737, 738, 792, 858, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891,
892, 893, 894, 895, 904, 905, 941, 955, 956, 959, 961, 990, 993, 996, 1209, 1211, 1213, 1219, 1220, 1221, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230,
1231, 1232, 1235, 1238, 1244, 1251, 1255, 1257, 1262, 1264, 1265, 1270, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1293, 1294,
Expand Down
4 changes: 2 additions & 2 deletions Client/mods/deathmatch/logic/CModelNames.cpp
Expand Up @@ -10019,7 +10019,7 @@ struct
10012, "cables4",
};

static const char* playerClothesModel[] = {
static const char* const playerClothesModel[] = {
"afro", "afrobeard", "afrotash", "balaclava", "bandana", "bandknots", "bandmask", "barefeet", "baseball", "bask1",
"baskball", "bbjack", "beret", "biker", "bikerhelmet", "boater", "bowler", "boxingcap", "boxingshoe", "boxingshort",
"cap", "capandband", "capback", "capknit", "capover", "capovereye", "cappolice", "caprimup", "capside", "captruck",
Expand All @@ -10037,7 +10037,7 @@ static const char* playerClothesModel[] = {
"trilby", "tshirt", "tshirt2", "valet", "vest", "watch", "watch_hoody", "wcoat", "wedge", "worktr",
"worktrboot", "zorromask"};

static const char* playerClothesTex[] = {
static const char* const playerClothesTex[] = {
"10ls",
"10ls2",
"10ls3",
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CVehicleNames.cpp
Expand Up @@ -12,7 +12,7 @@

using namespace std;

const char* szVehicleNameEmpty = "";
const char* const szVehicleNameEmpty = "";

struct SVehicleName
{
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CVehicleUpgrades.cpp
Expand Up @@ -14,7 +14,7 @@ char szUpgradeNameEmpty[] = "";

struct SUpgradeName
{
const char* szName;
const char* const szName;
};

static const SFixedArray<SUpgradeName, 17> UpgradeNames = {{{"Hood"},
Expand Down
4 changes: 2 additions & 2 deletions Client/mods/deathmatch/logic/CWeaponNames.cpp
Expand Up @@ -12,7 +12,7 @@

using namespace std;

const char* szWeaponNameEmpty = "";
const char* const szWeaponNameEmpty = "";

struct SWeaponName
{
Expand Down Expand Up @@ -126,4 +126,4 @@ char CWeaponNames::GetSlotFromWeapon(unsigned char ucID)
}

return -1;
}
}
2 changes: 1 addition & 1 deletion Client/multiplayer_sa/CMultiplayerSA.cpp
Expand Up @@ -6571,7 +6571,7 @@ eRadioStationID dwStationID = UNKNOWN;
BYTE bTrackID = 0;
DWORD dwNumberOfTracks = 0;

DWORD pTrackNumbers[] = {
const DWORD pTrackNumbers[] = {
0x2, // radio off, somewhere 2 is subtracted from this so that's why it's 2
0xB, // playback fm
0xF, // k-rose
Expand Down
2 changes: 1 addition & 1 deletion Shared/mods/deathmatch/logic/CZoneNames.cpp
Expand Up @@ -9,7 +9,7 @@

#include "StdInc.h"

static const char* szUnknownZone = "Unknown";
static const char* const szUnknownZone = "Unknown";

static const SFixedArray<const char*, 8> cityNameList = {{
"Tierra Robada",
Expand Down
@@ -1,6 +1,6 @@
namespace EmbeddedLuaCode
{
const SString coroutine_debug = R"~LUA~(
const char* const coroutine_debug = R"~LUA~(
--[[
SERVER AND CLIENT.
Expand Down
2 changes: 1 addition & 1 deletion Shared/mods/deathmatch/logic/luascripts/exports.lua.h
@@ -1,6 +1,6 @@
namespace EmbeddedLuaCode
{
const SString exports = R"~LUA~(
const char* const exports = R"~LUA~(
--[[
SERVER AND CLIENT.
Expand Down
2 changes: 1 addition & 1 deletion Shared/mods/deathmatch/logic/luascripts/inspect.lua.h
@@ -1,6 +1,6 @@
namespace EmbeddedLuaCode
{
const SString inspect = R"~LUA~(
const char* const inspect = R"~LUA~(
--[[
SERVER AND CLIENT.
Expand Down
2 changes: 1 addition & 1 deletion vendor/cegui-0.4.0-custom/include/CEGUIStringBidi.h
Expand Up @@ -165,7 +165,7 @@ typedef struct{
/* very bad Memory alignment for 32-bit machines
* could split it to 2 arrays or promote type to 2 bytes type
*/
shape_node shapetypes[] = {
const shape_node shapetypes[] = {
/* index, Typ, Iso */
/* 621 */ {SU, 0xFE80},
/* 622 */ {SR, 0xFE81},
Expand Down

0 comments on commit a08504b

Please sign in to comment.