summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-16 00:23:19 +0000
committerdarkvater <darkvater@openttd.org>2005-01-16 00:23:19 +0000
commit07d9bc45dd69261eec739077ddc62a31c571c4a9 (patch)
tree1edc4b1197e2874c229e0f122993c30bfd77db04
parent8bec09737f88f33f7035fd491402348003a52c53 (diff)
downloadopenttd-07d9bc45dd69261eec739077ddc62a31c571c4a9.tar.xz
(svn r1532) -Fix: [1103078] default service period patch options are now cast to 0 with right variable size.
-rw-r--r--settings_gui.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/settings_gui.c b/settings_gui.c
index 9b19a7119..4bae1e582 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -737,7 +737,18 @@ 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
+ // "clamp" 'disabled' value to smallest type
+ switch (pe->type) {
+ case PE_BOOL: case PE_UINT8:
+ *(bool*)pe->variable = 0;
+ break;
+ case PE_INT16: case PE_UINT16:
+ *(int16*)pe->variable = 0;
+ break;
+ case PE_CURRENCY: case PE_INT32:
+ *(int32*)pe->variable = 0;
+ break;
+ }
return;
}