ai_rail.cpp File Reference

Implementation of AIRail. More...

#include "../../stdafx.h"
#include "ai_rail.hpp"
#include "ai_map.hpp"
#include "ai_station.hpp"
#include "ai_industrytype.hpp"
#include "../../debug.h"
#include "../../station_base.h"
#include "../../company_func.h"
#include "../../newgrf.h"
#include "../../newgrf_generic.h"
#include "../../newgrf_station.h"
#include "../../strings_func.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.

Detailed Description

Implementation of AIRail.

Definition in file ai_rail.cpp.


Function Documentation

static uint32 SimulateDrag ( TileIndex  from,
TileIndex  tile,
TileIndex to 
) [static]

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 278 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().


Variable Documentation

Initial value:

List information about the trackdir and number of needed cycles for building signals when entering a track from a specific direction.

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 388 of file ai_rail.cpp.


Generated on Fri Mar 18 23:17:42 2011 for OpenTTD by  doxygen 1.6.1