File diff r10959:4b345c618e31 → r10960:e97ebf9cf99b
src/elrail.cpp
Show inline comments
 
@@ -29,65 +29,54 @@
 
 * Each track ends on two PCPs and thus requires one pylon on each end. However,
 
 * there is one exception: Straight-and-level tracks only have one pylon every
 
 * other tile.
 
 *
 
 * Now on each edge there are two PCPs: One from each adjacent tile. Both PCPs
 
 * are merged using an OR operation (i. e. if one tile needs a PCP at the postion
 
 * in question, both tiles get it).
 
 *
 
 * <h4>Position Points</h4>
 
 * A Pylon Position Point (PPP) is a position where a pylon is located on the
 
 * ground.  Each PCP owns 8 in (45 degree steps) PPPs that are located around
 
 * it. PPPs are represented using the Direction enum. Each track bit has PPPs
 
 * that are impossible (because the pylon would be situated on the track) and
 
 * some that are preferred (because the pylon would be rectangular to the track).
 
 *
 
 * <img src="../../elrail_tile.png">
 
 * <img src="../../elrail_track.png">
 
 *
 
 */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "station_map.h"
 
#include "viewport_func.h"
 
#include "settings_type.h"
 
#include "landscape.h"
 
#include "rail_type.h"
 
#include "debug.h"
 
#include "tunnel_map.h"
 
#include "road_map.h"
 
#include "bridge_map.h"
 
#include "bridge.h"
 
#include "rail_map.h"
 
#include "train.h"
 
#include "rail_gui.h"
 
#include "transparency.h"
 
#include "tunnelbridge_map.h"
 
#include "vehicle_func.h"
 
#include "company_base.h"
 
#include "tunnelbridge.h"
 
#include "engine_func.h"
 
#include "elrail_func.h"
 
#include "engine_base.h"
 

	
 
#include "table/sprites.h"
 
#include "table/elrail_data.h"
 

	
 
static inline TLG GetTLG(TileIndex t)
 
{
 
	return (TLG)((HasBit(TileX(t), 0) << 1) + HasBit(TileY(t), 0));
 
}
 

	
 
/**
 
 * Finds which Electrified Rail Bits are present on a given tile.
 
 * @param t tile to check
 
 * @param override pointer to PCP override, can be NULL
 
 * @return trackbits of tile if it is electrified
 
 */
 
static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
 
{
 
	switch (GetTileType(t)) {
 
		case MP_RAILWAY:
 
			if (!HasCatenary(GetRailType(t))) return TRACK_BIT_NONE;
 
			switch (GetRailTileType(t)) {
 
				case RAIL_TILE_NORMAL: case RAIL_TILE_SIGNALS: