summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-01-30 18:34:48 +0000
committerfrosch <frosch@openttd.org>2010-01-30 18:34:48 +0000
commit88019e64e1de6966c9cfe26beda537664332d7ec (patch)
tree4e907f0b62170a086d3297d50ff5743cacb4491c /src/ai
parent2f6fe85f23256a116cb4e85606c8714d8fc8a399 (diff)
downloadopenttd-88019e64e1de6966c9cfe26beda537664332d7ec.tar.xz
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_gui.cpp38
1 files changed, 9 insertions, 29 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index cb1381a36..33286f500 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -149,7 +149,7 @@ struct AIListWindow : public Window {
SetWindowDirty(WC_GAME_OPTIONS, 0);
}
- virtual void OnClick(Point pt, int widget)
+ virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
case AIL_WIDGET_LIST: { // Select one of the AIs
@@ -157,6 +157,10 @@ struct AIListWindow : public Window {
if (sel < (int)this->ai_info_list->size()) {
this->selected = sel;
this->SetDirty();
+ if (click_count > 1) {
+ this->ChangeAI();
+ delete this;
+ }
}
break;
}
@@ -173,21 +177,6 @@ struct AIListWindow : public Window {
}
}
- virtual void OnDoubleClick(Point pt, int widget)
- {
- switch (widget) {
- case AIL_WIDGET_LIST: {
- int sel = (pt.y - this->GetWidget<NWidgetBase>(AIL_WIDGET_LIST)->pos_y) / this->line_height + this->vscroll.GetPosition() - 1;
- if (sel < (int)this->ai_info_list->size()) {
- this->selected = sel;
- this->ChangeAI();
- delete this;
- }
- break;
- }
- }
- }
-
virtual void OnResize()
{
NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST);
@@ -332,7 +321,7 @@ struct AISettingsWindow : public Window {
}
}
- virtual void OnClick(Point pt, int widget)
+ virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
case AIS_WIDGET_BACKGROUND: {
@@ -588,7 +577,7 @@ struct AIConfigWindow : public Window {
}
}
- virtual void OnClick(Point pt, int widget)
+ virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
case AIC_WIDGET_DECREASE:
@@ -607,6 +596,7 @@ struct AIConfigWindow : public Window {
case AIC_WIDGET_LIST: { // Select a slot
this->selected_slot = (CompanyID)((pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / this->line_height + this->vscroll.GetPosition());
this->InvalidateData();
+ if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
break;
}
@@ -652,16 +642,6 @@ struct AIConfigWindow : public Window {
}
}
- virtual void OnDoubleClick(Point pt, int widget)
- {
- switch (widget) {
- case AIC_WIDGET_LIST:
- this->OnClick(pt, widget);
- if (this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
- break;
- }
- }
-
virtual void OnInvalidateData(int data)
{
if (this->selected_slot == 0 || this->selected_slot > _settings_newgame.difficulty.max_no_competitors) {
@@ -911,7 +891,7 @@ struct AIDebugWindow : public Window {
DeleteWindowByClass(WC_AI_SETTINGS);
}
- virtual void OnClick(Point pt, int widget)
+ virtual void OnClick(Point pt, int widget, int click_count)
{
/* Check which button is clicked */
if (IsInsideMM(widget, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END + 1)) {