changeset 17444:bf88fe868439 draft

(svn r22198) -Codechange: make some constants name more explicit
author rubidium <rubidium@openttd.org>
date Sat, 05 Mar 2011 11:16:44 +0000
parents b78e3e26c345
children f4b87d29bafd
files src/saveload/saveload.cpp src/saveload/saveload.h src/settings.cpp src/settings_gui.cpp src/table/settings.h.preamble
diffstat 5 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1326,7 +1326,7 @@
 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 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;
 	}
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -176,9 +176,9 @@
 
 	/* 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 @@
  * @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 @@
  * @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}
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -538,7 +538,7 @@
 		/* 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 @@
 	 * (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 @@
 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);
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1145,7 +1145,7 @@
 	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 @@
 		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;
 
--- a/src/table/settings.h.preamble
+++ b/src/table/settings.h.preamble
@@ -166,9 +166,9 @@
 
 /* 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