summaryrefslogtreecommitdiff
path: root/settings_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-09-27 20:55:42 +0000
committertron <tron@openttd.org>2005-09-27 20:55:42 +0000
commit6249dd46ad3b1b23ae959f57a0def00cf98dd8ee (patch)
tree9531eb35ea928a52105ec058a27e4be704633242 /settings_gui.c
parent5f3bb18eb70826d1e35351112b50a5bbce3af799 (diff)
downloadopenttd-6249dd46ad3b1b23ae959f57a0def00cf98dd8ee.tar.xz
(svn r2994) Another small hack regarding currencies: add a #define to emulate a variable, that holds the current currency; again this should increase readability
Diffstat (limited to 'settings_gui.c')
-rw-r--r--settings_gui.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/settings_gui.c b/settings_gui.c
index b0c5f5011..2c245f468 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -785,7 +785,7 @@ static int32 ReadPE(const PatchEntry*pe)
case PE_INT16: return *(int16*)pe->variable;
case PE_UINT16: return *(uint16*)pe->variable;
case PE_INT32: return *(int32*)pe->variable;
- case PE_CURRENCY: return (*(int32*)pe->variable) * GetCurrentCurrencyRate();
+ case PE_CURRENCY: return (*(int32*)pe->variable) * _currency->rate;
default: NOT_REACHED();
}
@@ -878,8 +878,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
DrawStringCentered(x+20, y+1, STR_681A, 0);
val = ReadPE(pe);
- if (pe->type == PE_CURRENCY)
- val /= GetCurrentCurrencyRate();
+ if (pe->type == PE_CURRENCY) val /= _currency->rate;
disabled = ((val == 0) && (pe->flags & PF_0ISDIS));
if (disabled) {
SetDParam(0, STR_CONFIG_PATCHES_DISABLED);
@@ -970,9 +969,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
}
if (val != oval) {
// To make patch-changes network-safe
- if (pe->type == PE_CURRENCY) {
- val /= GetCurrentCurrencyRate();
- }
+ if (pe->type == PE_CURRENCY) val /= _currency->rate;
// If an item is playerbased, we do not send it over the network (if any)
if (pe->flags & PF_PLAYERBASED) {
WritePE(pe, val);
@@ -1014,9 +1011,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
const PatchEntry *pe = &page->entries[WP(w,def_d).data_3];
int32 val;
val = atoi(e->edittext.str);
- if (pe->type == PE_CURRENCY) {
- val /= GetCurrentCurrencyRate();
- }
+ if (pe->type == PE_CURRENCY) val /= _currency->rate;
// If an item is playerbased, we do not send it over the network (if any)
if (pe->flags & PF_PLAYERBASED) {
WritePE(pe, val);
@@ -1099,7 +1094,7 @@ void IConsoleSetPatchSetting(const char *name, const char *value)
sscanf(value, "%d", &val);
if (pe->type == PE_CURRENCY) // currency can be different on each client
- val /= GetCurrentCurrencyRate();
+ val /= _currency->rate;
// If an item is playerbased, we do not send it over the network (if any)
if (pe->flags & PF_PLAYERBASED) {