File diff r11518:6c02f3322c23 → r11519:80d5a7e0eeb8
src/ai/ai_gui.cpp
Show inline comments
 
@@ -158,25 +158,25 @@ struct AIListWindow : public Window {
 
			case AIL_WIDGET_LIST: {
 
				int sel = (pt.y - this->widget[AIL_WIDGET_LIST].top) / 14 + this->vscroll.pos - 1;
 
				if (sel < (int)this->ai_info_list->size()) {
 
					this->selected = sel;
 
					this->ChangeAI();
 
					delete this;
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		if (delta.x != 0) {
 
			ResizeButtons(this, AIL_WIDGET_ACCEPT, AIL_WIDGET_CANCEL);
 
		}
 

	
 
		this->vscroll.cap += delta.y / 14;
 
		SetVScrollCount(this, (int)this->ai_info_list->size() + 1);
 
		this->widget[AIL_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1;
 
	}
 
};
 

	
 
/* Widget definition for the ai list window. */
 
@@ -356,25 +356,25 @@ struct AISettingsWindow : public Window 
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (StrEmpty(str)) return;
 
		AIConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
 
		for (int i = 0; i < this->clicked_row; i++) it++;
 
		int32 value = atoi(str);
 
		this->ai_config->SetSetting((*it).name, value);
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		if (delta.x != 0) {
 
			ResizeButtons(this, AIS_WIDGET_ACCEPT, AIS_WIDGET_RESET);
 
		}
 

	
 
		this->vscroll.cap += delta.y / 14;
 
		this->widget[AIS_WIDGET_BACKGROUND].data = (this->vscroll.cap << 8) + 1;
 
	}
 

	
 
	virtual void OnTick()
 
	{
 
		if (--this->timeout == 0) {
 
@@ -579,25 +579,25 @@ 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 OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.cap += delta.y / 14;
 
		this->widget[AIC_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1;
 
	}
 

	
 
	virtual void OnTick()
 
	{
 
		if (--this->timeout == 0) {
 
			this->clicked_button = false;
 
			this->SetDirty();
 
		}
 
	}
 
@@ -768,25 +768,25 @@ struct AIDebugWindow : public Window {
 

	
 
	virtual void OnTimeout()
 
	{
 
		this->RaiseWidget(AID_WIDGET_RELOAD_TOGGLE);
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	{
 
		if (data == -1 || ai_debug_company == data) this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.cap += delta.y / (int)this->resize.step_height;
 
	}
 
};
 

	
 
CompanyID AIDebugWindow::ai_debug_company = INVALID_COMPANY;
 

	
 
static const Widget _ai_debug_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},                 // AID_WIDGET_CLOSEBOX
 
{    WWT_CAPTION,  RESIZE_RIGHT,  COLOUR_GREY,    11,   298,     0,    13, STR_AI_DEBUG,               STR_018C_WINDOW_TITLE_DRAG_THIS},       // AID_WIDGET_CAPTION
 
{      WWT_PANEL,  RESIZE_RIGHT,  COLOUR_GREY,     0,   298,    14,    40, 0x0,                        STR_NULL},                              // AID_WIDGET_VIEW