summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-03-05 11:16:44 +0000
committerrubidium <rubidium@openttd.org>2011-03-05 11:16:44 +0000
commite48967541a8ce602267f80d295bcb4fe89ca70fb (patch)
tree4e3475e4a57297a7850beadc4c8f1f325f750268
parent2636a4809b27bac69448e583889056e56938decd (diff)
downloadopenttd-e48967541a8ce602267f80d295bcb4fe89ca70fb.tar.xz
(svn r22198) -Codechange: make some constants name more explicit
-rw-r--r--src/saveload/saveload.cpp4
-rw-r--r--src/saveload/saveload.h10
-rw-r--r--src/settings.cpp6
-rw-r--r--src/settings_gui.cpp4
-rw-r--r--src/table/settings.h.preamble6
5 files changed, 15 insertions, 15 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 25c1fe958..3c7700e93 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1326,7 +1326,7 @@ static void SlList(void *list, SLRefType conv)
static inline bool SlIsObjectValidInSavegame(const SaveLoad *sld)
{
if (_sl_version < sld->version_from || _sl_version > sld->version_to) return false;
- if (sld->conv & SLF_SAVE_NO) return false;
+ if (sld->conv & SLF_NOT_IN_SAVE) return false;
return true;
}
@@ -1338,7 +1338,7 @@ static inline bool SlIsObjectValidInSavegame(const SaveLoad *sld)
*/
static inline bool SlSkipVariableOnLoad(const SaveLoad *sld)
{
- if ((sld->conv & SLF_NETWORK_NO) && _sl.action != SLA_SAVE && _networking && !_network_server) {
+ if ((sld->conv & SLF_NO_NETWORK_SYNC) && _sl.action != SLA_SAVE && _networking && !_network_server) {
SlSkipBytes(SlCalcConvMemLen(sld->conv) * sld->length);
return true;
}
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index 7c8596532..b5fb0010e 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -176,9 +176,9 @@ enum VarTypes {
/* 8 bits allocated for a maximum of 8 flags
* Flags directing saving/loading of a variable */
- SLF_SAVE_NO = 1 << 8, ///< do not save with savegame, basically client-based
- SLF_CONFIG_NO = 1 << 9, ///< do not save to config file
- SLF_NETWORK_NO = 1 << 10, ///< do not synchronize over network (but it is saved if SSF_SAVE_NO is not set)
+ SLF_NOT_IN_SAVE = 1 << 8, ///< do not save with savegame, basically client-based
+ SLF_NOT_IN_CONFIG = 1 << 9, ///< do not save to config file
+ SLF_NO_NETWORK_SYNC = 1 << 10, ///< do not synchronize over network (but it is saved if SLF_NOT_IN_SAVE is not set)
/* 5 more possible flags */
};
@@ -336,7 +336,7 @@ typedef SaveLoad SaveLoadGlobVarList;
* @param from First savegame version that has the empty space.
* @param to Last savegame version that has the empty space.
*/
-#define SLE_CONDNULL(length, from, to) SLE_CONDARR(NullStruct, null, SLE_FILE_U8 | SLE_VAR_NULL | SLF_CONFIG_NO, length, from, to)
+#define SLE_CONDNULL(length, from, to) SLE_CONDARR(NullStruct, null, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to)
/** Translate values ingame to different values in the savegame and vv. */
#define SLE_WRITEBYTE(base, variable, value) SLE_GENERAL(SL_WRITEBYTE, base, variable, 0, 0, value, value)
@@ -446,7 +446,7 @@ typedef SaveLoad SaveLoadGlobVarList;
* @param from First savegame version that has the empty space.
* @param to Last savegame version that has the empty space.
*/
-#define SLEG_CONDNULL(length, from, to) {true, SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_CONFIG_NO, length, from, to, (void*)NULL}
+#define SLEG_CONDNULL(length, from, to) {true, SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_NOT_IN_CONFIG, length, from, to, (void*)NULL}
/** End marker of global variables save or load. */
#define SLEG_END() {true, SL_END, 0, 0, 0, 0, NULL}
diff --git a/src/settings.cpp b/src/settings.cpp
index 6d36f623b..9d4f52cab 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -538,7 +538,7 @@ static void IniSaveSettings(IniFile *ini, const SettingDesc *sd, const char *grp
/* If the setting is not saved to the configuration
* file, just continue with the next setting */
if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue;
- if (sld->conv & SLF_CONFIG_NO) continue;
+ if (sld->conv & SLF_NOT_IN_CONFIG) continue;
/* XXX - wtf is this?? (group override?) */
s = strchr(sdb->name, '.');
@@ -1728,7 +1728,7 @@ bool SetSettingValue(uint index, int32 value, bool force_newgame)
* (if any) to change. Also *hack*hack* we update the _newgame version
* of settings because changing a company-based setting in a game also
* changes its defaults. At least that is the convention we have chosen */
- if (sd->save.conv & SLF_NETWORK_NO) {
+ if (sd->save.conv & SLF_NO_NETWORK_SYNC) {
void *var = GetVariableAddress(&GetGameSettings(), &sd->save);
Write_ValidateSetting(var, sd, value);
@@ -1826,7 +1826,7 @@ uint GetCompanySettingIndex(const char *name)
bool SetSettingValue(uint index, const char *value, bool force_newgame)
{
const SettingDesc *sd = &_settings[index];
- assert(sd->save.conv & SLF_NETWORK_NO);
+ assert(sd->save.conv & SLF_NO_NETWORK_SYNC);
if (GetVarMemType(sd->save.conv) == SLE_VAR_STRQ) {
char **var = (char**)GetVariableAddress((_game_mode == GM_MENU || force_newgame) ? &_settings_newgame : &_settings_game, &sd->save);
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index e5056457c..f25d1b843 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1145,7 +1145,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, const SettingDesc *sd
uint button_y = y + (SETTING_HEIGHT - 11) / 2;
/* We do not allow changes of some items when we are a client in a networkgame */
- if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server && !(sdb->flags & SGF_PER_COMPANY)) editable = false;
+ if (!(sd->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server && !(sdb->flags & SGF_PER_COMPANY)) editable = false;
if ((sdb->flags & SGF_NETWORK_ONLY) && !_networking) editable = false;
if ((sdb->flags & SGF_NO_NETWORK) && _networking) editable = false;
@@ -1587,7 +1587,7 @@ struct GameSettingsWindow : Window {
const SettingDesc *sd = pe->d.entry.setting;
/* return if action is only active in network, or only settable by server */
- if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server && !(sd->desc.flags & SGF_PER_COMPANY)) return;
+ if (!(sd->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server && !(sd->desc.flags & SGF_PER_COMPANY)) return;
if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return;
if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return;
diff --git a/src/table/settings.h.preamble b/src/table/settings.h.preamble
index fa4597e90..e29feb83b 100644
--- a/src/table/settings.h.preamble
+++ b/src/table/settings.h.preamble
@@ -166,9 +166,9 @@ static bool UpdateClientConfigValues(int32 p1);
/* Shortcuts for macros below. Logically if we don't save the value
* we also don't sync it in a network game */
-#define S SLF_SAVE_NO | SLF_NETWORK_NO
-#define C SLF_CONFIG_NO
-#define N SLF_NETWORK_NO
+#define S SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
+#define C SLF_NOT_IN_CONFIG
+#define N SLF_NO_NETWORK_SYNC
#define D0 SGF_0ISDISABLED
#define NC SGF_NOCOMMA