diff -r ea72be6c9bfb src/settings_gui.cpp --- a/src/settings_gui.cpp Sun Nov 02 12:53:58 2008 +0100 +++ b/src/settings_gui.cpp Sun Nov 02 15:20:26 2008 +0100 @@ -751,6 +751,8 @@ }; struct PatchesSelectionWindow : Window { + static const int SETTINGTREE_LEFT_OFFSET; ///< Position of left edge of patch values + static GameSettings *patches_ptr; ///< Pointer to the game settings being displayed and modified static int patches_max; ///< Maximal number of patches on a single page @@ -760,6 +762,11 @@ PatchesSelectionWindow(const WindowDesc *desc) : Window(desc) { + /* Check that the widget doesn't get moved without adapting the constant as well. + * SETTINGTREE_LEFT_OFFSET should be 5 pixels to the right of the left edge of the panel + */ + assert(this->widget[PATCHSEL_OPTIONSPANEL].left + 5 == SETTINGTREE_LEFT_OFFSET); + static bool first_time = true; patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game; @@ -798,14 +805,14 @@ virtual void OnPaint() { - int x, y; + int y; const PatchPage *page = &_patches_page[this->page]; uint i; /* Set up selected category */ this->DrawWidgets(); - x = 5; + int x = SETTINGTREE_LEFT_OFFSET; y = 47; for (i = 0; i != page->num; i++) { const SettingDesc *sd = page->entries[i].setting; @@ -867,7 +874,7 @@ y = pt.y - 46 - 1; // Shift y coordinate if (y < 0) return; // Clicked above first entry - x = pt.x - 5; // Shift x coordinate + x = pt.x - SETTINGTREE_LEFT_OFFSET; // Shift x coordinate if (x < 0) return; // Clicked left of the entry btn = y / SETTING_HEIGHT; // Compute which setting is selected @@ -975,6 +982,7 @@ }; GameSettings *PatchesSelectionWindow::patches_ptr = NULL; +const int PatchesSelectionWindow::SETTINGTREE_LEFT_OFFSET = 5; int PatchesSelectionWindow::patches_max = 0; static const Widget _patches_selection_widgets[] = {