File diff r17475:4f9f7a996b1b → r17476:d3b7a183536d
src/ai/ai_gui.cpp
Show inline comments
 
@@ -179,14 +179,20 @@ struct AIListWindow : public Window {
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST);
 
		this->vscroll->SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
 
			delete this;
 
			return;
 
		}
 

	
 
		this->vscroll->SetCount((int)this->ai_info_list->size() + 1);
 
@@ -434,14 +440,20 @@ struct AISettingsWindow : public Window 
 
		if (--this->timeout == 0) {
 
			this->clicked_button = -1;
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) delete this;
 
	}
 
};
 

	
 
/** Widgets for the AI settings window. */
 
static const NWidgetPart _nested_ai_settings_widgets[] = {
 
@@ -689,14 +701,20 @@ struct AIConfigWindow : public Window {
 
#endif
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (!IsEditable(this->selected_slot)) {
 
			this->selected_slot = INVALID_COMPANY;
 
		}
 

	
 
		this->SetWidgetDisabledState(AIC_WIDGET_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
 
		this->SetWidgetDisabledState(AIC_WIDGET_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
 
@@ -1029,14 +1047,20 @@ struct AIDebugWindow : public QueryStrin
 
			/* Save the current string to static member so it can be restored next time the window is opened */
 
			strecpy(this->break_string, this->edit_str_buf, lastof(this->break_string));
 
		}
 
		return state;
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == -1 || ai_debug_company == data) this->SetDirty();
 

	
 
		if (data == -2) {
 
			/* The continue button should be disabled when the game is unpaused and
 
			 * it was previously paused by the break string ( = a line in the log
 
			 * was highlighted )*/