settings_gui.c
changeset 1031 f4d4ebab35d8
parent 1015 3629f5e8c092
child 1037 4fbbb01cf87b
equal deleted inserted replaced
1030:24c0b0000bf0 1031:f4d4ebab35d8
   735 
   735 
   736 static void WritePE(const PatchEntry *pe, int32 val)
   736 static void WritePE(const PatchEntry *pe, int32 val)
   737 {
   737 {
   738 
   738 
   739 	if ((pe->flags & PF_0ISDIS) && val <= 0) {
   739 	if ((pe->flags & PF_0ISDIS) && val <= 0) {
   740 		*(bool*)pe->variable = 0; // "clamp" 'disabled' value to smallest type, PE_BOOL
   740 		// "clamp" 'disabled' value to smallest type
       
   741 		switch (pe->type) {
       
   742 			case PE_BOOL: case PE_UINT8:
       
   743 				*(bool*)pe->variable = 0;
       
   744 				break;
       
   745 			case PE_INT16: case PE_UINT16:
       
   746 				*(int16*)pe->variable = 0;
       
   747 				break;
       
   748 			case PE_CURRENCY: case PE_INT32:
       
   749 				*(int32*)pe->variable = 0;
       
   750 				break;
       
   751 		}
   741 		return;
   752 		return;
   742 	}
   753 	}
   743 
   754 
   744 	switch(pe->type) {
   755 	switch(pe->type) {
   745 	case PE_BOOL: *(bool*)pe->variable = (bool)val; break;
   756 	case PE_BOOL: *(bool*)pe->variable = (bool)val; break;