equal
deleted
inserted
replaced
783 case PE_BOOL: return *(bool*)pe->variable; |
783 case PE_BOOL: return *(bool*)pe->variable; |
784 case PE_UINT8: return *(uint8*)pe->variable; |
784 case PE_UINT8: return *(uint8*)pe->variable; |
785 case PE_INT16: return *(int16*)pe->variable; |
785 case PE_INT16: return *(int16*)pe->variable; |
786 case PE_UINT16: return *(uint16*)pe->variable; |
786 case PE_UINT16: return *(uint16*)pe->variable; |
787 case PE_INT32: return *(int32*)pe->variable; |
787 case PE_INT32: return *(int32*)pe->variable; |
788 case PE_CURRENCY: return (*(int32*)pe->variable) * GetCurrentCurrencyRate(); |
788 case PE_CURRENCY: return (*(int32*)pe->variable) * _currency->rate; |
789 default: NOT_REACHED(); |
789 default: NOT_REACHED(); |
790 } |
790 } |
791 |
791 |
792 /* useless, but avoids compiler warning this way */ |
792 /* useless, but avoids compiler warning this way */ |
793 return 0; |
793 return 0; |
876 } |
876 } |
877 DrawStringCentered(x+10, y+1, STR_6819, 0); |
877 DrawStringCentered(x+10, y+1, STR_6819, 0); |
878 DrawStringCentered(x+20, y+1, STR_681A, 0); |
878 DrawStringCentered(x+20, y+1, STR_681A, 0); |
879 |
879 |
880 val = ReadPE(pe); |
880 val = ReadPE(pe); |
881 if (pe->type == PE_CURRENCY) |
881 if (pe->type == PE_CURRENCY) val /= _currency->rate; |
882 val /= GetCurrentCurrencyRate(); |
|
883 disabled = ((val == 0) && (pe->flags & PF_0ISDIS)); |
882 disabled = ((val == 0) && (pe->flags & PF_0ISDIS)); |
884 if (disabled) { |
883 if (disabled) { |
885 SetDParam(0, STR_CONFIG_PATCHES_DISABLED); |
884 SetDParam(0, STR_CONFIG_PATCHES_DISABLED); |
886 } else { |
885 } else { |
887 SetDParam(1, val); |
886 SetDParam(1, val); |
968 } |
967 } |
969 break; |
968 break; |
970 } |
969 } |
971 if (val != oval) { |
970 if (val != oval) { |
972 // To make patch-changes network-safe |
971 // To make patch-changes network-safe |
973 if (pe->type == PE_CURRENCY) { |
972 if (pe->type == PE_CURRENCY) val /= _currency->rate; |
974 val /= GetCurrentCurrencyRate(); |
|
975 } |
|
976 // If an item is playerbased, we do not send it over the network (if any) |
973 // If an item is playerbased, we do not send it over the network (if any) |
977 if (pe->flags & PF_PLAYERBASED) { |
974 if (pe->flags & PF_PLAYERBASED) { |
978 WritePE(pe, val); |
975 WritePE(pe, val); |
979 } else { |
976 } else { |
980 // Else we do |
977 // Else we do |
1012 if (*e->edittext.str) { |
1009 if (*e->edittext.str) { |
1013 const PatchPage *page = &_patches_page[WP(w,def_d).data_1]; |
1010 const PatchPage *page = &_patches_page[WP(w,def_d).data_1]; |
1014 const PatchEntry *pe = &page->entries[WP(w,def_d).data_3]; |
1011 const PatchEntry *pe = &page->entries[WP(w,def_d).data_3]; |
1015 int32 val; |
1012 int32 val; |
1016 val = atoi(e->edittext.str); |
1013 val = atoi(e->edittext.str); |
1017 if (pe->type == PE_CURRENCY) { |
1014 if (pe->type == PE_CURRENCY) val /= _currency->rate; |
1018 val /= GetCurrentCurrencyRate(); |
|
1019 } |
|
1020 // If an item is playerbased, we do not send it over the network (if any) |
1015 // If an item is playerbased, we do not send it over the network (if any) |
1021 if (pe->flags & PF_PLAYERBASED) { |
1016 if (pe->flags & PF_PLAYERBASED) { |
1022 WritePE(pe, val); |
1017 WritePE(pe, val); |
1023 } else { |
1018 } else { |
1024 // Else we do |
1019 // Else we do |
1097 } |
1092 } |
1098 |
1093 |
1099 sscanf(value, "%d", &val); |
1094 sscanf(value, "%d", &val); |
1100 |
1095 |
1101 if (pe->type == PE_CURRENCY) // currency can be different on each client |
1096 if (pe->type == PE_CURRENCY) // currency can be different on each client |
1102 val /= GetCurrentCurrencyRate(); |
1097 val /= _currency->rate; |
1103 |
1098 |
1104 // If an item is playerbased, we do not send it over the network (if any) |
1099 // If an item is playerbased, we do not send it over the network (if any) |
1105 if (pe->flags & PF_PLAYERBASED) { |
1100 if (pe->flags & PF_PLAYERBASED) { |
1106 WritePE(pe, val); |
1101 WritePE(pe, val); |
1107 } else // Else we do |
1102 } else // Else we do |