OpenTTD Source
20241108-master-g80f628063a
|
Window for configuring the Scripts 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 "../dropdown_type.h"
#include "../dropdown_func.h"
#include "../window_func.h"
#include "../network/network.h"
#include "../hotkeys.h"
#include "../company_cmd.h"
#include "../misc_cmd.h"
#include "../timer/timer.h"
#include "../timer/timer_window.h"
#include "script_gui.h"
#include "script_log.hpp"
#include "script_scanner.hpp"
#include "script_config.hpp"
#include "../ai/ai.hpp"
#include "../ai/ai_config.hpp"
#include "../ai/ai_info.hpp"
#include "../ai/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 "../safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | ScriptListWindow |
Window that let you choose an available Script. More... | |
struct | ScriptSettingsWindow |
Window for settings the parameters of an AI. More... | |
struct | ScriptTextfileWindow |
Window for displaying the textfile of a AI. More... | |
struct | ScriptDebugWindow |
Window with everything an AI prints via ScriptLog. More... | |
struct | ScriptDebugWindow::FilterState |
Functions | |
static ScriptConfig * | GetConfig (CompanyID slot) |
void | ShowScriptListWindow (CompanyID slot, bool show_all) |
Open the Script list window to chose a script for the given company slot. More... | |
void | ShowScriptSettingsWindow (CompanyID slot) |
Open the Script settings window to change the Script settings for a Script. More... | |
void | ShowScriptTextfileWindow (TextfileType file_type, CompanyID slot) |
Open the Script version of the textfile 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... | |
std::unique_ptr< NWidgetBase > | MakeCompanyButtonRowsScriptDebug () |
Make a number of rows with buttons for each company for the Script debug window. | |
Window * | ShowScriptDebugWindow (CompanyID show_company, bool new_window) |
Open the Script debug window and select the given company. More... | |
void | InitializeScriptGui () |
Reset the Script windows to their initial state. | |
void | ShowScriptDebugWindowIfScriptError () |
Open the AI debug window if one of the AI scripts has crashed. | |
Variables | |
static constexpr NWidgetPart | _nested_script_list_widgets [] |
Widgets for the AI list window. More... | |
static WindowDesc | _script_list_desc (WDP_CENTER, "settings_script_list", 200, 234, WC_SCRIPT_LIST, WC_NONE, 0, _nested_script_list_widgets) |
Window definition for the ai list window. | |
static constexpr NWidgetPart | _nested_script_settings_widgets [] |
Widgets for the Script settings window. More... | |
static WindowDesc | _script_settings_desc (WDP_CENTER, "settings_script", 500, 208, WC_SCRIPT_SETTINGS, WC_NONE, 0, _nested_script_settings_widgets) |
Window definition for the Script settings window. | |
static constexpr NWidgetPart | _nested_script_debug_widgets [] |
Widgets for the Script debug window. | |
static WindowDesc | _script_debug_desc (WDP_AUTO, "script_debug", 600, 450, WC_SCRIPT_DEBUG, WC_NONE, 0, _nested_script_debug_widgets, &ScriptDebugWindow::hotkeys) |
Window definition for the Script debug window. | |
Window for configuring the Scripts
Definition in file script_gui.cpp.
|
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 676 of file script_gui.cpp.
Referenced by ScriptDebugWindow::UpdateAIButtonsState(), and ScriptDebugWindow::UpdateGSButtonState().
Open the Script debug window and select the given company.
show_company | Display debug information about this AI company. |
new_window | Show in new window instead of existing window. |
Definition at line 1303 of file script_gui.cpp.
References _network_server, _networking, _script_debug_desc, BringWindowToFrontById(), ScriptDebugWindow::ChangeToScript(), FindWindowByClass(), FindWindowById(), INVALID_STRING_ID, ScriptDebugWindow::FilterState::script_debug_company, ShowErrorMessage(), WC_SCRIPT_DEBUG, Window::window_class, Window::window_number, and WL_INFO.
Referenced by ScriptDebugWindow::ChangeToScript(), and ShowScriptDebugWindowIfScriptError().
void ShowScriptListWindow | ( | CompanyID | slot, |
bool | show_all | ||
) |
Open the Script list window to chose a script for the given company slot.
slot | The slot to change the script of. |
show_all | Whether to show all available versions. |
Definition at line 277 of file script_gui.cpp.
References _script_list_desc, CloseWindowByClass(), and WC_SCRIPT_LIST.
void ShowScriptSettingsWindow | ( | CompanyID | slot | ) |
Open the Script settings window to change the Script settings for a Script.
slot | The CompanyID of the Script to change the settings. |
Definition at line 619 of file script_gui.cpp.
References _script_settings_desc, CloseWindowByClass(), WC_SCRIPT_LIST, and WC_SCRIPT_SETTINGS.
void ShowScriptTextfileWindow | ( | TextfileType | file_type, |
CompanyID | slot | ||
) |
Open the Script version of the textfile window.
file_type | The type of textfile to display. |
slot | The slot the Script is using. |
Definition at line 661 of file script_gui.cpp.
References CloseWindowById(), and WC_TEXTFILE.
|
staticconstexpr |
Widgets for the AI list window.
Definition at line 243 of file script_gui.cpp.
|
staticconstexpr |
Widgets for the Script settings window.
Definition at line 588 of file script_gui.cpp.