Changeset - r48:4e058801aa9f
[Not reviewed]
master
0 1 0
darkvater - 20 years ago 2004-08-13 23:12:47
darkvater@openttd.org
(svn r49) -'Disabled' in patch settings universal for all pe->variable types (dominik81).
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
settings_gui.c
Show inline comments
 
@@ -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
 

	
 
	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
0 comments (0 inline, 0 general)