diff -r 56e7f4b4313b src/settings_gui.cpp --- a/src/settings_gui.cpp Sun Nov 16 10:33:00 2008 +0100 +++ b/src/settings_gui.cpp Sun Nov 16 10:51:27 2008 +0100 @@ -872,7 +872,7 @@ static GameSettings *patches_ptr; ///< Pointer to the game settings being displayed and modified int page; - int entry; + PatchEntry *valuewindow_entry; ///< If non-NULL, pointer to patch setting for which a value-entering window has been opened PatchEntry *depressed_entry; ///< If non-NULL, pointer to a clicked numeric patch setting (with a depressed left or right button) PatchesSelectionWindow(const WindowDesc *desc) : Window(desc) @@ -895,6 +895,7 @@ first_time = false; } + valuewindow_entry = NULL; // No patch entry for which a entry window is opened depressed_entry = NULL; // No numeric patch setting buttons are depressed page = 0; @@ -1008,7 +1009,7 @@ /* Show the correct currency-translated value */ if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate; - this->entry = btn; + valuewindow_entry = &page->entries[btn]; SetDParam(0, value); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, this, CS_NUMERAL, QSF_NONE); } @@ -1043,14 +1044,14 @@ virtual void OnQueryTextFinished(char *str) { if (!StrEmpty(str)) { - const PatchEntry *pe = &_patches_page[this->page].entries[this->entry]; - const SettingDesc *sd = pe->setting; + assert(valuewindow_entry != NULL); + const SettingDesc *sd = valuewindow_entry->setting; int32 value = atoi(str); /* Save the correct currency-translated value */ if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate; - SetPatchValue(pe->index, value); + SetPatchValue(valuewindow_entry->index, value); this->SetDirty(); } }