mirror of https://github.com/OpenTTD/OpenTTD.git
Cleanup: Vector supports random access.
This commit is contained in:
parent
6d1586dd49
commit
68782f951b
|
@ -271,9 +271,7 @@ struct GSConfigWindow : public Window {
|
|||
int num = (pt.y - r.top) / this->line_height + this->vscroll->GetPosition();
|
||||
if (num >= (int)this->visible_settings.size()) break;
|
||||
|
||||
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
|
||||
for (int i = 0; i < num; i++) it++;
|
||||
const ScriptConfigItem config_item = **it;
|
||||
const ScriptConfigItem &config_item = *this->visible_settings[num];
|
||||
if (!this->IsEditableItem(config_item)) return;
|
||||
|
||||
if (this->clicked_row != num) {
|
||||
|
@ -423,9 +421,7 @@ private:
|
|||
|
||||
void SetValue(int value)
|
||||
{
|
||||
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
|
||||
for (int i = 0; i < this->clicked_row; i++) it++;
|
||||
const ScriptConfigItem config_item = **it;
|
||||
const ScriptConfigItem &config_item = *this->visible_settings[this->clicked_row];
|
||||
if (_game_mode == GM_NORMAL && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
|
||||
this->gs_config->SetSetting(config_item.name, value);
|
||||
this->SetDirty();
|
||||
|
|
|
@ -429,9 +429,7 @@ struct ScriptSettingsWindow : public Window {
|
|||
int num = (pt.y - r.top) / this->line_height + this->vscroll->GetPosition();
|
||||
if (num >= (int)this->visible_settings.size()) break;
|
||||
|
||||
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
|
||||
for (int i = 0; i < num; i++) it++;
|
||||
const ScriptConfigItem &config_item = **it;
|
||||
const ScriptConfigItem &config_item = *this->visible_settings[num];
|
||||
if (!this->IsEditableItem(config_item)) return;
|
||||
|
||||
if (this->clicked_row != num) {
|
||||
|
@ -577,9 +575,7 @@ private:
|
|||
|
||||
void SetValue(int value)
|
||||
{
|
||||
VisibleSettingsList::const_iterator it = this->visible_settings.begin();
|
||||
for (int i = 0; i < this->clicked_row; i++) it++;
|
||||
const ScriptConfigItem &config_item = **it;
|
||||
const ScriptConfigItem &config_item = *this->visible_settings[this->clicked_row];
|
||||
if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
|
||||
this->script_config->SetSetting(config_item.name, value);
|
||||
this->SetDirty();
|
||||
|
|
Loading…
Reference in New Issue