mirror of https://github.com/OpenTTD/OpenTTD
(svn r4487) - Codechange: replace the custom currency magic number 23 with a define
parent
92d8af75db
commit
5ddf986c8d
|
@ -84,7 +84,7 @@ uint GetMaskOfAllowedCurrencies(void)
|
||||||
if (to_euro == CF_ISEURO && _cur_year < 2000 - MAX_YEAR_BEGIN_REAL) continue;
|
if (to_euro == CF_ISEURO && _cur_year < 2000 - MAX_YEAR_BEGIN_REAL) continue;
|
||||||
mask |= (1 << i);
|
mask |= (1 << i);
|
||||||
}
|
}
|
||||||
mask |= (1 << 23); // always allow custom currency
|
mask |= (1 << CUSTOM_CURRENCY_ID); // always allow custom currency
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ extern CurrencySpec _currency_specs[];
|
||||||
extern const StringID _currency_string_list[];
|
extern const StringID _currency_string_list[];
|
||||||
|
|
||||||
// XXX small hack, but makes the rest of the code a bit nicer to read
|
// XXX small hack, but makes the rest of the code a bit nicer to read
|
||||||
#define _custom_currency (_currency_specs[23])
|
#define CUSTOM_CURRENCY_ID 23
|
||||||
|
#define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
|
||||||
#define _currency ((const CurrencySpec*)&_currency_specs[_opt_ptr->currency])
|
#define _currency ((const CurrencySpec*)&_currency_specs[_opt_ptr->currency])
|
||||||
|
|
||||||
uint GetMaskOfAllowedCurrencies(void);
|
uint GetMaskOfAllowedCurrencies(void);
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ static const SettingDesc _gameopt_settings[] = {
|
||||||
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, NULL, STR_NULL, NULL, 0, 3),
|
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, NULL, STR_NULL, NULL, 0, 3),
|
||||||
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION),
|
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION),
|
||||||
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9,0, 9, STR_NULL, NULL),
|
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9,0, 9, STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, 23, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SEK|custom", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SEK|custom", STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 17, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 17, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish", STR_NULL, NULL),
|
||||||
SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL),
|
SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL),
|
||||||
|
|
|
@ -171,8 +171,7 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5: /* Currency */
|
case 5: /* Currency */
|
||||||
if (e->dropdown.index == 23)
|
if (e->dropdown.index == CUSTOM_CURRENCY_ID) ShowCustCurrency();
|
||||||
ShowCustCurrency();
|
|
||||||
_opt_ptr->currency = e->dropdown.index;
|
_opt_ptr->currency = e->dropdown.index;
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue