diff -r 6bf2ca3d8be4 -r 002f404319e9 src/settings_gui.cpp --- a/src/settings_gui.cpp Sun Sep 28 11:28:18 2008 +0200 +++ b/src/settings_gui.cpp Sun Sep 28 11:39:50 2008 +0200 @@ -770,12 +770,10 @@ if (first_time) { PatchPage *page; for (page = &_patches_page[0]; page != endof(_patches_page); page++) { - uint i; - if (patches_max < page->num) patches_max = page->num; page->entries = MallocT(page->num); - for (i = 0; i != page->num; i++) { + for (uint i = 0; i != page->num; i++) { uint index; const SettingDesc *sd = GetPatchFromName(page->names[i], &index); assert(sd != NULL); @@ -804,16 +802,14 @@ virtual void OnPaint() { - int x, y; const PatchPage *page = &_patches_page[this->page]; - uint i; /* Set up selected category */ this->DrawWidgets(); - x = config_patch_x_start; - y = config_patch_y_start; - for (i = 0; i != page->num; i++) { + int x = config_patch_x_start; + int y = config_patch_y_start; + for (uint i = 0; i != page->num; i++) { const SettingDesc *sd = page->entries[i].setting; const SettingDescBase *sdb = &sd->desc; const void *var = GetVariableAddress(patches_ptr, &sd->save); @@ -864,31 +860,25 @@ switch (widget) { case PATCHSEL_OPTIONSPANEL: { const PatchPage *page = &_patches_page[this->page]; - const SettingDesc *sd; - void *var; - int32 value; - int x, y; - byte btn; - - y = pt.y - config_patch_y_start; // Shift y coordinate + int y = pt.y - config_patch_y_start; // Shift y coordinate if (y < 0) return; // Clicked above first entry - x = pt.x - config_patch_x_start; // Shift x coordinate + int x = pt.x - config_patch_x_start; // Shift x coordinate if (x < 0) return; // Clicked left of the entry - btn = y / setting_height; // Compute which setting is selected + byte btn = y / setting_height; // Compute which setting is selected if (y % setting_height > (setting_height -2)) return; // Clicked too low at the setting if (btn >= page->num) return; // Clicked below the last setting of the page - sd = page->entries[btn].setting; + const SettingDesc *sd = page->entries[btn].setting; /* return if action is only active in network, or only settable by server */ if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) return; if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return; if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return; - var = GetVariableAddress(patches_ptr, &sd->save); - value = (int32)ReadValue(var, sd->save.conv); + void *var = GetVariableAddress(patches_ptr, &sd->save); + int32 value = (int32)ReadValue(var, sd->save.conv); /* clicked on the icon on the left side. Either scroller or bool on/off */ if (x < 21) {