MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ChangeToScript

Method ChangeToScript

src/script/script_gui.cpp:976–997  ·  view source on GitHub ↗

* Change all settings to select another Script. * @param show_ai The new AI to show. * @param new_window Open the script in a new window. */

Source from the content-addressed store, hash-verified

974 * @param new_window Open the script in a new window.
975 */
976 void ChangeToScript(CompanyID show_script, bool new_window = false)
977 {
978 if (!this->IsValidDebugCompany(show_script)) return;
979
980 if (new_window) {
981 ScriptDebugWindow::initial_state = this->filter;
982 ShowScriptDebugWindow(show_script, true);
983 return;
984 }
985
986 this->filter.script_debug_company = show_script;
987
988 this->highlight_row = -1; // The highlight of one Script make little sense for another Script.
989
990 /* Close AI settings window to prevent confusion */
991 CloseWindowByClass(WC_SCRIPT_SETTINGS);
992
993 this->InvalidateData(-1);
994
995 this->autoscroll = true;
996 this->last_vscroll_pos = this->vscroll->GetPosition();
997 }
998
999 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
1000 {

Callers 4

ScriptDebugWindowMethod · 0.95
OnClickMethod · 0.95
ShowScriptDebugWindowFunction · 0.80

Calls 5

IsValidDebugCompanyMethod · 0.95
ShowScriptDebugWindowFunction · 0.85
CloseWindowByClassFunction · 0.85
GetPositionMethod · 0.80
InvalidateDataMethod · 0.45

Tested by

no test coverage detected