Programmable Signals. More...
#include "stdafx.h"
#include "programmable_signals.h"
#include "debug.h"
#include "command_func.h"
#include "table/strings.h"
#include "window_func.h"
#include "company_func.h"
#include "cmd_helper.h"
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | SignalVM |
Functions | |
static SignalProgram * | GetExistingSignalProgram (SignalReference ref) |
SignalProgram * | GetSignalProgram (SignalReference ref) |
uint16 | GetSignalSpeed (SignalReference ref) |
void | FreeSignalProgram (SignalReference ref) |
void | FreeSignalSpeed (SignalReference ref) |
void | FreeSignalSpeeds () |
void | FreeSignalPrograms () |
SignalState | RunSignalProgram (SignalReference ref, uint num_exits, uint num_green) |
void | RemoveProgramDependencies (SignalReference by, SignalReference on) |
CommandCost | CmdInsertSignalInstruction (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Insert a signal instruction into the signal program. | |
CommandCost | CmdModifySignalInstruction (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Modify a singal instruction. | |
CommandCost | CmdRemoveSignalInstruction (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Remove an instruction from a signal program. | |
CommandCost | CmdSetSignalSpeedLimit (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Set a speed-signal's value. | |
Variables | |
ProgramList | _signal_programs |
SpeedLimits | _speedlimits |
Programmable Signals.
Definition in file programmable_signals.cpp.
CommandCost CmdInsertSignalInstruction | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Insert a signal instruction into the signal program.
tile | The Tile on which to perform the operation. | |
p1 | Flags and information.
| |
p2 | Depends upon instruction.
| |
text | unused. |
Definition at line 489 of file programmable_signals.cpp.
References _current_company, AddTrackToSignalBuffer(), CMD_ERROR, GB(), GetTileOwner(), HasTrack(), InvalidateWindowData(), IsPlainRailTile(), IsTileOwner(), IsValidTrack(), SmallVector< T, S >::Length(), PSO_FIRST, PSO_IF, PSO_IF_ELSE, PSO_IF_ENDIF, PSO_LAST, PSO_SET_SIGNAL, return_cmd_error, and UpdateSignalsInBuffer().
CommandCost CmdModifySignalInstruction | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Modify a singal instruction.
tile | The Tile on which to perform the operation. | |
p1 | Flags and information.
| |
p2 | Depends upon instruction.
| |
text | unused. |
Definition at line 569 of file programmable_signals.cpp.
References _current_company, AddTrackToSignalBuffer(), CMD_ERROR, SignalIf::condition, GB(), GetTileOwner(), HasSignalOnTrackdir(), HasTrack(), INVALID_TILE, INVALID_TRACKDIR, InvalidateWindowData(), IsPlainRailTile(), IsTileOwner(), IsValidTile(), IsValidTrack(), IsValidTrackdir(), SmallVector< T, S >::Length(), PSC_ALWAYS, PSC_NEVER, PSC_NUM_GREEN, PSC_NUM_RED, PSC_SIGNAL_STATE, PSO_FIRST, PSO_IF, PSO_IF_ELSE, PSO_IF_ENDIF, PSO_LAST, PSO_SET_SIGNAL, return_cmd_error, SCF_COMPARATOR, SCF_VALUE, SignalIf::SetCondition(), and UpdateSignalsInBuffer().
CommandCost CmdRemoveSignalInstruction | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Remove an instruction from a signal program.
tile | The Tile on which to perform the operation. | |
p1 | Flags and information.
| |
p2 | unused. | |
text | unused. |
Definition at line 699 of file programmable_signals.cpp.
References _current_company, AddTrackToSignalBuffer(), CMD_ERROR, GB(), GetTileOwner(), HasTrack(), InvalidateWindowData(), IsPlainRailTile(), IsTileOwner(), IsValidTrack(), SmallVector< T, S >::Length(), PSO_FIRST, PSO_IF, PSO_IF_ELSE, PSO_IF_ENDIF, PSO_LAST, PSO_SET_SIGNAL, return_cmd_error, and UpdateSignalsInBuffer().
CommandCost CmdSetSignalSpeedLimit | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Set a speed-signal's value.
tile | The Tile on which to perform the operation | |
p1 | Flags and information
| |
p2 | the value to set | |
text | unused |
Definition at line 755 of file programmable_signals.cpp.
References _current_company, AddTrackToSignalBuffer(), CMD_ERROR, GetTileOwner(), HasTrack(), InvalidateWindowData(), IsPlainRailTile(), IsTileOwner(), IsValidTrack(), return_cmd_error, and UpdateSignalsInBuffer().