OpenTTD Source  13.2.1
rail_gui.h File Reference
#include "rail_type.h"
#include "widgets/dropdown_type.h"

Go to the source code of this file.

Enumerations

enum  SignalGUISettings : uint8 { SIGNAL_GUI_PATH = 0, SIGNAL_GUI_ALL = 1 }
 Settings for which signals are shown by the signal GUI. More...
 
enum  SignalCycleSettings : uint8 { SIGNAL_CYCLE_PATH = 0, SIGNAL_CYCLE_ALL = 1 }
 Settings for which signals are cycled through by control-clicking on the signal with the signal tool. More...
 

Functions

struct WindowShowBuildRailToolbar (RailType railtype)
 Open the build rail toolbar window for a specific rail type. More...
 
void ReinitGuiAfterToggleElrail (bool disable)
 Re-initialize rail-build toolbar after toggling support for electric trains. More...
 
void ResetSignalVariant (int32=0)
 Updates the current signal variant used in the signal GUI to the one adequate to current year. More...
 
void InitializeRailGUI ()
 Resets the rail GUI - sets default railtype to build and resets the signal GUI.
 
DropDownList GetRailTypeDropDownList (bool for_replacement=false, bool all_option=false)
 Create a drop down list for all the rail types of the local company. More...
 

Detailed Description

Functions/types etc. related to the rail GUI.

Definition in file rail_gui.h.

Enumeration Type Documentation

◆ SignalCycleSettings

enum SignalCycleSettings : uint8

Settings for which signals are cycled through by control-clicking on the signal with the signal tool.

Enumerator
SIGNAL_CYCLE_PATH 

Cycle through path signals only.

SIGNAL_CYCLE_ALL 

Cycle through all signals visible.

Definition at line 29 of file rail_gui.h.

◆ SignalGUISettings

enum SignalGUISettings : uint8

Settings for which signals are shown by the signal GUI.

Enumerator
SIGNAL_GUI_PATH 

Show path signals only.

SIGNAL_GUI_ALL 

Show all signals, including block and presignals.

Definition at line 23 of file rail_gui.h.

Function Documentation

◆ GetRailTypeDropDownList()

DropDownList GetRailTypeDropDownList ( bool  for_replacement,
bool  all_option 
)

Create a drop down list for all the rail types of the local company.

Parameters
for_replacementWhether this list is for the replacement window.
all_optionWhether to add an 'all types' item.
Returns
The populated and sorted DropDownList.

Definition at line 2240 of file rail_gui.cpp.

References _local_company, Company::avail_railtypes, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetCompanyRailtypes(), GetRailTypes(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, and INVALID_RAILTYPE.

Referenced by ReplaceVehicleWindow::OnClick().

◆ ReinitGuiAfterToggleElrail()

void ReinitGuiAfterToggleElrail ( bool  disable)

Re-initialize rail-build toolbar after toggling support for electric trains.

Parameters
disableBoolean whether electric trains are disabled (removed from the game)

Definition at line 2143 of file rail_gui.cpp.

Referenced by SettingsDisableElrail().

◆ ResetSignalVariant()

void ResetSignalVariant ( int32  new_value)

Updates the current signal variant used in the signal GUI to the one adequate to current year.

Parameters
new_valueneeded to be called when a setting changes

Definition at line 2207 of file rail_gui.cpp.

References _cur_signal_type, _cur_signal_variant, _cur_year, _settings_client, FindWindowById(), ClientSettings::gui, Window::RaiseWidget(), GUISettings::semaphore_build_before, Window::SetDirty(), SIG_ELECTRIC, SIG_SEMAPHORE, WC_BUILD_SIGNAL, WID_BS_ELECTRIC_NORM, and WID_BS_SEMAPHORE_NORM.

Referenced by ClickChangeDateCheat(), and InitializeRailGUI().

◆ ShowBuildRailToolbar()

struct Window* ShowBuildRailToolbar ( RailType  railtype)

Open the build rail toolbar window for a specific rail type.

If the terraform toolbar is linked to the toolbar, that window is also opened.

Parameters
railtypeRail type to open the window for
Returns
newly opened rail toolbar, or nullptr if the toolbar could not be opened.

Definition at line 857 of file rail_gui.cpp.

References _cur_railtype, _local_company, _remove_button_clicked, CloseWindowByClass(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), ValParamRailtype(), and WC_BUILD_TOOLBAR.