OpenTTD
|
Window for configuring the AIs More...
#include "../stdafx.h"
#include "../table/sprites.h"
#include "../error.h"
#include "../settings_gui.h"
#include "../querystring_gui.h"
#include "../stringfilter_type.h"
#include "../company_base.h"
#include "../company_gui.h"
#include "../strings_func.h"
#include "../window_func.h"
#include "../gfx_func.h"
#include "../command_func.h"
#include "../network/network.h"
#include "../settings_func.h"
#include "../network/network_content.h"
#include "../textfile_gui.h"
#include "../widgets/dropdown_type.h"
#include "../widgets/dropdown_func.h"
#include "../hotkeys.h"
#include "../core/geometry_func.hpp"
#include "ai.hpp"
#include "ai_gui.hpp"
#include "../script/api/script_log.hpp"
#include "ai_config.hpp"
#include "ai_info.hpp"
#include "ai_instance.hpp"
#include "../game/game.hpp"
#include "../game/game_config.hpp"
#include "../game/game_info.hpp"
#include "../game/game_instance.hpp"
#include "table/strings.h"
#include <vector>
#include "../safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | AIListWindow |
Window that let you choose an available AI. More... | |
struct | AISettingsWindow |
Window for settings the parameters of an AI. More... | |
struct | ScriptTextfileWindow |
Window for displaying the textfile of a AI. More... | |
struct | AIConfigWindow |
Window to configure which AIs will start. More... | |
struct | AIDebugWindow |
Window with everything an AI prints via ScriptLog. More... | |
Functions | |
static ScriptConfig * | GetConfig (CompanyID slot) |
static void | ShowAIListWindow (CompanyID slot) |
Open the AI list window to chose an AI for the given company slot. More... | |
static void | ShowAISettingsWindow (CompanyID slot) |
Open the AI settings window to change the AI settings for an AI. More... | |
void | ShowScriptTextfileWindow (TextfileType file_type, CompanyID slot) |
Open the AI version of the textfile window. More... | |
void | ShowAIConfigWindow () |
Open the AI config window. More... | |
static bool | SetScriptButtonColour (NWidgetCore &button, bool dead, bool paused) |
Set the widget colour of a button based on the state of the script. More... | |
NWidgetBase * | MakeCompanyButtonRowsAIDebug (int *biggest_index) |
Make a number of rows with buttons for each company for the AI debug window. More... | |
static EventState | AIDebugGlobalHotkeys (int hotkey) |
Handler for global hotkeys of the AIDebugWindow. More... | |
Window * | ShowAIDebugWindow (CompanyID show_company) |
Open the AI debug window and select the given company. More... | |
void | InitializeAIGui () |
Reset the AI windows to their initial state. | |
void | ShowAIDebugWindowIfAIError () |
Open the AI debug window if one of the AI scripts has crashed. More... | |
Variables | |
static const NWidgetPart | _nested_ai_list_widgets [] |
Widgets for the AI list window. More... | |
static WindowDesc | _ai_list_desc (WDP_CENTER, "settings_script_list", 200, 234, WC_AI_LIST, WC_NONE, 0, _nested_ai_list_widgets, lengthof(_nested_ai_list_widgets)) |
Window definition for the ai list window. More... | |
static const NWidgetPart | _nested_ai_settings_widgets [] |
Widgets for the AI settings window. More... | |
static WindowDesc | _ai_settings_desc (WDP_CENTER, "settings_script", 500, 208, WC_AI_SETTINGS, WC_NONE, 0, _nested_ai_settings_widgets, lengthof(_nested_ai_settings_widgets)) |
Window definition for the AI settings window. More... | |
static const NWidgetPart | _nested_ai_config_widgets [] |
Widgets for the configure AI window. More... | |
static WindowDesc | _ai_config_desc (WDP_CENTER, "settings_script_config", 0, 0, WC_GAME_OPTIONS, WC_NONE, 0, _nested_ai_config_widgets, lengthof(_nested_ai_config_widgets)) |
Window definition for the configure AI window. More... | |
static Hotkey | aidebug_hotkeys [] |
static const NWidgetPart | _nested_ai_debug_widgets [] |
Widgets for the AI debug window. More... | |
static WindowDesc | _ai_debug_desc (WDP_AUTO, "script_debug", 600, 450, WC_AI_DEBUG, WC_NONE, 0, _nested_ai_debug_widgets, lengthof(_nested_ai_debug_widgets), &AIDebugWindow::hotkeys) |
Window definition for the AI debug window. More... | |
Window for configuring the AIs
Definition in file ai_gui.cpp.
|
static |
Handler for global hotkeys of the AIDebugWindow.
hotkey | Hotkey |
Definition at line 1430 of file ai_gui.cpp.
NWidgetBase* MakeCompanyButtonRowsAIDebug | ( | int * | biggest_index | ) |
Make a number of rows with buttons for each company for the AI debug window.
Definition at line 1420 of file ai_gui.cpp.
References MakeCompanyButtonRows(), WID_AID_COMPANY_BUTTON_END, and WID_AID_COMPANY_BUTTON_START.
|
static |
Set the widget colour of a button based on the state of the script.
(dead or alive)
button | the button to update. |
dead | true if the script is dead, otherwise false. |
paused | true if the script is paused, otherwise false. |
Definition at line 972 of file ai_gui.cpp.
Referenced by AIDebugWindow::OnPaint().
void ShowAIConfigWindow | ( | ) |
Open the AI config window.
Definition at line 958 of file ai_gui.cpp.
References DeleteWindowByClass(), and WC_GAME_OPTIONS.
Open the AI debug window and select the given company.
show_company | Display debug information about this AI company. |
Definition at line 1523 of file ai_gui.cpp.
References _network_server, _networking, BringWindowToFrontById(), AIDebugWindow::ChangeToAI(), INVALID_COMPANY, INVALID_STRING_ID, ShowErrorMessage(), WC_AI_DEBUG, and WL_INFO.
Referenced by AIInstance::Died(), and GameInstance::Died().
void ShowAIDebugWindowIfAIError | ( | ) |
Open the AI debug window if one of the AI scripts has crashed.
Definition at line 1546 of file ai_gui.cpp.
References _network_server, and _networking.
|
static |
Open the AI list window to chose an AI for the given company slot.
slot | The slot to change the AI of. |
Definition at line 273 of file ai_gui.cpp.
References AIListWindow::AIListWindow(), DeleteWindowByClass(), and WC_AI_LIST.
|
static |
Open the AI settings window to change the AI settings for an AI.
slot | The CompanyID of the AI to change the settings. |
Definition at line 622 of file ai_gui.cpp.
References DeleteWindowByClass(), WC_AI_LIST, and WC_AI_SETTINGS.
Referenced by AIDebugWindow::OnClick().
void ShowScriptTextfileWindow | ( | TextfileType | file_type, |
CompanyID | slot | ||
) |
Open the AI version of the textfile window.
file_type | The type of textfile to display. |
slot | The slot the Script is using. |
Definition at line 654 of file ai_gui.cpp.
References DeleteWindowByClass(), and WC_TEXTFILE.
|
static |
|
static |
|
static |
Window definition for the ai list window.
|
static |
|
static |
Widgets for the configure AI window.
Definition at line 662 of file ai_gui.cpp.
|
static |
Widgets for the AI debug window.
Definition at line 1466 of file ai_gui.cpp.
|
static |
Widgets for the AI list window.
Definition at line 240 of file ai_gui.cpp.
|
static |
Widgets for the AI settings window.
Definition at line 591 of file ai_gui.cpp.
|
static |
Definition at line 1438 of file ai_gui.cpp.