* 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. */
| 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 | { |
no test coverage detected