Ejemplo n.º 1
0
	virtual void OnClick(Point pt, int widget)
	{
		/* Check which button is clicked */
		if (IsInsideMM(widget, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END + 1)) {
			/* Is it no on disable? */
			if (!this->IsWidgetDisabled(widget)) {
				ChangeToAI((CompanyID)(widget - AID_WIDGET_COMPANY_BUTTON_START));
			}
		}
		if (widget == AID_WIDGET_RELOAD_TOGGLE && !this->IsWidgetDisabled(widget)) {
			/* First kill the company of the AI, then start a new one. This should start the current AI again */
			DoCommandP(0, 2, ai_debug_company, CMD_COMPANY_CTRL);
			DoCommandP(0, 1, ai_debug_company, CMD_COMPANY_CTRL);
		}
	}
Ejemplo n.º 2
0
	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)) {
			/* Is it no on disable? */
			if (!this->IsWidgetDisabled(widget)) {
				ChangeToAI((CompanyID)(widget - AID_WIDGET_COMPANY_BUTTON_START));
			}
		}

		switch (widget) {
			case AID_WIDGET_RELOAD_TOGGLE:
				/* First kill the company of the AI, then start a new one. This should start the current AI again */
				DoCommandP(0, 2 | ai_debug_company << 16, 0, CMD_COMPANY_CTRL);
				DoCommandP(0, 1 | ai_debug_company << 16, 0, CMD_COMPANY_CTRL);
				break;

			case AID_WIDGET_SETTINGS:
				ShowAISettingsWindow(ai_debug_company);
				break;

			case AID_WIDGET_BREAK_STR_ON_OFF_BTN:
				this->break_check_enabled = !this->break_check_enabled;
				this->SetWidgetLoweredState(AID_WIDGET_BREAK_STR_ON_OFF_BTN, this->break_check_enabled);
				this->SetWidgetDirty(AID_WIDGET_BREAK_STR_ON_OFF_BTN);
				break;

			case AID_WIDGET_MATCH_CASE_BTN:
				this->case_sensitive_break_check = !this->case_sensitive_break_check;
				this->SetWidgetLoweredState(AID_WIDGET_MATCH_CASE_BTN, this->case_sensitive_break_check);
				break;

			case AID_WIDGET_CONTINUE_BTN:
				/* Unpause */
				DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE);
				this->DisableWidget(AID_WIDGET_CONTINUE_BTN);
				this->RaiseWidget(AID_WIDGET_CONTINUE_BTN); // Disabled widgets don't raise themself
				break;
		}
	}