(svn r22198) -Codechange: make some constants name more explicit

pull/155/head
rubidium 13 years ago
parent 8ead62cdc1
commit 2a7912d415

@ -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;
}

@ -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}

@ -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);

@ -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;

@ -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

Loading…
Cancel
Save