diff options
-rw-r--r-- | settings.c | 3 | ||||
-rw-r--r-- | settings_gui.c | 4 |
2 files changed, 2 insertions, 5 deletions
diff --git a/settings.c b/settings.c index 86d73191c..6dea5e74a 100644 --- a/settings.c +++ b/settings.c @@ -1582,6 +1582,7 @@ int32 CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) Patches *patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; void *var = ini_get_variable(&sd->save, patches_ptr); Write_ValidateSetting(var, sd, (int32)p2); + if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); InvalidateWindow(WC_GAME_OPTIONS, 0); } @@ -1611,6 +1612,7 @@ bool SetPatchValue(uint index, const Patches *object, int32 value) void *var2 = ini_get_variable(&sd->save, &_patches_newgame); Write_ValidateSetting(var2, sd, value); } + if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); InvalidateWindow(WC_GAME_OPTIONS, 0); return true; } @@ -1653,7 +1655,6 @@ bool IConsoleSetPatchSetting(const char *name, int32 value) ptr = ini_get_variable(&sd->save, patches_ptr); success = SetPatchValue(index, patches_ptr, value); - if (success && sd->desc.proc != NULL) sd->desc.proc(value); return success; } diff --git a/settings_gui.c b/settings_gui.c index 7af75a6a6..c336e86fa 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -833,7 +833,6 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e) if (value != oldvalue) { SetPatchValue(page->entries[btn].index, patches_ptr, value); SetWindowDirty(w); - if (sdb->proc != NULL) sdb->proc((int32)ReadValue(var, sd->save.conv)); } } else { /* only open editbox for types that its sensible for */ @@ -868,7 +867,6 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e) if (e->we.edittext.str != NULL) { const PatchEntry *pe = &_patches_page[WP(w,def_d).data_1].entries[WP(w,def_d).data_3]; const SettingDesc *sd = pe->setting; - void *var = ini_get_variable(&sd->save, patches_ptr); int32 value = atoi(e->we.edittext.str); /* Save the correct currency-translated value */ @@ -876,8 +874,6 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e) SetPatchValue(pe->index, patches_ptr, value); SetWindowDirty(w); - - if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); } break; } |