#include "ai_rail.hpp"
#include "ai_map.hpp"
#include "ai_station.hpp"
#include "../../debug.h"
#include "../../station_map.h"
#include "../../company_func.h"
#include "../../waypoint.h"
#include "../../newgrf_generic.h"
#include "../../newgrf_station.h"
Go to the source code of this file.
Data Structures | |
struct | AIRailSignalData |
Contains information about the trackdir that belongs to a track when entering from a specific direction. More... | |
Functions | |
static uint32 | SimulateDrag (TileIndex from, TileIndex tile, TileIndex *to) |
Prepare the second parameter for CmdBuildRailroadTrack and CmdRemoveRailroadTrack. | |
static bool | IsValidSignalType (int signal_type) |
Check if signal_type is a valid SignalType. | |
Variables | |
static const int | NUM_TRACK_DIRECTIONS = 3 |
The number of directions you can go when entering a tile. | |
static const AIRailSignalData | _possible_trackdirs [5][NUM_TRACK_DIRECTIONS] |
List information about the trackdir and number of needed cycles for building signals when entering a track from a specific direction. |
Definition in file ai_rail.cpp.
Prepare the second parameter for CmdBuildRailroadTrack and CmdRemoveRailroadTrack.
The direction depends on all three tiles. Sometimes the third tile needs to be adjusted.
Definition at line 255 of file ai_rail.cpp.
References abs(), Clamp(), AIRail::GetCurrentRailType(), MapSizeX(), TileX(), TileY(), TRACK_LEFT, TRACK_LOWER, TRACK_RIGHT, TRACK_UPPER, TRACK_X, and TRACK_Y.
Referenced by AIRail::BuildRail(), and AIRail::RemoveRail().
const AIRailSignalData _possible_trackdirs[5][NUM_TRACK_DIRECTIONS] [static] |
Initial value:
{ {{TRACK_UPPER, TRACKDIR_UPPER_E, 0}, {TRACK_Y, TRACKDIR_Y_SE, 0}, {TRACK_LEFT, TRACKDIR_LEFT_S, 1}}, {{TRACK_RIGHT, TRACKDIR_RIGHT_S, 1}, {TRACK_X, TRACKDIR_X_SW, 1}, {TRACK_UPPER, TRACKDIR_UPPER_W, 1}}, {{INVALID_TRACK, INVALID_TRACKDIR, 0}, {INVALID_TRACK, INVALID_TRACKDIR, 0}, {INVALID_TRACK, INVALID_TRACKDIR, 0}}, {{TRACK_LOWER, TRACKDIR_LOWER_E, 0}, {TRACK_X, TRACKDIR_X_NE, 0}, {TRACK_LEFT, TRACKDIR_LEFT_N, 0}}, {{TRACK_RIGHT, TRACKDIR_RIGHT_N, 0}, {TRACK_Y, TRACKDIR_Y_NW, 1}, {TRACK_LOWER, TRACKDIR_LOWER_W, 1}} }
The first index is the difference between the TileIndex of the previous and current tile, where (-)MapSizeX is replaced with -2 / 2 and 2 it added.
Definition at line 365 of file ai_rail.cpp.