mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r14795) -Codechange: replace a magic number with a constant (Alberth)
This commit is contained in:
parent
8ff93c2c14
commit
6913ae5a5f
@ -583,6 +583,8 @@ void ShowGameDifficulty()
|
|||||||
new GameDifficultyWindow();
|
new GameDifficultyWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const int SETTING_HEIGHT = 11; ///< Height of a single patch setting in the tree view
|
||||||
|
|
||||||
static const char *_patches_ui[] = {
|
static const char *_patches_ui[] = {
|
||||||
"gui.vehicle_speed",
|
"gui.vehicle_speed",
|
||||||
"gui.status_long_date",
|
"gui.status_long_date",
|
||||||
@ -785,10 +787,10 @@ struct PatchesSelectionWindow : Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Resize the window to fit the largest patch tab */
|
/* Resize the window to fit the largest patch tab */
|
||||||
ResizeWindowForWidget(this, PATCHSEL_OPTIONSPANEL, 0, patches_max * 11);
|
ResizeWindowForWidget(this, PATCHSEL_OPTIONSPANEL, 0, patches_max * SETTING_HEIGHT);
|
||||||
|
|
||||||
/* Recentre the window for the new size */
|
/* Recentre the window for the new size */
|
||||||
this->top = this->top - (patches_max * 11) / 2;
|
this->top = this->top - (patches_max * SETTING_HEIGHT) / 2;
|
||||||
|
|
||||||
this->LowerWidget(PATCHSEL_INTERFACE);
|
this->LowerWidget(PATCHSEL_INTERFACE);
|
||||||
|
|
||||||
@ -848,7 +850,7 @@ struct PatchesSelectionWindow : Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrawString(30, y, (sdb->str) + disabled, TC_FROMSTRING);
|
DrawString(30, y, (sdb->str) + disabled, TC_FROMSTRING);
|
||||||
y += 11;
|
y += SETTING_HEIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,8 +871,8 @@ struct PatchesSelectionWindow : Window {
|
|||||||
x = pt.x - 5; // Shift x coordinate
|
x = pt.x - 5; // Shift x coordinate
|
||||||
if (x < 0) return; // Clicked left of the entry
|
if (x < 0) return; // Clicked left of the entry
|
||||||
|
|
||||||
btn = y / 11; // Compute which setting is selected
|
btn = y / SETTING_HEIGHT; // Compute which setting is selected
|
||||||
if (y % 11 > 9) return; // Clicked too low at the setting
|
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
|
if (btn >= page->num) return; // Clicked below the last setting of the page
|
||||||
|
|
||||||
sd = page->entries[btn].setting;
|
sd = page->entries[btn].setting;
|
||||||
|
Loading…
Reference in New Issue
Block a user