summaryrefslogtreecommitdiff
path: root/settings_gui.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-08-13 23:12:47 +0000
committerdarkvater <darkvater@openttd.org>2004-08-13 23:12:47 +0000
commit15d60c09f537558857975485274898ff4ad78f18 (patch)
tree393e4a4ed640c84e43420867690413c296bf20db /settings_gui.c
parentdf61b336dbdd2a6d311ad20c10afec0c0903c0c1 (diff)
downloadopenttd-15d60c09f537558857975485274898ff4ad78f18.tar.xz
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
Diffstat (limited to 'settings_gui.c')
-rw-r--r--settings_gui.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/settings_gui.c b/settings_gui.c
index ecf3714bb..7c281efd8 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -795,6 +795,12 @@ static int32 ReadPE(const PatchEntry*pe)
static void WritePE(const PatchEntry *pe, int32 val)
{
+
+ if ((pe->flags & PF_0ISDIS) && val <= 0) {
+ *(bool*)pe->variable = 0; // "clamp" 'disabled' value to smallest type, PE_BOOL
+ return;
+ }
+
switch(pe->type) {
case PE_BOOL: *(bool*)pe->variable = (bool)val; break;
@@ -816,8 +822,6 @@ static void WritePE(const PatchEntry *pe, int32 val)
case PE_UINT16: if ((uint16)val > (uint16)pe->max)
*(uint16*)pe->variable = (uint16)pe->max;
- else if ( (pe->flags & PF_0ISDIS) && ((int16)val < (int16)pe->min) )
- *(int16*)pe->variable = 0;
else if ((uint16)val < (uint16)pe->min)
*(uint16*)pe->variable = (uint16)pe->min;
else