From 6249dd46ad3b1b23ae959f57a0def00cf98dd8ee Mon Sep 17 00:00:00 2001 From: tron Date: Tue, 27 Sep 2005 20:55:42 +0000 Subject: (svn r2994) Another small hack regarding currencies: add a #define to emulate a variable, that holds the current currency; again this should increase readability --- settings_gui.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'settings_gui.c') 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) { -- cgit v1.2.3-70-g09d2