Changeset - r8144:1432edd15267
[Not reviewed]
master
! ! !
rubidium - 17 years ago 2007-12-27 13:35:39
rubidium@openttd.org
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
83 files changed with 959 insertions and 927 deletions:
0 comments (0 inline, 0 general)
src/ai/default/default.cpp
Show inline comments
 
@@ -3,38 +3,38 @@
 
#include "../../stdafx.h"
 
#include "../../openttd.h"
 
#include "../../aircraft.h"
 
#include "../../bridge_map.h"
 
#include "../../tile_cmd.h"
 
#include "../../landscape.h"
 
#include "../../rail_map.h"
 
#include "../../road_map.h"
 
#include "../../roadveh.h"
 
#include "../../station_map.h"
 
#include "../../player.h"
 
#include "../../tunnel_map.h"
 
#include "../../vehicle.h"
 
#include "../../engine.h"
 
#include "../../command_func.h"
 
#include "../../town.h"
 
#include "../../industry.h"
 
#include "../../station.h"
 
#include "../../pathfind.h"
 
#include "../../airport.h"
 
#include "../../depot.h"
 
#include "../../variables.h"
 
#include "../../bridge.h"
 
#include "../../date_func.h"
 
#include "../../tunnelbridge_map.h"
 
#include "../../window_func.h"
 
#include "../../vehicle_func.h"
 
#include "../../functions.h"
 
#include "default.h"
 

	
 

	
 
// remove some day perhaps?
 
static uint _ai_service_interval;
 

	
 
typedef void AiStateAction(Player *p);
 

	
 
enum {
 
	AIS_0                            =  0,
 
	AIS_1                            =  1,
src/ai/trolly/build.cpp
Show inline comments
 
/* $Id$ */
 

	
 
#include "../../stdafx.h"
 
#include "../../openttd.h"
 
#include "../../debug.h"
 
#include "../../road_map.h"
 
#include "../../vehicle.h"
 
#include "../../command_func.h"
 
#include "trolly.h"
 
#include "../../engine.h"
 
#include "../../station.h"
 
#include "../../variables.h"
 
#include "../../bridge.h"
 
#include "../../vehicle_func.h"
 
#include "../../vehicle_base.h"
 
#include "../ai.h"
 

	
 
// Build HQ
 
//  Params:
 
//    tile : tile where HQ is going to be build
 
bool AiNew_Build_CompanyHQ(Player *p, TileIndex tile)
 
{
 
	if (CmdFailed(AI_DoCommand(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_BUILD_COMPANY_HQ)))
 
		return false;
 
	AI_DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_BUILD_COMPANY_HQ);
 
	return true;
 
}
src/ai/trolly/shared.cpp
Show inline comments
 
/* $Id$ */
 

	
 
#include "../../stdafx.h"
 
#include "../../openttd.h"
 
#include "../../debug.h"
 
#include "../../map_func.h"
 
#include "../../vehicle_base.h"
 
#include "trolly.h"
 
#include "../../vehicle.h"
 

	
 
int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c)
 
{
 
	// 0 = vert
 
	// 1 = horz
 
	// 2 = dig up-left
 
	// 3 = dig down-right
 
	// 4 = dig down-left
 
	// 5 = dig up-right
 

	
 
	uint x1 = TileX(tile_a);
 
	uint x2 = TileX(tile_b);
src/ai/trolly/trolly.cpp
Show inline comments
 
@@ -22,25 +22,26 @@
 
#include "../../debug.h"
 
#include "../../road_map.h"
 
#include "../../station_map.h"
 
#include "table/strings.h"
 
#include "../../command_func.h"
 
#include "trolly.h"
 
#include "../../town.h"
 
#include "../../industry.h"
 
#include "../../station.h"
 
#include "../../engine.h"
 
#include "../../gui.h"
 
#include "../../depot.h"
 
#include "../../vehicle.h"
 
#include "../../vehicle_base.h"
 
#include "../../vehicle_func.h"
 
#include "../../date_func.h"
 
#include "../ai.h"
 
#include "../../order.h"
 

	
 
// This function is called after StartUp. It is the init of an AI
 
static void AiNew_State_FirstTime(Player *p)
 
{
 
	// This assert is used to protect those function from misuse
 
	//   You have quickly a small mistake in the state-array
 
	//   With that, everything would go wrong. Finding that, is almost impossible
 
	//   With this assert, that problem can never happen.
 
	assert(p->ainew.state == AI_STATE_FIRST_TIME);
src/aircraft.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file aircraft.h */
 

	
 
#ifndef AIRCRAFT_H
 
#define AIRCRAFT_H
 

	
 
#include "station_map.h"
 
#include "vehicle.h"
 
#include "vehicle_base.h"
 
#include "engine.h"
 
#include "variables.h"
 

	
 
/** An aircraft can be one ot those types */
 
enum AircraftSubType {
 
	AIR_HELICOPTER = 0, ///< an helicopter
 
	AIR_AIRCRAFT   = 2, ///< an airplane
 
	AIR_SHADOW     = 4, ///< shadow of the aircraft
 
	AIR_ROTOR      = 6  ///< rotor of an helicopter
 
};
 

	
 

	
src/aircraft_cmd.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file aircraft_cmd.cpp
 
 * This file deals with aircraft and airport movements functionalities */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "aircraft.h"
 
#include "debug.h"
 
#include "landscape.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "depot.h"
 
#include "engine.h"
 
#include "station.h"
 
#include "news.h"
 
#include "sound.h"
 
#include "player.h"
 
#include "aircraft.h"
 
#include "airport.h"
 
#include "vehicle_gui.h"
 
#include "table/sprites.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_text.h"
 
#include "newgrf_sound.h"
 
#include "spritecache.h"
 
#include "cargotype.h"
 
#include "strings_func.h"
 
#include "command_func.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 
#include "functions.h"
 

	
 
void Aircraft::UpdateDeltaXY(Direction direction)
 
{
 
	uint32 x;
 
#define MKIT(a, b, c, d) ((a & 0xFF) << 24) | ((b & 0xFF) << 16) | ((c & 0xFF) << 8) | ((d & 0xFF) << 0)
 
	switch (this->subtype) {
 
		default: NOT_REACHED();
 
		case AIR_AIRCRAFT:
 
		case AIR_HELICOPTER:
 
			switch (this->u.air.state) {
 
				case ENDTAKEOFF:
src/aircraft_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file aircraft_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "aircraft.h"
 
#include "debug.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "vehicle.h"
 
#include "engine.h"
 
#include "viewport.h"
 
#include "player.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 

	
 
/**
 
* Draw the details for the given vehicle at the position (x,y)
 
*
 
* @param v current vehicle
 
* @param x The x coordinate
 
* @param y The y coordinate
 
*/
 
void DrawAircraftDetails(const Vehicle *v, int x, int y)
 
{
 
	int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
 

	
src/airport_gui.cpp
Show inline comments
 
@@ -3,25 +3,24 @@
 
/** @file airport_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "window_gui.h"
 
#include "gui.h"
 
#include "station_gui.h"
 
#include "viewport.h"
 
#include "sound.h"
 
#include "command_func.h"
 
#include "vehicle.h"
 
#include "station.h"
 
#include "airport.h"
 
#include "depot.h"
 
#include "window_func.h"
 

	
 
static byte _selected_airport_type;
 

	
 
static void ShowBuildAirportPicker();
 

	
 

	
 
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
src/articulated_vehicles.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file articulated_vehicles.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "vehicle.h"
 
#include "articulated_vehicles.h"
 
#include "engine.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_engine.h"
 
#include "vehicle_func.h"
 

	
 

	
 
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
 
{
 
	if (!HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return 0;
 

	
 
	Vehicle *v = NULL;;
 
	if (!purchase_window) {
 
		v = new InvalidVehicle();
 
		v->engine_type = engine_type;
 
	}
 

	
src/articulated_vehicles.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file articulated_vehicles.h */
 

	
 
#ifndef ARTICULATED_VEHICLES_H
 
#define ARTICULATED_VEHICLES_H
 

	
 
#include "vehicle_type.h"
 

	
 
uint CountArticulatedParts(EngineID engine_type, bool purchase_window);
 
void AddArticulatedParts(Vehicle **vl, VehicleType type);
 

	
 
#endif /* ARTICULATED_VEHICLES_H */
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -9,24 +9,25 @@
 
#include "player.h"
 
#include "engine.h"
 
#include "debug.h"
 
#include "vehicle_gui.h"
 
#include "depot.h"
 
#include "train.h"
 
#include "aircraft.h"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "order.h"
 
#include "strings_func.h"
 
#include "command_func.h"
 
#include "vehicle_func.h"
 
#include "functions.h"
 

	
 
/*
 
 * move the cargo from one engine to another if possible
 
 */
 
static void MoveVehicleCargo(Vehicle *dest, Vehicle *source)
 
{
 
	Vehicle *v = dest;
 

	
 
	do {
 
		do {
 
			if (source->cargo_type != dest->cargo_type)
src/autoreplace_gui.cpp
Show inline comments
 
@@ -7,24 +7,25 @@
 
#include "debug.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "command_func.h"
 
#include "variables.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
 
#include "group.h"
 
#include "rail.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 
static RailType _railtype_selected_in_replace_gui;
 

	
 
static bool _rebuild_left_list;
 
static bool _rebuild_right_list;
 

	
 
static const StringID _rail_types_list[] = {
 
	STR_RAIL_VEHICLES,
 
	STR_ELRAIL_VEHICLES,
 
	STR_MONORAIL_VEHICLES,
 
	STR_MAGLEV_VEHICLES,
 
	INVALID_STRING_ID
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -3,41 +3,41 @@
 
/** @file build_vehicle_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "ship.h"
 
#include "aircraft.h"
 
#include "debug.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "vehicle.h"
 
#include "articulated_vehicles.h"
 
#include "textbuf_gui.h"
 
#include "station.h"
 
#include "command_func.h"
 
#include "engine.h"
 
#include "player.h"
 
#include "depot.h"
 
#include "airport.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "road_map.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
enum BuildVehicleWidgets {
 
	BUILD_VEHICLE_WIDGET_CLOSEBOX = 0,
 
	BUILD_VEHICLE_WIDGET_CAPTION,
 
	BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING,
 
	BUILD_VEHICLE_WIDGET_SORT_TEXT,
 
	BUILD_VEHICLE_WIDGET_SORT_DROPDOWN,
 
	BUILD_VEHICLE_WIDGET_LIST,
 
	BUILD_VEHICLE_WIDGET_SCROLLBAR,
 
	BUILD_VEHICLE_WIDGET_PANEL,
 
	BUILD_VEHICLE_WIDGET_BUILD,
src/clear_cmd.cpp
Show inline comments
 
@@ -12,27 +12,27 @@
 
#include "command_func.h"
 
#include "tunnel_map.h"
 
#include "bridge_map.h"
 
#include "bridge.h"
 
#include "landscape.h"
 
#include "variables.h"
 
#include "table/sprites.h"
 
#include "unmovable_map.h"
 
#include "genworld.h"
 
#include "industry.h"
 
#include "water_map.h"
 
#include "tile_cmd.h"
 
#include "vehicle.h"
 
#include "functions.h"
 
#include "economy_func.h"
 
#include "vehicle_func.h"
 

	
 
/*
 
 * In one terraforming command all four corners of a initial tile can be raised/lowered (though this is not available to the player).
 
 * The maximal amount of height modifications is archieved when raising a complete flat land from sea level to MAX_TILE_HEIGHT or vice versa.
 
 * This affects all corners with a manhatten distance smaller than MAX_TILE_HEIGHT to one of the initial 4 corners.
 
 * Their maximal amount is computed to 4 * \sum_{i=1}^{h_max} i  =  2 * h_max * (h_max + 1).
 
 */
 
static const int TERRAFORMER_MODHEIGHT_SIZE = 2 * MAX_TILE_HEIGHT * (MAX_TILE_HEIGHT + 1);
 

	
 
/*
 
 * The maximal amount of affected tiles (i.e. the tiles that incident with one of the corners above, is computed similiar to
 
 * 1 + 4 * \sum_{i=1}^{h_max} (i+1)  =  1 + 2 * h_max + (h_max + 3).
src/console_cmds.cpp
Show inline comments
 
@@ -10,35 +10,35 @@
 
#include "landscape.h"
 
#include "saveload.h"
 
#include "string.h"
 
#include "variables.h"
 
#include "network/network_data.h"
 
#include "network/network_client.h"
 
#include "network/network_server.h"
 
#include "network/network_udp.h"
 
#include "command_func.h"
 
#include "settings.h"
 
#include "fios.h"
 
#include "fileio.h"
 
#include "vehicle.h"
 
#include "station.h"
 
#include "screenshot.h"
 
#include "genworld.h"
 
#include "network/network.h"
 
#include "strings_func.h"
 
#include "viewport.h"
 
#include "window_func.h"
 
#include "functions.h"
 
#include "map_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
// ** scriptfile handling ** //
 
static FILE *_script_file;
 
static bool _script_running;
 

	
 
// ** console command / variable defines ** //
 
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[])
 
#define DEF_CONSOLE_HOOK(function) static bool function()
 

	
 

	
 
/* **************************** */
 
/* variable and command hooks   */
 
@@ -128,37 +128,30 @@ DEF_CONSOLE_CMD(ConResetTile)
 
		uint32 result;
 
		if (GetArgumentInteger(&result, argv[1])) {
 
			DoClearSquare((TileIndex)result);
 
			return true;
 
		}
 
	}
 

	
 
	return false;
 
}
 

	
 
DEF_CONSOLE_CMD(ConStopAllVehicles)
 
{
 
	Vehicle* v;
 
	if (argc == 0) {
 
		IConsoleHelp("Stops all vehicles in the game. For debugging only! Use at your own risk... Usage: 'stopall'");
 
		return true;
 
	}
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		/* Code ripped from CmdStartStopTrain. Can't call it, because of
 
		 * ownership problems, so we'll duplicate some code, for now */
 
		v->vehstatus |= VS_STOPPED;
 
		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 
	}
 
	StopAllVehicles();
 
	return true;
 
}
 
#endif /* _DEBUG */
 

	
 
DEF_CONSOLE_CMD(ConScrollToTile)
 
{
 
	if (argc == 0) {
 
		IConsoleHelp("Center the screen on a given tile. Usage: 'scrollto <tile>'");
 
		IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)");
 
		return true;
 
	}
 

	
src/date.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file date.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "variables.h"
 
#include "vehicle.h"
 
#include "network/network.h"
 
#include "network/network_data.h"
 
#include "network/network_server.h"
 
#include "currency.h"
 
#include "window_func.h"
 
#include "functions.h"
 
#include "date_func.h"
 
#include "vehicle_base.h"
 
#ifdef DEBUG_DUMP_COMMANDS
 
#include "saveload.h"
 
#endif
 

	
 
Year      _cur_year;
 
Month     _cur_month;
 
Date      _date;
 
DateFract _date_fract;
 

	
 

	
 
void SetDate(Date date)
 
{
src/depot.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file depot.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "vehicle.h"
 
#include "depot.h"
 
#include "landscape.h"
 
#include "table/strings.h"
 
#include "saveload.h"
 
#include "order.h"
 
#include "window_func.h"
 

	
 
DEFINE_OLD_POOL_GENERIC(Depot, Depot)
 

	
 
/**
 
 * Gets a depot from a tile
 
 *
src/depot_gui.cpp
Show inline comments
 
@@ -3,34 +3,34 @@
 
/** @file depot_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "ship.h"
 
#include "aircraft.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "gui.h"
 
#include "textbuf_gui.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
#include "station_map.h"
 
#include "newgrf_engine.h"
 
#include "spritecache.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 
/*
 
 * Since all depot window sizes aren't the same, we need to modify sizes a little.
 
 * It's done with the following arrays of widget indexes. Each of them tells if a widget side should be moved and in what direction.
 
 * How long they should be moved and for what window types are controlled in ShowDepotWindow()
 
 */
 

	
 
/* Names of the widgets. Keep them in the same order as in the widget array */
 
enum DepotWindowWidgets {
 
	DEPOT_WIDGET_CLOSEBOX = 0,
 
	DEPOT_WIDGET_CAPTION,
 
	DEPOT_WIDGET_STICKY,
 
@@ -162,32 +162,32 @@ const Sprite *GetAircraftSprite(EngineID
 
 * @param *v Vehicle to draw
 
 * @param x Left side of the box to draw in
 
 * @param y Top of the box to draw in
 
 */
 
static void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y)
 
{
 
	byte diff_x = 0, diff_y = 0;
 

	
 
	int sprite_y = y + w->resize.step_height - GetVehicleListHeight(v->type);
 

	
 
	switch (v->type) {
 
		case VEH_TRAIN:
 
			DrawTrainImage(v, x + 21, sprite_y, w->hscroll.cap + 4, w->hscroll.pos, WP(w, depot_d).sel);
 
			DrawTrainImage(v, x + 21, sprite_y, WP(w, depot_d).sel, w->hscroll.cap + 4, w->hscroll.pos);
 

	
 
			/* Number of wagons relative to a standard length wagon (rounded up) */
 
			SetDParam(0, (v->u.rail.cached_total_length + 7) / 8);
 
			DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter
 
			break;
 

	
 
		case VEH_ROAD:     DrawRoadVehImage( v, x + 24, sprite_y, 1, WP(w, depot_d).sel); break;
 
		case VEH_ROAD:     DrawRoadVehImage( v, x + 24, sprite_y, WP(w, depot_d).sel, 1); break;
 
		case VEH_SHIP:     DrawShipImage(    v, x + 19, sprite_y - 1, WP(w, depot_d).sel); break;
 
		case VEH_AIRCRAFT: {
 
			const Sprite *spr = GetSprite(v->GetImage(DIR_W));
 
			DrawAircraftImage(v, x + 12,
 
							  y + max(spr->height + spr->y_offs - 14, 0), // tall sprites needs an y offset
 
							  WP(w, depot_d).sel);
 
		} break;
 
		default: NOT_REACHED();
 
	}
 

	
 
	if (w->resize.step_height == 14) {
 
		/* VEH_TRAIN and VEH_ROAD, which are low */
 
@@ -264,25 +264,25 @@ static void DrawDepotWindow(Window *w)
 
			const Vehicle *v = vl[num];
 
			DrawVehicleInDepot(w, v, x, y);
 
		}
 
	}
 

	
 
	maxval = min(WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count, (w->vscroll.pos * boxes_in_each_row) + (rows_in_display * boxes_in_each_row));
 

	
 
	/* draw the train wagons, that do not have an engine in front */
 
	for (; num < maxval; num++, y += 14) {
 
		const Vehicle *v = WP(w, depot_d).wagon_list[num - WP(w, depot_d).engine_count];
 
		const Vehicle *u;
 

	
 
		DrawTrainImage(v, x + 50, y, w->hscroll.cap - 29, 0, WP(w, depot_d).sel);
 
		DrawTrainImage(v, x + 50, y, WP(w, depot_d).sel, w->hscroll.cap - 29, 0);
 
		DrawString(x, y + 2, STR_8816, TC_FROMSTRING);
 

	
 
		/*Draw the train counter */
 
		i = 0;
 
		u = v;
 
		do i++; while ((u = u->Next()) != NULL); // Determine length of train
 
		SetDParam(0, i);                      // Set the counter
 
		DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter
 
	}
 
}
 

	
 
struct GetDepotVehiclePtData {
src/disaster_cmd.cpp
Show inline comments
 
@@ -14,40 +14,41 @@
 
 *     will increase this value, and the last one will remove the disaster itself
 
 * </ol>
 
 */
 

	
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "landscape.h"
 

	
 
#include "industry_map.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "vehicle.h"
 
#include "command_func.h"
 
#include "tile_cmd.h"
 
#include "news.h"
 
#include "station.h"
 
#include "waypoint.h"
 
#include "town.h"
 
#include "industry.h"
 
#include "player.h"
 
#include "airport.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "table/sprites.h"
 
#include "strings_func.h"
 
#include "date_func.h"
 
#include "functions.h"
 
#include "vehicle_func.h"
 
#include "vehicle_base.h"
 

	
 
enum DisasterSubType {
 
	ST_Zeppeliner,
 
	ST_Zeppeliner_Shadow,
 
	ST_Small_Ufo,
 
	ST_Small_Ufo_Shadow,
 
	ST_Airplane,
 
	ST_Airplane_Shadow,
 
	ST_Helicopter,
 
	ST_Helicopter_Shadow,
 
	ST_Helicopter_Rotors,
 
	ST_Big_Ufo,
src/dock_gui.cpp
Show inline comments
 
@@ -8,25 +8,25 @@
 
#include "table/strings.h"
 
#include "tile_map.h"
 
#include "station.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "viewport.h"
 
#include "sound.h"
 
#include "command_func.h"
 
#include "variables.h"
 
#include "water.h"
 
#include "window_func.h"
 
#include "vehicle.h"
 
#include "vehicle_func.h"
 

	
 
static void ShowBuildDockStationPicker();
 
static void ShowBuildDocksDepotPicker();
 

	
 
static Axis _ship_depot_direction;
 

	
 
void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		SndPlayTileFx(SND_02_SPLAT, tile);
 
		ResetObjectToPlace();
 
	}
src/economy.cpp
Show inline comments
 
@@ -2,25 +2,24 @@
 

	
 
/** @file economy.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "currency.h"
 
#include "landscape.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "news.h"
 
#include "player.h"
 
#include "station.h"
 
#include "vehicle.h"
 
#include "command_func.h"
 
#include "saveload.h"
 
#include "industry.h"
 
#include "town.h"
 
#include "network/network.h"
 
#include "sound.h"
 
#include "engine.h"
 
#include "network/network_data.h"
 
#include "variables.h"
 
#include "vehicle_gui.h"
 
#include "ai/ai.h"
 
#include "train.h"
 
@@ -31,24 +30,25 @@
 
#include "newgrf_callbacks.h"
 
#include "newgrf_industries.h"
 
#include "newgrf_industrytiles.h"
 
#include "unmovable.h"
 
#include "cargotype.h"
 
#include "player_face.h"
 
#include "group.h"
 
#include "strings_func.h"
 
#include "tile_cmd.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
/**
 
 * Multiply two integer values and shift the results to right.
 
 *
 
 * This function multiplies two integer values. The result is
 
 * shifted by the amount of shift to right.
 
 *
 
 * @param a The first integer
 
 * @param b The second integer
 
 * @param shift The amount to shift the value to right.
 
 * @return The shifted result
 
 */
src/elrail.cpp
Show inline comments
 
@@ -51,29 +51,29 @@
 
#include "viewport.h"
 
#include "variables.h" /* ... same here */
 
#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 "table/sprites.h"
 
#include "table/elrail_data.h"
 
#include "vehicle.h"
 
#include "train.h"
 
#include "rail_gui.h"
 
#include "transparency.h"
 
#include "tunnelbridge_map.h"
 
#include "vehicle_func.h"
 

	
 

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

	
 
/** Finds which Rail Bits are present on a given tile. For bridge tiles,
 
 * returns track bits under the bridge
 
 */
 
static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
 
{
src/engine.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file engine.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "table/strings.h"
 
#include "engine.h"
 
#include "player.h"
 
#include "command_func.h"
 
#include "vehicle.h"
 
#include "news.h"
 
#include "saveload.h"
 
#include "variables.h"
 
#include "train.h"
 
#include "aircraft.h"
 
#include "newgrf_cargo.h"
 
#include "table/engines.h"
 
#include "group.h"
 
#include "string.h"
 
#include "misc/autoptr.hpp"
 
#include "strings_func.h"
 
#include "viewport.h"
src/group_cmd.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file group_cmd.cpp Handling of the engine groups */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "variables.h"
 
#include "player.h"
 
#include "table/strings.h"
 
#include "command_func.h"
 
#include "vehicle.h"
 
#include "saveload.h"
 
#include "debug.h"
 
#include "group.h"
 
#include "train.h"
 
#include "aircraft.h"
 
#include "string.h"
 
#include "vehicle_gui.h"
 
#include "misc/autoptr.hpp"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 
/**
 
 * Update the num engines of a groupID. Decrease the old one and increase the new one
 
 * @note called in SetTrainGroupID and UpdateTrainGroupID
 
 * @param i     EngineID we have to update
 
 * @param old_g index of the old group
 
 * @param new_g index of the new group
 
 */
 
static inline void UpdateNumEngineGroup(EngineID i, GroupID old_g, GroupID new_g)
 
{
 
	if (old_g != new_g) {
 
		/* Decrease the num engines of EngineID i of the old group if it's not the default one */
src/group_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file group_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "vehicle.h"
 
#include "command_func.h"
 
#include "engine.h"
 
#include "vehicle_gui.h"
 
#include "depot.h"
 
#include "train.h"
 
#include "group.h"
 
#include "viewport.h"
 
#include "debug.h"
 
#include "strings_func.h"
 
#include "core/alloc_func.hpp"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
struct Sorting {
 
	Listing aircraft;
 
	Listing roadveh;
 
	Listing ship;
 
	Listing train;
 
};
 

	
 
static Sorting _sorting;
 

	
 

	
 
@@ -464,25 +464,25 @@ static void GroupWndProc(Window *w, Wind
 
			}
 

	
 
			/* Draw Matrix Vehicle according to the vehicle list built before */
 
			DrawString(285, 15, _vehicle_sort_listing[gv->l.sort_type], TC_BLACK);
 
			DoDrawString(gv->l.flags & VL_DESC ? DOWNARROW : UPARROW, 269, 15, TC_BLACK);
 

	
 
			max = min(w->vscroll2.pos + w->vscroll2.cap, gv->l.list_length);
 
			for (i = w->vscroll2.pos ; i < max ; ++i) {
 
				const Vehicle* v = gv->sort_list[i];
 

	
 
				assert(v->type == gv->vehicle_type && v->owner == owner);
 

	
 
				DrawVehicleImage(v, x + 19, y2 + 6, w->hscroll.cap, 0, gv->vehicle_sel);
 
				DrawVehicleImage(v, x + 19, y2 + 6, gv->vehicle_sel, w->hscroll.cap, 0);
 
				DrawVehicleProfitButton(v, x, y2 + 13);
 

	
 
				SetDParam(0, v->unitnumber);
 
				DrawString(x, y2 + 2, v->IsInDepot() ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), TC_FROMSTRING);
 

	
 
				if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG2) DrawSmallOrderList(v, x + 138, y2);
 

	
 
				SetDParam(0, v->profit_this_year);
 
				SetDParam(1, v->profit_last_year);
 
				DrawString(x + 19, y2 + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
 

	
 
				if (IsValidGroupID(v->group_id)) {
src/industry_cmd.cpp
Show inline comments
 
@@ -6,49 +6,49 @@
 
#include "openttd.h"
 
#include "clear_map.h"
 
#include "industry_map.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "train.h"
 
#include "landscape.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "industry.h"
 
#include "town.h"
 
#include "vehicle.h"
 
#include "news.h"
 
#include "saveload.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "table/industry_land.h"
 
#include "table/build_industry.h"
 
#include "genworld.h"
 
#include "water_map.h"
 
#include "tree_map.h"
 
#include "cargotype.h"
 
#include "newgrf.h"
 
#include "newgrf_commons.h"
 
#include "newgrf_industries.h"
 
#include "newgrf_industrytiles.h"
 
#include "newgrf_callbacks.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "transparency.h"
 
#include "water.h"
 
#include "strings_func.h"
 
#include "tile_cmd.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
void ShowIndustryViewWindow(int industry);
 
void BuildOilRig(TileIndex tile);
 

	
 
static byte _industry_sound_ctr;
 
static TileIndex _industry_sound_tile;
 

	
 
int _total_industries;                      //general counter
 
uint16 _industry_counts[NUM_INDUSTRYTYPES]; // Number of industries per type ingame
 

	
 
const Industry **_industry_sort;
 
bool _industry_sort_dirty;
src/landscape.cpp
Show inline comments
 
@@ -3,36 +3,36 @@
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "bridge_map.h"
 
#include "heightmap.h"
 
#include "clear_map.h"
 
#include "player.h"
 
#include "spritecache.h"
 
#include "table/sprites.h"
 
#include <stdarg.h>
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "landscape.h"
 
#include "vehicle.h"
 
#include "variables.h"
 
#include "void_map.h"
 
#include "water_map.h"
 
#include "tgp.h"
 
#include "genworld.h"
 
#include "tile_cmd.h"
 
#include "core/alloc_func.hpp"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "functions.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
extern const TileTypeProcs
 
	_tile_type_clear_procs,
 
	_tile_type_rail_procs,
 
	_tile_type_road_procs,
 
	_tile_type_town_procs,
 
	_tile_type_trees_procs,
 
	_tile_type_station_procs,
 
	_tile_type_water_procs,
 
	_tile_type_dummy_procs,
 
	_tile_type_industry_procs,
 
	_tile_type_tunnelbridge_procs,
src/main_gui.cpp
Show inline comments
 
@@ -10,46 +10,46 @@
 
#include "station.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "window_func.h"
 
#include "textbuf_gui.h"
 
#include "viewport.h"
 
#include "player.h"
 
#include "command_func.h"
 
#include "news.h"
 
#include "town.h"
 
#include "vehicle.h"
 
#include "console.h"
 
#include "sound.h"
 
#include "network/network.h"
 
#include "signs.h"
 
#include "waypoint.h"
 
#include "variables.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "bridge_map.h"
 
#include "unmovable_map.h"
 
#include "string.h"
 
#include "screenshot.h"
 
#include "genworld.h"
 
#include "settings.h"
 
#include "vehicle_gui.h"
 
#include "transparency_gui.h"
 
#include "newgrf_config.h"
 
#include "rail_gui.h"
 
#include "road_gui.h"
 
#include "date_func.h"
 
#include "functions.h"
 
#include "vehicle_func.h"
 

	
 
#include "network/network_data.h"
 
#include "network/network_client.h"
 
#include "network/network_server.h"
 
#include "network/network_gui.h"
 
#include "industry.h"
 
#include "transparency.h"
 
#include "strings_func.h"
 
#include "zoom_func.h"
 

	
 
static int _rename_id = 1;
 
static int _rename_what = -1;
src/misc.cpp
Show inline comments
 
@@ -2,39 +2,40 @@
 

	
 
/** @file misc.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "currency.h"
 
#include "landscape.h"
 
#include "news.h"
 
#include "player.h"
 
#include "string.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "vehicle.h"
 
#include "saveload.h"
 
#include "engine.h"
 
#include "vehicle_gui.h"
 
#include "variables.h"
 
#include "ai/ai.h"
 
#include "newgrf_house.h"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "viewport.h"
 
#include "economy_func.h"
 
#include "zoom_func.h"
 
#include "functions.h"
 
#include "map_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 
#include "texteff.hpp"
 

	
 
char _name_array[512][32];
 

	
 
void InitializeVehicles();
 
void InitializeWaypoints();
 
void InitializeDepots();
 
void InitializeEngines();
 
void InitializeOrders();
 
void InitializeClearLand();
 
void InitializeRailGui();
 
void InitializeRoadGui();
 
void InitializeAirportGui();
src/misc_cmd.cpp
Show inline comments
 
@@ -8,27 +8,27 @@
 
#include "table/strings.h"
 
#include "command_func.h"
 
#include "economy_func.h"
 
#include "player.h"
 
#include "gui.h"
 
#include "window_func.h"
 
#include "textbuf_gui.h"
 
#include "network/network.h"
 
#include "variables.h"
 
#include "livery.h"
 
#include "player_face.h"
 
#include "strings_func.h"
 
#include "vehicle.h"
 
#include "gfx_func.h"
 
#include "functions.h"
 
#include "vehicle_func.h"
 

	
 
/** Change the player's face.
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 unused
 
 * @param p2 face bitmasked
 
 */
 
CommandCost CmdSetPlayerFace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	PlayerFace pf = (PlayerFace)p2;
 

	
 
	if (!IsValidPlayerFace(pf)) return CMD_ERROR;
src/misc_gui.cpp
Show inline comments
 
@@ -18,25 +18,24 @@
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "textbuf_gui.h"
 
#include "viewport.h"
 
#include "station.h"
 
#include "command_func.h"
 
#include "player.h"
 
#include "town.h"
 
#include "sound.h"
 
#include "network/network.h"
 
#include "string.h"
 
#include "variables.h"
 
#include "vehicle.h"
 
#include "train.h"
 
#include "tgp.h"
 
#include "settings.h"
 
#include "cargotype.h"
 
#include "player_face.h"
 
#include "strings_func.h"
 
#include "fileio.h"
 
#include "fios.h"
 
#include "tile_cmd.h"
 
#include "zoom_func.h"
 
#include "functions.h"
 
#include "window_func.h"
src/network/network_server.cpp
Show inline comments
 
@@ -9,25 +9,24 @@
 
#include "../strings_func.h"
 
#include "network_data.h"
 
#include "core/tcp.h"
 
#include "../train.h"
 
#include "../aircraft.h"
 
#include "../date_func.h"
 
#include "table/strings.h"
 
#include "network_server.h"
 
#include "network_udp.h"
 
#include "../console.h"
 
#include "../command_func.h"
 
#include "../saveload.h"
 
#include "../vehicle.h"
 
#include "../station.h"
 
#include "../variables.h"
 
#include "../genworld.h"
 
#include "../core/alloc_func.hpp"
 
#include "../fileio.h"
 

	
 
// This file handles all the server-commands
 

	
 
static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs);
 

	
 
// **********
 
// Sending functions
src/newgrf.cpp
Show inline comments
 
@@ -11,25 +11,24 @@
 
#include "fileio.h"
 
#include "engine.h"
 
#include "spritecache.h"
 
#include "station.h"
 
#include "sprite.h"
 
#include "newgrf.h"
 
#include "variables.h"
 
#include "string.h"
 
#include "table/strings.h"
 
#include "bridge.h"
 
#include "town.h"
 
#include "newgrf_engine.h"
 
#include "vehicle.h"
 
#include "newgrf_text.h"
 
#include "table/sprites.h"
 
#include "fontcache.h"
 
#include "currency.h"
 
#include "landscape.h"
 
#include "sound.h"
 
#include "newgrf_config.h"
 
#include "newgrf_house.h"
 
#include "newgrf_sound.h"
 
#include "newgrf_spritegroup.h"
 
#include "table/town_land.h"
 
#include "cargotype.h"
 
@@ -37,24 +36,25 @@
 
#include "newgrf_canal.h"
 
#include "table/build_industry.h"
 
#include "newgrf_commons.h"
 
#include "newgrf_townname.h"
 
#include "newgrf_industries.h"
 
#include "table/landscape_sprite.h"
 
#include "gfxinit.h"
 
#include "fios.h"
 
#include "rail.h"
 
#include "strings_func.h"
 
#include "gfx_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
/* TTDPatch extended GRF format codec
 
 * (c) Petr Baudis 2004 (GPL'd)
 
 * Changes by Florian octo Forster are (c) by the OpenTTD development team.
 
 *
 
 * Contains portions of documentation by TTDPatch team.
 
 * Thanks especially to Josef Drexler for the documentation as well as a lot
 
 * of help at #tycoon. Also thanks to Michael Blunck for is GRF files which
 
 * served as subject to the initial testing of this codec. */
 

	
 

	
 
static int _skip_sprites; // XXX
src/newgrf_engine.cpp
Show inline comments
 
@@ -10,24 +10,25 @@
 
#include "train.h"
 
#include "player.h"
 
#include "station.h"
 
#include "airport.h"
 
#include "newgrf.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_station.h"
 
#include "newgrf_spritegroup.h"
 
#include "newgrf_cargo.h"
 
#include "cargotype.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
int _traininfo_vehicle_pitch = 0;
 
int _traininfo_vehicle_width = 29;
 

	
 
struct WagonOverride {
 
	byte *train_id;
 
	int trains;
 
	CargoID cargo;
 
	const SpriteGroup *group;
 
};
 

	
src/newgrf_sound.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file newgrf_sound.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "oldpool.h"
 
#include "sound.h"
 
#include "engine.h"
 
#include "vehicle.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_sound.h"
 
#include "vehicle_base.h"
 

	
 
static uint _sound_count = 0;
 
STATIC_OLD_POOL(SoundInternal, FileEntry, 3, 1000, NULL, NULL)
 

	
 

	
 
/* Allocate a new FileEntry */
 
FileEntry *AllocateFileEntry()
 
{
 
	if (_sound_count == GetSoundInternalPoolSize()) {
 
		if (!_SoundInternal_pool.AddBlockToPool()) return NULL;
 
	}
 

	
src/news_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "news.h"
 
#include "vehicle.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "string.h"
 
#include "transparency.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_base.h"
 

	
 
/** @file news_gui.cpp
 
 *
 
 * News system is realized as a FIFO queue (in an array)
 
 * The positions in the queue can't be rearranged, we only access
 
 * the array elements through pointers to the elements. Once the
 
 * array is full, the oldest entry (\a _oldest_news) is being overwritten
 
 * by the newest (\a _latest_news).
 
 *
 
 * \verbatim
 
 * oldest                   current   lastest
 
 *  |                          |         |
src/npf.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file npf.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "npf.h"
 
#include "vehicle.h"
 
#include "bridge_map.h"
 
#include "debug.h"
 
#include "tile_cmd.h"
 
#include "bridge.h"
 
#include "landscape.h"
 
#include "aystar.h"
 
#include "pathfind.h"
 
#include "station.h"
 
#include "station_map.h"
 
#include "depot.h"
 
#include "tunnel_map.h"
 
#include "network/network.h"
 
#include "water_map.h"
 
#include "tunnelbridge_map.h"
 
#include "functions.h"
 
#include "vehicle_base.h"
 

	
 
static AyStar _npf_aystar;
 

	
 
/* The cost of each trackdir. A diagonal piece is the full NPF_TILE_LENGTH,
 
 * the shorter piece is sqrt(2)/2*NPF_TILE_LENGTH =~ 0.7071
 
 */
 
#define NPF_STRAIGHT_LENGTH (uint)(NPF_TILE_LENGTH * STRAIGHT_TRACK_LENGTH)
 
static const uint _trackdir_length[TRACKDIR_END] = {
 
	NPF_TILE_LENGTH, NPF_TILE_LENGTH, NPF_STRAIGHT_LENGTH, NPF_STRAIGHT_LENGTH, NPF_STRAIGHT_LENGTH, NPF_STRAIGHT_LENGTH,
 
	0, 0,
 
	NPF_TILE_LENGTH, NPF_TILE_LENGTH, NPF_STRAIGHT_LENGTH, NPF_STRAIGHT_LENGTH, NPF_STRAIGHT_LENGTH, NPF_STRAIGHT_LENGTH
 
};
src/oldloader.cpp
Show inline comments
 
@@ -2,37 +2,37 @@
 

	
 
/** @file oldloader.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "town.h"
 
#include "industry.h"
 
#include "station.h"
 
#include "player.h"
 
#include "engine.h"
 
#include "vehicle.h"
 
#include "aircraft.h"
 
#include "roadveh.h"
 
#include "ship.h"
 
#include "train.h"
 
#include "signs.h"
 
#include "debug.h"
 
#include "depot.h"
 
#include "newgrf_config.h"
 
#include "ai/ai.h"
 
#include "zoom_func.h"
 
#include "functions.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
enum {
 
	HEADER_SIZE = 49,
 
	BUFFER_SIZE = 4096,
 

	
 
	OLD_MAP_SIZE = 256 * 256
 
};
 

	
 
struct LoadgameState {
 
	FILE *file;
 

	
 
	uint chunk_size;
src/openttd.cpp
Show inline comments
 
@@ -12,25 +12,24 @@
 
#include "openttd.h"
 
#include "table/strings.h"
 
#include "bridge_map.h"
 
#include "mixer.h"
 
#include "spritecache.h"
 
#include "gfxinit.h"
 
#include "gui.h"
 
#include "landscape.h"
 
#include "station.h"
 
#include "station_map.h"
 
#include "town_map.h"
 
#include "tunnel_map.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "window_func.h"
 
#include "window_gui.h"
 
#include "player.h"
 
#include "command_func.h"
 
#include "town.h"
 
#include "industry.h"
 
#include "news.h"
 
#include "engine.h"
 
#include "sound.h"
 
#include "fileio.h"
 
#include "airport.h"
 
@@ -53,24 +52,25 @@
 
#include "newgrf_house.h"
 
#include "newgrf_commons.h"
 
#include "newgrf_storage.h"
 
#include "player_face.h"
 
#include "group.h"
 
#include "blitter/factory.hpp"
 
#include "sound/sound_driver.hpp"
 
#include "music/music_driver.hpp"
 
#include "video/video_driver.hpp"
 
#include "strings_func.h"
 
#include "zoom_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
#include "bridge_map.h"
 
#include "clear_map.h"
 
#include "rail_map.h"
 
#include "road_map.h"
 
#include "water_map.h"
 
#include "industry_map.h"
 
#include "unmovable_map.h"
 
#include "tree_map.h"
 
#include "tunnelbridge_map.h"
 
#include "void_map.h"
 

	
src/order_cmd.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file order_cmd.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "order.h"
 
#include "airport.h"
 
#include "vehicle.h"
 
#include "depot.h"
 
#include "table/strings.h"
 
#include "waypoint.h"
 
#include "command_func.h"
 
#include "station.h"
 
#include "player.h"
 
#include "news.h"
 
#include "saveload.h"
 
#include "vehicle_gui.h"
 
#include "cargotype.h"
 
#include "aircraft.h"
 
#include "strings_func.h"
src/order_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file order_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "road_map.h"
 
#include "station_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "vehicle.h"
 
#include "station.h"
 
#include "town.h"
 
#include "command_func.h"
 
#include "viewport.h"
 
#include "depot.h"
 
#include "waypoint.h"
 
#include "train.h"
 
#include "water_map.h"
 
#include "vehicle_gui.h"
 
#include "timetable.h"
 
#include "cargotype.h"
 
#include "order.h"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 
enum OrderWindowWidgets {
 
	ORDER_WIDGET_CLOSEBOX = 0,
 
	ORDER_WIDGET_CAPTION,
 
	ORDER_WIDGET_TIMETABLE_VIEW,
 
	ORDER_WIDGET_ORDER_LIST,
 
	ORDER_WIDGET_SCROLLBAR,
 
	ORDER_WIDGET_SKIP,
 
	ORDER_WIDGET_DELETE,
 
	ORDER_WIDGET_NON_STOP,
 
	ORDER_WIDGET_GOTO,
 
	ORDER_WIDGET_FULL_LOAD,
src/player_gui.cpp
Show inline comments
 
@@ -3,25 +3,24 @@
 
/** @file player_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "viewport.h"
 
#include "player.h"
 
#include "command_func.h"
 
#include "vehicle.h"
 
#include "network/network.h"
 
#include "variables.h"
 
#include "roadveh.h"
 
#include "train.h"
 
#include "aircraft.h"
 
#include "newgrf.h"
 
#include "network/network_data.h"
 
#include "network/network_client.h"
 
#include "network/network_gui.h"
 
#include "player_face.h"
 
#include "strings_func.h"
 
#include "functions.h"
src/players.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file players.cpp
 
 */
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "engine.h"
 
#include "string.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "player.h"
 
#include "town.h"
 
#include "vehicle.h"
 
#include "station.h"
 
#include "news.h"
 
#include "saveload.h"
 
#include "command_func.h"
 
#include "sound.h"
 
#include "network/network.h"
 
#include "variables.h"
 
#include "engine.h"
 
#include "ai/ai.h"
 
#include "player_face.h"
 
#include "group.h"
 
#include "settings.h"
 
#include "window_func.h"
 
#include "tile_map.h"
 
#include "strings_func.h"
 
#include "gfx_func.h"
 
#include "functions.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
/**
 
 * Sets the local player and updates the patch settings that are set on a
 
 * per-company (player) basis to reflect the core's state in the GUI.
 
 * @param new_player the new player
 
 * @pre IsValidPlayer(new_player) || new_player == PLAYER_SPECTATOR || new_player == OWNER_NONE
 
 */
 
void SetLocalPlayer(PlayerID new_player)
 
{
 
	/* Player could also be PLAYER_SPECTATOR or OWNER_NONE */
 
	assert(IsValidPlayer(new_player) || new_player == PLAYER_SPECTATOR || new_player == OWNER_NONE);
 

	
src/rail_cmd.cpp
Show inline comments
 
@@ -7,49 +7,49 @@
 
#include "bridge_map.h"
 
#include "bridge.h"
 
#include "cmd_helper.h"
 
#include "debug.h"
 
#include "tile_cmd.h"
 
#include "rail_map.h"
 
#include "road_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "landscape.h"
 
#include "town_map.h"
 
#include "tunnel_map.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "pathfind.h"
 
#include "engine.h"
 
#include "town.h"
 
#include "sound.h"
 
#include "station.h"
 
#include "sprite.h"
 
#include "depot.h"
 
#include "waypoint.h"
 
#include "rail.h"
 
#include "railtypes.h" // include table for railtypes
 
#include "newgrf.h"
 
#include "yapf/yapf.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_station.h"
 
#include "train.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "transparency.h"
 
#include "water.h"
 
#include "tunnelbridge_map.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
const byte _track_sloped_sprites[14] = {
 
	14, 15, 22, 13,
 
	 0, 21, 17, 12,
 
	23,  0, 18, 20,
 
	19, 16
 
};
 

	
 

	
 
/*         4
 
 *     ---------
src/rail_gui.cpp
Show inline comments
 
@@ -5,25 +5,24 @@
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "viewport.h"
 
#include "sound.h"
 
#include "command_func.h"
 
#include "vehicle.h"
 
#include "station.h"
 
#include "waypoint.h"
 
#include "debug.h"
 
#include "variables.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_station.h"
 
#include "train.h"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "date_func.h"
 

	
src/road_cmd.cpp
Show inline comments
 
@@ -7,41 +7,42 @@
 
#include "bridge_map.h"
 
#include "bridge.h"
 
#include "cmd_helper.h"
 
#include "rail_map.h"
 
#include "road_map.h"
 
#include "road_internal.h"
 
#include "sprite.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "town_map.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "player.h"
 
#include "town.h"
 
#include "sound.h"
 
#include "yapf/yapf.h"
 
#include "depot.h"
 
#include "newgrf.h"
 
#include "station_map.h"
 
#include "tunnel_map.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "transparency.h"
 
#include "tunnelbridge_map.h"
 
#include "window_func.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 
#include "vehicle_base.h"
 

	
 

	
 
#define M(x) (1 << (x))
 
/* Level crossings may only be built on these slopes */
 
static const uint32 VALID_LEVEL_CROSSING_SLOPES = (M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT));
 
#undef M
 

	
 
bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, bool *edge_road, RoadType rt)
 
{
 
	RoadBits present;
 
	RoadBits n;
 
	*edge_road = true;
src/road_gui.cpp
Show inline comments
 
@@ -7,29 +7,29 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "station_gui.h"
 
#include "viewport.h"
 
#include "sound.h"
 
#include "command_func.h"
 
#include "variables.h"
 
#include "road_cmd.h"
 
#include "road_map.h"
 
#include "station_map.h"
 
#include "vehicle.h"
 
//needed for catchments
 
#include "station.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
static void ShowRVStationPicker(RoadStop::Type rs);
 
static void ShowRoadDepotPicker();
 

	
 
static bool _remove_button_clicked;
 
static bool _one_way_button_clicked;
 

	
 
/**
 
 * Define the values of the RoadFlags
 
 * @see CmdBuildLongRoad
 
 */
src/roadveh.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file src/roadveh.h Road vehicle states */
 

	
 
#ifndef ROADVEH_H
 
#define ROADVEH_H
 

	
 
#include "vehicle.h"
 
#include "vehicle_base.h"
 
#include "engine.h"
 
#include "variables.h"
 
#include "economy_func.h"
 

	
 
enum RoadVehicleSubType {
 
	RVST_FRONT,
 
	RVST_ARTIC_PART,
 
};
 

	
 
static inline bool IsRoadVehFront(const Vehicle *v)
 
{
 
	assert(v->type == VEH_ROAD);
src/roadveh_cmd.cpp
Show inline comments
 
@@ -2,25 +2,24 @@
 

	
 
/** @file roadveh_cmd.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "road_map.h"
 
#include "roadveh.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "engine.h"
 
#include "command_func.h"
 
#include "station.h"
 
#include "news.h"
 
#include "pathfind.h"
 
#include "npf.h"
 
#include "player.h"
 
#include "sound.h"
 
#include "depot.h"
 
#include "bridge.h"
 
#include "tunnel_map.h"
 
@@ -29,24 +28,25 @@
 
#include "articulated_vehicles.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_text.h"
 
#include "newgrf_sound.h"
 
#include "yapf/yapf.h"
 
#include "cargotype.h"
 
#include "strings_func.h"
 
#include "tunnelbridge_map.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
static const uint16 _roadveh_images[63] = {
 
	0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
 
	0xD24, 0xD1C, 0xD2C, 0xD04, 0xD1C, 0xD24, 0xD6C, 0xD74,
 
	0xD7C, 0xC14, 0xC1C, 0xC24, 0xC2C, 0xC34, 0xC3C, 0xC4C,
 
	0xC54, 0xC64, 0xC5C, 0xC6C, 0xC44, 0xC5C, 0xC64, 0xCAC,
 
	0xCB4, 0xCBC, 0xD94, 0xD9C, 0xDA4, 0xDAC, 0xDB4, 0xDBC,
 
	0xDCC, 0xDD4, 0xDE4, 0xDDC, 0xDEC, 0xDC4, 0xDDC, 0xDE4,
 
	0xE2C, 0xE34, 0xE3C, 0xC14, 0xC1C, 0xC2C, 0xC3C, 0xC4C,
 
	0xC5C, 0xC64, 0xC6C, 0xC74, 0xC84, 0xC94, 0xCA4
 
};
src/roadveh_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file roadveh_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "roadveh.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
void DrawRoadVehDetails(const Vehicle *v, int x, int y)
 
{
 
	uint y_offset = RoadVehHasArticPart(v) ? 15 :0;
 
	StringID str;
 

	
 
	SetDParam(0, v->engine_type);
 
	SetDParam(1, v->build_year);
 
	SetDParam(2, v->value);
 
	DrawString(x, y + y_offset, STR_9011_BUILT_VALUE, TC_FROMSTRING);
 

	
 
@@ -90,25 +90,25 @@ void DrawRoadVehDetails(const Vehicle *v
 

	
 
	/* Draw Transfer credits text */
 
	SetDParam(0, v->cargo.FeederShare());
 
	DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING);
 
}
 

	
 

	
 
static inline int RoadVehLengthToPixels(int length)
 
{
 
	return (length * 28) / 8;
 
}
 

	
 
void DrawRoadVehImage(const Vehicle *v, int x, int y, int count, VehicleID selection)
 
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count)
 
{
 
	/* Road vehicle lengths are measured in eighths of the standard length, so
 
	 * count is the number of standard vehicles that should be drawn. If it is
 
	 * 0, we draw enough vehicles for 10 standard vehicle lengths. */
 
	int max_length = (count == 0) ? 80 : count * 8;
 

	
 
	for (int dx = 0 ; v != NULL && dx < max_length ; dx += v->u.road.cached_veh_length, v = v->Next()) {
 
		if (dx + v->u.road.cached_veh_length > 0 && dx <= max_length) {
 
			SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
 
			DrawSprite(v->GetImage(DIR_W), pal, x + 14 + RoadVehLengthToPixels(dx), y + 6);
 

	
 
			if (v->index == selection) {
src/saveload.cpp
Show inline comments
 
@@ -7,39 +7,39 @@
 
 * <li>initialize the writer by creating a temporary memory-buffer for it
 
 * <li>go through all to-be saved elements, each 'chunk' (ChunkHandler) prefixed by a label
 
 * <li>use their description array (SaveLoad) to know what elements to save and in what version
 
 *    of the game it was active (used when loading)
 
 * <li>write all data byte-by-byte to the temporary buffer so it is endian-safe
 
 * <li>when the buffer is full; flush it to the output (eg save to file) (_sl.buf, _sl.bufp, _sl.bufe)
 
 * <li>repeat this until everything is done, and flush any remaining output to file
 
 * </ol>
 
 */
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "vehicle.h"
 
#include "station.h"
 
#include "thread.h"
 
#include "town.h"
 
#include "player.h"
 
#include "saveload.h"
 
#include "network/network.h"
 
#include "variables.h"
 
#include "table/strings.h"
 
#include "window_func.h"
 
#include "strings_func.h"
 
#include "gfx_func.h"
 
#include "core/alloc_func.hpp"
 
#include "functions.h"
 
#include "core/endian_func.hpp"
 
#include "vehicle_base.h"
 
#include <list>
 

	
 
extern const uint16 SAVEGAME_VERSION = 83;
 
uint16 _sl_version;       ///< the major savegame version identifier
 
byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
 

	
 
typedef void WriterProc(uint len);
 
typedef uint ReaderProc();
 

	
 
/** The saveload struct, containing reader-writer functions, bufffer, version, etc. */
 
static struct {
 
	bool save;                           ///< are we doing a save or a load atm. True when saving
src/settings.cpp
Show inline comments
 
@@ -32,24 +32,25 @@
 
#include "console.h"
 
#include "saveload.h"
 
#include "npf.h"
 
#include "yapf/yapf.h"
 
#include "newgrf.h"
 
#include "newgrf_config.h"
 
#include "genworld.h"
 
#include "rail.h"
 
#include "train.h"
 
#include "news.h"
 
#include "window_func.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 
#ifdef WITH_FREETYPE
 
#include "fontcache.h"
 
#endif
 
#include "spritecache.h"
 
#include "transparency.h"
 

	
 
/** The patch values that are used for new games and/or modified in config file */
 
Patches _patches_newgame;
 

	
 
struct IniFile;
 
struct IniItem;
 
struct IniGroup;
src/settings_gui.cpp
Show inline comments
 
@@ -10,29 +10,29 @@
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "command_func.h"
 
#include "engine.h"
 
#include "screenshot.h"
 
#include "newgrf.h"
 
#include "network/network.h"
 
#include "town.h"
 
#include "variables.h"
 
#include "settings.h"
 
#include "vehicle.h"
 
#include "newgrf_townname.h"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "vehicle_base.h"
 

	
 
static uint32 _difficulty_click_a;
 
static uint32 _difficulty_click_b;
 
static byte _difficulty_timeout;
 

	
 
static const StringID _units_dropdown[] = {
 
	STR_UNITS_IMPERIAL,
 
	STR_UNITS_METRIC,
 
	STR_UNITS_SI,
 
	INVALID_STRING_ID
 
};
 

	
src/ship.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file ship.h */
 

	
 
#ifndef SHIP_H
 
#define SHIP_H
 

	
 
#include "vehicle.h"
 
#include "vehicle_base.h"
 
#include "engine.h"
 
#include "variables.h"
 
#include "economy_func.h"
 

	
 
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
 
void RecalcShipStuff(Vehicle *v);
 
void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
 

	
 
/**
 
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
 
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
 
 * and you reinitialize that to a Train using:
src/ship_cmd.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file ship_cmd.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "ship.h"
 
#include "table/strings.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "command_func.h"
 
#include "pathfind.h"
 
#include "station_map.h"
 
#include "station.h"
 
#include "news.h"
 
#include "engine.h"
 
#include "player.h"
 
#include "sound.h"
 
#include "npf.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
@@ -25,24 +24,25 @@
 
#include "water_map.h"
 
#include "yapf/yapf.h"
 
#include "debug.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_text.h"
 
#include "newgrf_sound.h"
 
#include "spritecache.h"
 
#include "misc/autoptr.hpp"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
 

	
 
static const TrackBits _ship_sometracks[4] = {
 
	TRACK_BIT_X | TRACK_BIT_LOWER | TRACK_BIT_LEFT,  // 0x19, // DIAGDIR_NE
 
	TRACK_BIT_Y | TRACK_BIT_UPPER | TRACK_BIT_LEFT,  // 0x16, // DIAGDIR_SE
 
	TRACK_BIT_X | TRACK_BIT_UPPER | TRACK_BIT_RIGHT, // 0x25, // DIAGDIR_SW
 
	TRACK_BIT_Y | TRACK_BIT_LOWER | TRACK_BIT_RIGHT, // 0x2A, // DIAGDIR_NW
 
};
 

	
 
static TrackBits GetTileShipTrackStatus(TileIndex tile)
 
{
src/ship_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file ship_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "ship.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
#include "newgrf_engine.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 

	
 
void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection)
 
{
 
	DrawSprite(v->GetImage(DIR_W), GetVehiclePalette(v), x + 32, y + 10);
 

	
 
	if (v->index == selection) {
 
		DrawFrameRect(x - 5, y - 1, x + 67, y + 21, 15, FR_BORDERONLY);
 
	}
 
}
 

	
 
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
src/smallmap_gui.cpp
Show inline comments
 
@@ -9,33 +9,33 @@
 
#include "industry_map.h"
 
#include "industry.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "landscape.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "tree_map.h"
 
#include "tunnel_map.h"
 
#include "viewport.h"
 
#include "player.h"
 
#include "vehicle.h"
 
#include "town.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "blitter/factory.hpp"
 
#include "tunnelbridge_map.h"
 
#include "strings_func.h"
 
#include "zoom_func.h"
 
#include "core/endian_func.hpp"
 
#include "vehicle_base.h"
 

	
 

	
 
static const Widget _smallmap_widgets[] = {
 
{  WWT_CLOSEBOX,   RESIZE_NONE,    13,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},
 
{   WWT_CAPTION,  RESIZE_RIGHT,    13,    11,   337,     0,    13, STR_00B0_MAP,            STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{ WWT_STICKYBOX,     RESIZE_LR,    13,   338,   349,     0,    13, 0x0,                     STR_STICKY_BUTTON},
 
{     WWT_PANEL,     RESIZE_RB,    13,     0,   349,    14,   157, 0x0,                     STR_NULL},
 
{     WWT_INSET,     RESIZE_RB,    13,     2,   347,    16,   155, 0x0,                     STR_NULL},
 
{    WWT_IMGBTN,   RESIZE_LRTB,    13,   284,   305,   158,   179, SPR_IMG_SHOW_COUNTOURS,  STR_0191_SHOW_LAND_CONTOURS_ON_MAP},
 
{    WWT_IMGBTN,   RESIZE_LRTB,    13,   306,   327,   158,   179, SPR_IMG_SHOW_VEHICLES,   STR_0192_SHOW_VEHICLES_ON_MAP},
 
{    WWT_IMGBTN,   RESIZE_LRTB,    13,   328,   349,   158,   179, SPR_IMG_INDUSTRY,        STR_0193_SHOW_INDUSTRIES_ON_MAP},
 
{    WWT_IMGBTN,   RESIZE_LRTB,    13,   284,   307,   180,   201, SPR_IMG_SHOW_ROUTES,     STR_0194_SHOW_TRANSPORT_ROUTES_ON},
src/sound.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file sound.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "landscape.h"
 
#include "mixer.h"
 
#include "sound.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "fileio.h"
 
#include "newgrf_sound.h"
 
#include "fios.h"
 
#include "window_gui.h"
 
#include "core/alloc_func.hpp"
 
#include "map_func.h"
 
#include "vehicle_base.h"
 

	
 
static uint _file_count;
 
static FileEntry *_files;
 

	
 
// Number of levels of panning per side
 
#define PANNING_LEVELS 16
 

	
 

	
 
static void OpenBankFile(const char *filename)
 
{
 
	uint count;
 
	uint i;
src/station.cpp
Show inline comments
 
@@ -3,25 +3,24 @@
 
/** @file station.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "bridge_map.h"
 
#include "debug.h"
 
#include "station_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "station.h"
 
#include "viewport.h"
 
#include "town.h"
 
#include "vehicle.h"
 
#include "news.h"
 
#include "saveload.h"
 
#include "player.h"
 
#include "airport.h"
 
#include "sprite.h"
 
#include "depot.h"
 
#include "train.h"
 
#include "water_map.h"
 
#include "industry_map.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_station.h"
 
#include "yapf/yapf.h"
src/station_cmd.cpp
Show inline comments
 
@@ -9,25 +9,24 @@
 
#include "bridge_map.h"
 
#include "cmd_helper.h"
 
#include "debug.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "station_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "station.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "town.h"
 
#include "vehicle.h"
 
#include "news.h"
 
#include "saveload.h"
 
#include "player.h"
 
#include "airport.h"
 
#include "sprite.h"
 
#include "depot.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "water_map.h"
 
#include "industry_map.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_station.h"
 
@@ -35,24 +34,25 @@
 
#include "misc/autoptr.hpp"
 
#include "road_type.h"
 
#include "road_internal.h" /* For drawing catenary/checking road removal */
 
#include "cargotype.h"
 
#include "autoslope.h"
 
#include "transparency.h"
 
#include "water.h"
 
#include "station_gui.h"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 
DEFINE_OLD_POOL_GENERIC(Station, Station)
 
DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop)
 

	
 

	
 
/**
 
 * Check whether the given tile is a hangar.
 
 * @param t the tile to of whether it is a hangar.
 
 * @pre IsTileType(t, MP_STATION)
 
 * @return true if and only if the tile is a hangar.
 
 */
 
bool IsHangar(TileIndex t)
src/station_gui.cpp
Show inline comments
 
@@ -7,25 +7,24 @@
 
#include "debug.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "station.h"
 
#include "player.h"
 
#include "economy_func.h"
 
#include "town.h"
 
#include "command_func.h"
 
#include "variables.h"
 
#include "vehicle_gui.h"
 
#include "vehicle.h"
 
#include "table/sprites.h"
 
#include "cargotype.h"
 
#include "station_gui.h"
 
#include "station.h"
 
#include "strings_func.h"
 
#include "core/alloc_func.hpp"
 
#include "window_func.h"
 

	
 
typedef int CDECL StationSortListingTypeFunction(const void*, const void*);
 

	
 
static StationSortListingTypeFunction StationNameSorter;
 
static StationSortListingTypeFunction StationTypeSorter;
src/strings.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file strings.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "currency.h"
 
#include "string.h"
 
#include "table/strings.h"
 
#include "namegen.h"
 
#include "station.h"
 
#include "town.h"
 
#include "vehicle.h"
 
#include "news.h"
 
#include "screenshot.h"
 
#include "waypoint.h"
 
#include "industry.h"
 
#include "variables.h"
 
#include "newgrf_text.h"
 
#include "table/control_codes.h"
 
#include "music.h"
 
#include "industry.h"
 
#include "fileio.h"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "debug.h"
 
#include "newgrf_townname.h"
 
#include "signs.h"
 
#include "vehicle.h"
 
#include "newgrf_engine.h"
 
#include "spritecache.h"
 
#include "fontcache.h"
 
#include "gui.h"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "core/endian_func.hpp"
 
#include "date_func.h"
 
#include "vehicle_base.h"
 

	
 
/* for opendir/readdir/closedir */
 
# include "fios.h"
 

	
 
DynamicLanguages _dynlang;
 
char _userstring[128];
 
uint64 _decode_parameters[20];
 

	
 
static char *StationGetSpecialString(char *buff, int x, const char* last);
 
static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char* last);
 
static char *GetSpecialPlayerNameString(char *buff, int ind, const int64 *argv, const char* last);
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -5,25 +5,24 @@
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "bridge_map.h"
 
#include "clear_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "player.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "viewport.h"
 
#include "sound.h"
 
#include "command_func.h"
 
#include "vehicle.h"
 
#include "signs.h"
 
#include "variables.h"
 
#include "functions.h"
 

	
 
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (success) {
 
		SndPlayTileFx(SND_1F_SPLAT, tile);
 
	} else {
 
		SetRedErrorSquare(_terraform_err_tile);
 
	}
 
}
src/timetable_cmd.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file timetable_cmd.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "variables.h"
 
#include "table/strings.h"
 
#include "command_func.h"
 
#include "player.h"
 
#include "vehicle.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 
#include "vehicle_base.h"
 

	
 

	
 
static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time, bool is_journey)
 
{
 
	Order *order = GetVehicleOrder(v, order_number);
 

	
 
	if (is_journey) {
 
		order->travel_time = time;
 
	} else {
 
		order->wait_time = time;
 
	}
 

	
src/timetable_gui.cpp
Show inline comments
 
@@ -3,28 +3,28 @@
 
/** @file timetable_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "variables.h"
 
#include "table/strings.h"
 
#include "command_func.h"
 
#include "engine.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "string.h"
 
#include "vehicle.h"
 
#include "cargotype.h"
 
#include "depot.h"
 
#include "strings_func.h"
 
#include "vehicle_base.h"
 

	
 
static int GetOrderFromTimetableWndPt(Window *w, int y, const Vehicle *v)
 
{
 
	/*
 
	 * Calculation description:
 
	 * 15 = 14 (w->widget[ORDER_WIDGET_ORDER_LIST].top) + 1 (frame-line)
 
	 * 10 = order text hight
 
	 */
 
	int sel = (y - 15) / 10;
 

	
 
	if ((uint)sel >= w->vscroll.cap) return INVALID_ORDER;
 

	
src/town_cmd.cpp
Show inline comments
 
@@ -9,25 +9,24 @@
 
#include "road_map.h"
 
#include "road_internal.h" /* Cleaning up road bits */
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "landscape.h"
 
#include "town_map.h"
 
#include "tunnel_map.h"
 
#include "viewport.h"
 
#include "town.h"
 
#include "command_func.h"
 
#include "industry.h"
 
#include "station.h"
 
#include "vehicle.h"
 
#include "player.h"
 
#include "news.h"
 
#include "saveload.h"
 
#include "gui.h"
 
#include "unmovable_map.h"
 
#include "water_map.h"
 
#include "variables.h"
 
#include "bridge.h"
 
#include "bridge_map.h"
 
#include "table/town_land.h"
 
#include "genworld.h"
 
#include "newgrf.h"
 
@@ -1784,25 +1783,25 @@ static void DoBuildTownHouse(Town *t, Ti
 
		if (_generating_world) {
 
			uint32 r = Random();
 

	
 
			construction_stage = TOWN_HOUSE_COMPLETED;
 
			if (Chance16(1, 7)) construction_stage = GB(r, 0, 2);
 

	
 
			if (construction_stage == TOWN_HOUSE_COMPLETED) {
 
				ChangePopulation(t, hs->population);
 
			} else {
 
				construction_counter = GB(r, 2, 2);
 
			}
 
		}
 
		MakeTownHouse(tile, t->index, construction_counter, construction_stage, house, VehicleRandomBits());
 
		MakeTownHouse(tile, t->index, construction_counter, construction_stage, house, Random());
 
	}
 
}
 

	
 
static bool BuildTownHouse(Town *t, TileIndex tile)
 
{
 
	CommandCost r;
 

	
 
	if (IsSteepSlope(GetTileSlope(tile, NULL))) return false;
 
	if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false;
 

	
 
	r = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR);
 
	if (CmdFailed(r)) return false;
src/train.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file train.h */
 

	
 
#ifndef TRAIN_H
 
#define TRAIN_H
 

	
 
#include "stdafx.h"
 
#include "vehicle.h"
 
#include "core/bitmath_func.hpp"
 
#include "vehicle_base.h"
 

	
 

	
 
/*
 
 * enum to handle train subtypes
 
 * Do not access it directly unless you have to. Use the access functions below
 
 * This is an enum to tell what bit to access as it is a bitmask
 
 */
 

	
 
enum TrainSubtype {
 
	Train_Front             = 0, ///< Leading engine of a train
 
	Train_Articulated_Part  = 1, ///< Articulated part of an engine
 
	Train_Wagon             = 2, ///< Wagon
src/train_cmd.cpp
Show inline comments
 
@@ -3,25 +3,24 @@
 
/** @file train_cmd.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "bridge_map.h"
 
#include "debug.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "gui.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "tunnel_map.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "articulated_vehicles.h"
 
#include "command_func.h"
 
#include "pathfind.h"
 
#include "npf.h"
 
#include "station.h"
 
#include "table/train_cmd.h"
 
#include "news.h"
 
#include "engine.h"
 
#include "player.h"
 
#include "sound.h"
 
#include "depot.h"
 
@@ -34,24 +33,25 @@
 
#include "newgrf_sound.h"
 
#include "newgrf_text.h"
 
#include "direction_func.h"
 
#include "yapf/yapf.h"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "table/sprites.h"
 
#include "tunnelbridge_map.h"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 

	
 

	
 
static bool TrainCheckIfLineEnds(Vehicle *v);
 
static void TrainController(Vehicle *v, bool update_image);
 

	
 
static const byte _vehicle_initial_x_fract[4] = {10, 8, 4,  8};
 
static const byte _vehicle_initial_y_fract[4] = { 8, 4, 8, 10};
 
static const TrackBits _state_dir_table[4] = { TRACK_BIT_RIGHT, TRACK_BIT_LOWER, TRACK_BIT_LEFT, TRACK_BIT_UPPER };
 

	
 

	
 
/** Return the cargo weight multiplier to use for a rail vehicle
 
 * @param cargo Cargo type to get multiplier for
src/train_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file train_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "vehicle_gui.h"
 
#include "depot.h"
 
#include "train.h"
 
#include "newgrf_engine.h"
 
#include "strings_func.h"
 
#include "vehicle_func.h"
 

	
 
void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	Vehicle *v, *found;
 

	
 
	if (!success) return;
 

	
 
	/* find a locomotive in the depot. */
 
	found = NULL;
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type == VEH_TRAIN && IsFrontEngine(v) &&
 
				v->tile == tile &&
 
@@ -59,25 +59,25 @@ void CcBuildLoco(bool success, TileIndex
 
}
 

	
 
/**
 
 * Get the number of pixels for the given wagon length.
 
 * @param len Length measured in 1/8ths of a standard wagon.
 
 * @return Number of pixels across.
 
 */
 
int WagonLengthToPixels(int len)
 
{
 
	return (len * _traininfo_vehicle_width) / 8;
 
}
 

	
 
void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection)
 
void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip)
 
{
 
	DrawPixelInfo tmp_dpi, *old_dpi;
 
	int dx = -(skip * 8) / _traininfo_vehicle_width;
 
	/* Position of highlight box */
 
	int highlight_l = 0;
 
	int highlight_r = 0;
 

	
 
	if (!FillDrawPixelInfo(&tmp_dpi, x - 2, y - 1, count + 1, 14)) return;
 

	
 
	count = (count * 8) / _traininfo_vehicle_width;
 

	
 
	old_dpi = _cur_dpi;
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -7,43 +7,43 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "bridge_map.h"
 
#include "rail_map.h"
 
#include "road_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "tunnel_map.h"
 
#include "unmovable_map.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "player.h"
 
#include "town.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "bridge.h"
 
#include "train.h"
 
#include "water_map.h"
 
#include "yapf/yapf.h"
 
#include "newgrf_sound.h"
 
#include "autoslope.h"
 
#include "transparency.h"
 
#include "tunnelbridge_map.h"
 
#include "table/bridge_land.h"
 
#include "strings_func.h"
 
#include "date_func.h"
 
#include "functions.h"
 
#include "vehicle_func.h"
 

	
 

	
 
const Bridge orig_bridge[] = {
 
/*
 
	     year of availablity
 
	     |  minimum length
 
	     |  |   maximum length
 
	     |  |   |    price
 
	     |  |   |    |    maximum speed
 
	     |  |   |    |    |  sprite to use in GUI                string with description
 
	     |  |   |    |    |  |                                   |                            */
 
	{    0, 0, 16,  80,  32, 0xA24, PAL_NONE                  , STR_5012_WOODEN             , NULL, 0 },
src/vehicle.cpp
Show inline comments
 
@@ -3,25 +3,24 @@
 
/** @file vehicle.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "road_map.h"
 
#include "roadveh.h"
 
#include "ship.h"
 
#include "spritecache.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "viewport.h"
 
#include "news.h"
 
#include "command_func.h"
 
#include "saveload.h"
 
#include "player.h"
 
#include "engine.h"
 
#include "sound.h"
 
#include "debug.h"
 
#include "vehicle_gui.h"
 
#include "depot.h"
 
#include "station.h"
 
@@ -34,28 +33,34 @@
 
#include "network/network.h"
 
#include "yapf/yapf.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_sound.h"
 
#include "group.h"
 
#include "order.h"
 
#include "strings_func.h"
 
#include "zoom_func.h"
 
#include "functions.h"
 
#include "date_func.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 
#define INVALID_COORD (0x7fffffff)
 
#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))
 

	
 
VehicleID _vehicle_id_ctr_day;
 
Vehicle *_place_clicked_vehicle;
 
VehicleID _new_vehicle_id;
 
uint16 _returned_refit_capacity;
 

	
 

	
 
/* Tables used in vehicle.h to find the right command for a certain vehicle type */
 
const uint32 _veh_build_proc_table[] = {
 
	CMD_BUILD_RAIL_VEHICLE,
 
	CMD_BUILD_ROAD_VEH,
 
	CMD_BUILD_SHIP,
 
	CMD_BUILD_AIRCRAFT,
 
};
 
const uint32 _veh_sell_proc_table[] = {
 
	CMD_SELL_RAIL_WAGON,
 
	CMD_SELL_ROAD_VEH,
 
	CMD_SELL_SHIP,
 
@@ -3173,12 +3178,24 @@ void Vehicle::SetNext(Vehicle *next)
 
		}
 
	}
 
}
 

	
 
void SpecialVehicle::UpdateDeltaXY(Direction direction)
 
{
 
	this->x_offs        = 0;
 
	this->y_offs        = 0;
 
	this->sprite_width  = 1;
 
	this->sprite_height = 1;
 
	this->z_height      = 1;
 
}
 

	
 
void StopAllVehicles()
 
{
 
	Vehicle *v;
 
	FOR_ALL_VEHICLES(v) {
 
		/* Code ripped from CmdStartStopTrain. Can't call it, because of
 
		 * ownership problems, so we'll duplicate some code, for now */
 
		v->vehstatus |= VS_STOPPED;
 
		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 
	}
 
}
src/vehicle.h
Show inline comments
 
deleted file
src/vehicle_base.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @file  vehicle_base.h Base class for all vehicles. */
 

	
 
#ifndef VEHICLE_BASE_H
 
#define VEHICLE_BASE_H
 

	
 
#include "vehicle_type.h"
 
#include "track_type.h"
 
#include "rail_type.h"
 
#include "road_type.h"
 
#include "cargo_type.h"
 
#include "direction_type.h"
 
#include "window_type.h"
 
#include "gfx_type.h"
 
#include "command_type.h"
 
#include "date_type.h"
 
#include "oldpool.h"
 
#include "order.h"
 
#include "cargopacket.h"
 
#include "texteff.hpp"
 

	
 
/** Road vehicle states */
 
enum RoadVehicleStates {
 
	/*
 
	 * Lower 4 bits are used for vehicle track direction. (Trackdirs)
 
	 * When in a road stop (bit 5 or bit 6 set) these bits give the
 
	 * track direction of the entry to the road stop.
 
	 * As the entry direction will always be a diagonal
 
	 * direction (X_NE, Y_SE, X_SW or Y_NW) only bits 0 and 3
 
	 * are needed to hold this direction. Bit 1 is then used to show
 
	 * that the vehicle is using the second road stop bay.
 
	 * Bit 2 is then used for drive-through stops to show the vehicle
 
	 * is stopping at this road stop.
 
	 */
 

	
 
	/* Numeric values */
 
	RVSB_IN_DEPOT                = 0xFE,                      ///< The vehicle is in a depot
 
	RVSB_WORMHOLE                = 0xFF,                      ///< The vehicle is in a tunnel and/or bridge
 

	
 
	/* Bit numbers */
 
	RVS_USING_SECOND_BAY         =    1,                      ///< Only used while in a road stop
 
	RVS_IS_STOPPING              =    2,                      ///< Only used for drive-through stops. Vehicle will stop here
 
	RVS_DRIVE_SIDE               =    4,                      ///< Only used when retrieving move data
 
	RVS_IN_ROAD_STOP             =    5,                      ///< The vehicle is in a road stop
 
	RVS_IN_DT_ROAD_STOP          =    6,                      ///< The vehicle is in a drive-through road stop
 

	
 
	/* Bit sets of the above specified bits */
 
	RVSB_IN_ROAD_STOP            = 1 << RVS_IN_ROAD_STOP,     ///< The vehicle is in a road stop
 
	RVSB_IN_ROAD_STOP_END        = RVSB_IN_ROAD_STOP + TRACKDIR_END,
 
	RVSB_IN_DT_ROAD_STOP         = 1 << RVS_IN_DT_ROAD_STOP,  ///< The vehicle is in a drive-through road stop
 
	RVSB_IN_DT_ROAD_STOP_END     = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END,
 

	
 
	RVSB_TRACKDIR_MASK           = 0x0F,                      ///< The mask used to extract track dirs
 
	RVSB_ROAD_STOP_TRACKDIR_MASK = 0x09                       ///< Only bits 0 and 3 are used to encode the trackdir for road stops
 
};
 

	
 
enum VehStatus {
 
	VS_HIDDEN          = 0x01,
 
	VS_STOPPED         = 0x02,
 
	VS_UNCLICKABLE     = 0x04,
 
	VS_DEFPAL          = 0x08,
 
	VS_TRAIN_SLOWING   = 0x10,
 
	VS_SHADOW          = 0x20,
 
	VS_AIRCRAFT_BROKEN = 0x40,
 
	VS_CRASHED         = 0x80,
 
};
 

	
 
enum VehicleFlags {
 
	VF_LOADING_FINISHED,
 
	VF_CARGO_UNLOADING,
 
	VF_BUILT_AS_PROTOTYPE,
 
	VF_TIMETABLE_STARTED,  ///< Whether the vehicle has started running on the timetable yet.
 
	VF_AUTOFILL_TIMETABLE, ///< Whether the vehicle should fill in the timetable automatically.
 
};
 

	
 
struct VehicleRail {
 
	uint16 last_speed; // NOSAVE: only used in UI
 
	uint16 crash_anim_pos;
 

	
 
	/* cached values, recalculated on load and each time a vehicle is added to/removed from the consist. */
 
	uint16 cached_max_speed;  // max speed of the consist. (minimum of the max speed of all vehicles in the consist)
 
	uint32 cached_power;      // total power of the consist.
 
	uint8 cached_veh_length;  // length of this vehicle in units of 1/8 of normal length, cached because this can be set by a callback
 
	uint16 cached_total_length; ///< Length of the whole train, valid only for first engine.
 

	
 
	/* cached values, recalculated when the cargo on a train changes (in addition to the conditions above) */
 
	uint32 cached_weight;     // total weight of the consist.
 
	uint32 cached_veh_weight; // weight of the vehicle.
 
	uint32 cached_max_te;     // max tractive effort of consist
 
	/**
 
	 * Position/type of visual effect.
 
	 * bit 0 - 3 = position of effect relative to vehicle. (0 = front, 8 = centre, 15 = rear)
 
	 * bit 4 - 5 = type of effect. (0 = default for engine class, 1 = steam, 2 = diesel, 3 = electric)
 
	 * bit     6 = disable visual effect.
 
	 * bit     7 = disable powered wagons.
 
	 */
 
	byte cached_vis_effect;
 
	byte user_def_data;
 

	
 
	/* NOSAVE: for wagon override - id of the first engine in train
 
	 * 0xffff == not in train */
 
	EngineID first_engine;
 

	
 
	TrackBitsByte track;
 
	byte force_proceed;
 
	RailTypeByte railtype;
 
	RailTypeMask compatible_railtypes;
 

	
 
	byte flags;
 

	
 
	/* Link between the two ends of a multiheaded engine */
 
	Vehicle *other_multiheaded_part;
 

	
 
	/* Cached wagon override spritegroup */
 
	const struct SpriteGroup *cached_override;
 
};
 

	
 
enum {
 
	VRF_REVERSING         = 0,
 

	
 
	/* used to calculate if train is going up or down */
 
	VRF_GOINGUP           = 1,
 
	VRF_GOINGDOWN         = 2,
 

	
 
	/* used to store if a wagon is powered or not */
 
	VRF_POWEREDWAGON      = 3,
 

	
 
	/* used to reverse the visible direction of the vehicle */
 
	VRF_REVERSE_DIRECTION = 4,
 

	
 
	/* used to mark train as lost because PF can't find the route */
 
	VRF_NO_PATH_TO_DESTINATION = 5,
 

	
 
	/* used to mark that electric train engine is allowed to run on normal rail */
 
	VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6,
 
};
 

	
 
struct VehicleAir {
 
	uint16 crashed_counter;
 
	uint16 cached_max_speed;
 
	byte pos;
 
	byte previous_pos;
 
	StationID targetairport;
 
	byte state;
 
};
 

	
 
struct VehicleRoad {
 
	byte state;             ///< @see RoadVehicleStates
 
	byte frame;
 
	uint16 blocked_ctr;
 
	byte overtaking;
 
	byte overtaking_ctr;
 
	uint16 crashed_ctr;
 
	byte reverse_ctr;
 
	struct RoadStop *slot;
 
	byte slot_age;
 
	EngineID first_engine;
 
	byte cached_veh_length;
 

	
 
	RoadType roadtype;
 
	RoadTypes compatible_roadtypes;
 
};
 

	
 
struct VehicleSpecial {
 
	uint16 animation_state;
 
	byte animation_substate;
 
};
 

	
 
struct VehicleDisaster {
 
	uint16 image_override;
 
	VehicleID big_ufo_destroyer_target;
 
};
 

	
 
struct VehicleShip {
 
	TrackBitsByte state;
 
};
 

	
 
DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125)
 

	
 
/* Some declarations of functions, so we can make them friendly */
 
struct SaveLoad;
 
extern const SaveLoad *GetVehicleDescription(VehicleType vt);
 
extern void AfterLoadVehicles();
 
struct LoadgameState;
 
extern bool LoadOldVehicle(LoadgameState *ls, int num);
 

	
 
struct Vehicle : PoolItem<Vehicle, VehicleID, &_Vehicle_pool>, BaseVehicle {
 
	byte subtype;            // subtype (Filled with values from EffectVehicles/TrainSubTypes/AircraftSubTypes)
 

	
 
private:
 
	Vehicle *next;           // pointer to the next vehicle in the chain
 
	Vehicle *previous;       // NOSAVE: pointer to the previous vehicle in the chain
 
	Vehicle *first;          // NOSAVE: pointer to the first vehicle in the chain
 
public:
 
	friend const SaveLoad *GetVehicleDescription(VehicleType vt); // So we can use private/protected variables in the saveload code
 
	friend void AfterLoadVehicles();                              // So we can set the previous and first pointers while loading
 
	friend bool LoadOldVehicle(LoadgameState *ls, int num);       // So we can set the proper next pointer while loading
 

	
 
	Vehicle *depot_list;     // NOSAVE: linked list to tell what vehicles entered a depot during the last tick. Used by autoreplace
 

	
 
	StringID string_id;      // Displayed string
 

	
 
	UnitID unitnumber;       // unit number, for display purposes only
 
	PlayerByte owner;        // which player owns the vehicle?
 

	
 
	TileIndex tile;          // Current tile index
 
	TileIndex dest_tile;     // Heading for this tile
 

	
 
	int32 x_pos;             // coordinates
 
	int32 y_pos;
 
	byte z_pos;
 
	DirectionByte direction; // facing
 

	
 
	byte spritenum;          // currently displayed sprite index
 
	                         // 0xfd == custom sprite, 0xfe == custom second head sprite
 
	                         // 0xff == reserved for another custom sprite
 
	uint16 cur_image;        // sprite number for this vehicle
 
	byte sprite_width;       // width of vehicle sprite
 
	byte sprite_height;      // height of vehicle sprite
 
	byte z_height;           // z-height of vehicle sprite
 
	int8 x_offs;             // x offset for vehicle sprite
 
	int8 y_offs;             // y offset for vehicle sprite
 
	EngineID engine_type;
 

	
 
	TextEffectID fill_percent_te_id; // a text-effect id to a loading indicator object
 

	
 
	/* for randomized variational spritegroups
 
	 * bitmask used to resolve them; parts of it get reseeded when triggers
 
	 * of corresponding spritegroups get matched */
 
	byte random_bits;
 
	byte waiting_triggers;   // triggers to be yet matched
 

	
 
	uint16 max_speed;        // maximum speed
 
	uint16 cur_speed;        // current speed
 
	byte subspeed;           // fractional speed
 
	byte acceleration;       // used by train & aircraft
 
	byte progress;
 
	uint32 motion_counter;
 

	
 
	byte vehstatus;          // Status
 
	StationID last_station_visited;
 

	
 
	CargoID cargo_type;      // type of cargo this vehicle is carrying
 
	uint16 cargo_cap;        // total capacity
 
	byte cargo_subtype;      ///< Used for livery refits (NewGRF variations)
 
	CargoList cargo;         ///< The cargo this vehicle is carrying
 

	
 

	
 
	byte day_counter;        // increased by one for each day
 
	byte tick_counter;       // increased by one for each tick
 

	
 
	/* Begin Order-stuff */
 
	Order current_order;     ///< The current order (+ status, like: loading)
 
	VehicleOrderID cur_order_index; ///< The index to the current order
 

	
 
	Order *orders;           ///< Pointer to the first order for this vehicle
 
	VehicleOrderID num_orders;      ///< How many orders there are in the list
 

	
 
	Vehicle *next_shared;    ///< If not NULL, this points to the next vehicle that shared the order
 
	Vehicle *prev_shared;    ///< If not NULL, this points to the prev vehicle that shared the order
 
	/* End Order-stuff */
 

	
 
	/* Boundaries for the current position in the world and a next hash link.
 
	 * NOSAVE: All of those can be updated with VehiclePositionChanged() */
 
	int32 left_coord;
 
	int32 top_coord;
 
	int32 right_coord;
 
	int32 bottom_coord;
 
	Vehicle *next_hash;
 
	Vehicle *next_new_hash;
 
	Vehicle **old_new_hash;
 

	
 
	/* Related to age and service time */
 
	Date age;     // Age in days
 
	Date max_age; // Maximum age
 
	Date date_of_last_service;
 
	Date service_interval;
 
	uint16 reliability;
 
	uint16 reliability_spd_dec;
 
	byte breakdown_ctr;
 
	byte breakdown_delay;
 
	byte breakdowns_since_last_service;
 
	byte breakdown_chance;
 
	Year build_year;
 

	
 
	bool leave_depot_instantly; // NOSAVE: stores if the vehicle needs to leave the depot it just entered. Used by autoreplace
 

	
 
	uint16 load_unload_time_rem;
 
	byte vehicle_flags;         // Used for gradual loading and other miscellaneous things (@see VehicleFlags enum)
 

	
 
	Money profit_this_year;
 
	Money profit_last_year;
 
	Money value;
 

	
 
	GroupID group_id;              ///< Index of group Pool array
 

	
 
	/* Used for timetabling. */
 
	uint32 current_order_time;     ///< How many ticks have passed since this order started.
 
	int32 lateness_counter;        ///< How many ticks late (or early if negative) this vehicle is.
 

	
 
	SpriteID colormap; // NOSAVE: cached color mapping
 

	
 
	union {
 
		VehicleRail rail;
 
		VehicleAir air;
 
		VehicleRoad road;
 
		VehicleSpecial special;
 
		VehicleDisaster disaster;
 
		VehicleShip ship;
 
	} u;
 

	
 

	
 
	/**
 
	 * Allocates a lot of vehicles.
 
	 * @param vl pointer to an array of vehicles to get allocated. Can be NULL if the vehicles aren't needed (makes it test only)
 
	 * @param num number of vehicles to allocate room for
 
	 * @return true if there is room to allocate all the vehicles
 
	 */
 
	static bool AllocateList(Vehicle **vl, int num);
 

	
 
	/** Create a new vehicle */
 
	Vehicle();
 

	
 
	/** Destroy all stuff that (still) needs the virtual functions to work properly */
 
	void PreDestructor();
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Vehicle();
 

	
 
	void BeginLoading();
 
	void LeaveStation();
 

	
 
	/**
 
	 * Handle the loading of the vehicle; when not it skips through dummy
 
	 * orders and does nothing in all other cases.
 
	 * @param mode is the non-first call for this vehicle in this tick?
 
	 */
 
	void HandleLoading(bool mode = false);
 

	
 
	/**
 
	 * Get a string 'representation' of the vehicle type.
 
	 * @return the string representation.
 
	 */
 
	virtual const char* GetTypeString() const { return "base vehicle"; }
 

	
 
	/**
 
	 * Marks the vehicles to be redrawn and updates cached variables
 
	 *
 
	 * This method marks the area of the vehicle on the screen as dirty.
 
	 * It can be use to repaint the vehicle.
 
	 *
 
	 * @ingroup dirty
 
	 */
 
	virtual void MarkDirty() {}
 

	
 
	/**
 
	 * Updates the x and y offsets and the size of the sprite used
 
	 * for this vehicle.
 
	 * @param direction the direction the vehicle is facing
 
	 */
 
	virtual void UpdateDeltaXY(Direction direction) {}
 

	
 
	/**
 
	 * Sets the expense type associated to this vehicle type
 
	 * @param income whether this is income or (running) expenses of the vehicle
 
	 */
 
	virtual ExpensesType GetExpenseType(bool income) const { return EXPENSES_OTHER; }
 

	
 
	/**
 
	 * Invalidates the vehicle list window of this type of vehicle
 
	 */
 
	virtual WindowClass GetVehicleListWindowClass() const { return WC_NONE; }
 

	
 
	/**
 
	 * Play the sound associated with leaving the station
 
	 */
 
	virtual void PlayLeaveStationSound() const {}
 

	
 
	/**
 
	 * Whether this is the primary vehicle in the chain.
 
	 */
 
	virtual bool IsPrimaryVehicle() const { return false; }
 

	
 
	/**
 
	 * Gets the sprite to show for the given direction
 
	 * @param direction the direction the vehicle is facing
 
	 * @return the sprite for the given vehicle in the given direction
 
	 */
 
	virtual int GetImage(Direction direction) const { return 0; }
 

	
 
	/**
 
	 * Gets the speed in mph that can be sent into SetDParam for string processing.
 
	 * @return the vehicle's speed
 
	 */
 
	virtual int GetDisplaySpeed() const { return 0; }
 

	
 
	/**
 
	 * Gets the maximum speed in mph that can be sent into SetDParam for string processing.
 
	 * @return the vehicle's maximum speed
 
	 */
 
	virtual int GetDisplayMaxSpeed() const { return 0; }
 

	
 
	/**
 
	 * Gets the running cost of a vehicle
 
	 * @return the vehicle's running cost
 
	 */
 
	virtual Money GetRunningCost() const { return 0; }
 

	
 
	/**
 
	 * Check whether the vehicle is in the depot.
 
	 * @return true if and only if the vehicle is in the depot.
 
	 */
 
	virtual bool IsInDepot() const { return false; }
 

	
 
	/**
 
	 * Check whether the vehicle is in the depot *and* stopped.
 
	 * @return true if and only if the vehicle is in the depot and stopped.
 
	 */
 
	virtual bool IsStoppedInDepot() const { return this->IsInDepot() && (this->vehstatus & VS_STOPPED) != 0; }
 

	
 
	/**
 
	 * Calls the tick handler of the vehicle
 
	 */
 
	virtual void Tick() {};
 

	
 
	/**
 
	 * Gets the running cost of a vehicle  that can be sent into SetDParam for string processing.
 
	 * @return the vehicle's running cost
 
	 */
 
	Money GetDisplayRunningCost() const { return (this->GetRunningCost() >> 8); }
 

	
 
	/**
 
	 * Set the next vehicle of this vehicle.
 
	 * @param next the next vehicle. NULL removes the next vehicle.
 
	 */
 
	void SetNext(Vehicle *next);
 

	
 
	/**
 
	 * Get the next vehicle of this vehicle.
 
	 * @note articulated parts are also counted as vehicles.
 
	 * @return the next vehicle or NULL when there isn't a next vehicle.
 
	 */
 
	inline Vehicle *Next() const { return this->next; }
 

	
 
	/**
 
	 * Get the previous vehicle of this vehicle.
 
	 * @note articulated parts are also counted as vehicles.
 
	 * @return the previous vehicle or NULL when there isn't a previous vehicle.
 
	 */
 
	inline Vehicle *Previous() const { return this->previous; }
 

	
 
	/**
 
	 * Get the first vehicle of this vehicle chain.
 
	 * @return the first vehicle of the chain.
 
	 */
 
	inline Vehicle *First() const { return this->first; }
 
};
 

	
 
/**
 
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
 
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
 
 * and you reinitialize that to a Train using:
 
 *   v = new (v) Train();
 
 *
 
 * As side-effect the vehicle type is set correctly.
 
 *
 
 * A special vehicle is one of the following:
 
 *  - smoke
 
 *  - electric sparks for trains
 
 *  - explosions
 
 *  - bulldozer (road works)
 
 *  - bubbles (industry)
 
 */
 
struct SpecialVehicle : public Vehicle {
 
	/** Initializes the Vehicle to a special vehicle */
 
	SpecialVehicle() { this->type = VEH_SPECIAL; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~SpecialVehicle() {}
 

	
 
	const char *GetTypeString() const { return "special vehicle"; }
 
	void UpdateDeltaXY(Direction direction);
 
	void Tick();
 
};
 

	
 
/**
 
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
 
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
 
 * and you reinitialize that to a Train using:
 
 *   v = new (v) Train();
 
 *
 
 * As side-effect the vehicle type is set correctly.
 
 */
 
struct DisasterVehicle : public Vehicle {
 
	/** Initializes the Vehicle to a disaster vehicle */
 
	DisasterVehicle() { this->type = VEH_DISASTER; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~DisasterVehicle() {}
 

	
 
	const char *GetTypeString() const { return "disaster vehicle"; }
 
	void UpdateDeltaXY(Direction direction);
 
	void Tick();
 
};
 

	
 
/**
 
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
 
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
 
 * and you reinitialize that to a Train using:
 
 *   v = new (v) Train();
 
 *
 
 * As side-effect the vehicle type is set correctly.
 
 */
 
struct InvalidVehicle : public Vehicle {
 
	/** Initializes the Vehicle to a invalid vehicle */
 
	InvalidVehicle() { this->type = VEH_INVALID; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~InvalidVehicle() {}
 

	
 
	const char *GetTypeString() const { return "invalid vehicle"; }
 
	void Tick() {}
 
};
 

	
 
#define BEGIN_ENUM_WAGONS(v) do {
 
#define END_ENUM_WAGONS(v) } while ((v = v->Next()) != NULL);
 

	
 
static inline VehicleID GetMaxVehicleIndex()
 
{
 
	/* TODO - This isn't the real content of the function, but
 
	 *  with the new pool-system this will be replaced with one that
 
	 *  _really_ returns the highest index. Now it just returns
 
	 *  the next safe value we are sure about everything is below.
 
	 */
 
	return GetVehiclePoolSize() - 1;
 
}
 

	
 
static inline uint GetNumVehicles()
 
{
 
	return GetVehiclePoolSize();
 
}
 

	
 
#define FOR_ALL_VEHICLES_FROM(v, start) for (v = GetVehicle(start); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) if (v->IsValid())
 
#define FOR_ALL_VEHICLES(v) FOR_ALL_VEHICLES_FROM(v, 0)
 

	
 
/**
 
 * Check if an index is a vehicle-index (so between 0 and max-vehicles)
 
 * @param index of the vehicle to query
 
 * @return Returns true if the vehicle-id is in range
 
 */
 
static inline bool IsValidVehicleID(uint index)
 
{
 
	return index < GetVehiclePoolSize() && GetVehicle(index)->IsValid();
 
}
 

	
 
/* Returns order 'index' of a vehicle or NULL when it doesn't exists */
 
static inline Order *GetVehicleOrder(const Vehicle *v, int index)
 
{
 
	Order *order = v->orders;
 

	
 
	if (index < 0) return NULL;
 

	
 
	while (order != NULL && index-- > 0)
 
		order = order->next;
 

	
 
	return order;
 
}
 

	
 
/**
 
 * Returns the last order of a vehicle, or NULL if it doesn't exists
 
 * @param v Vehicle to query
 
 * @return last order of a vehicle, if available
 
 */
 
static inline Order *GetLastVehicleOrder(const Vehicle *v)
 
{
 
	Order *order = v->orders;
 

	
 
	if (order == NULL) return NULL;
 

	
 
	while (order->next != NULL)
 
		order = order->next;
 

	
 
	return order;
 
}
 

	
 
/** Get the first vehicle of a shared-list, so we only have to walk forwards
 
 * @param v Vehicle to query
 
 * @return first vehicle of a shared-list
 
 */
 
static inline Vehicle *GetFirstVehicleFromSharedList(const Vehicle *v)
 
{
 
	Vehicle *u = (Vehicle *)v;
 
	while (u->prev_shared != NULL) u = u->prev_shared;
 

	
 
	return u;
 
}
 

	
 
/**
 
 * Returns the Trackdir on which the vehicle is currently located.
 
 * Works for trains and ships.
 
 * Currently works only sortof for road vehicles, since they have a fuzzy
 
 * concept of being "on" a trackdir. Dunno really what it returns for a road
 
 * vehicle that is halfway a tile, never really understood that part. For road
 
 * vehicles that are at the beginning or end of the tile, should just return
 
 * the diagonal trackdir on which they are driving. I _think_.
 
 * For other vehicles types, or vehicles with no clear trackdir (such as those
 
 * in depots), returns 0xFF.
 
 */
 
Trackdir GetVehicleTrackdir(const Vehicle* v);
 

	
 
void CheckVehicle32Day(Vehicle *v);
 

	
 
#endif /* VEHICLE_BASE_H */
src/vehicle_func.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @vehicle.h Functions related to vehicles. */
 

	
 
#ifndef VEHICLE_FUNC_H
 
#define VEHICLE_FUNC_H
 

	
 
#include "tile_type.h"
 
#include "strings_type.h"
 
#include "gfx_type.h"
 
#include "direction_type.h"
 
#include "cargo_type.h"
 
#include "command_type.h"
 
#include "vehicle_type.h"
 

	
 
#define is_custom_sprite(x) (x >= 0xFD)
 
#define IS_CUSTOM_FIRSTHEAD_SPRITE(x) (x == 0xFD)
 
#define IS_CUSTOM_SECONDHEAD_SPRITE(x) (x == 0xFE)
 

	
 
typedef void *VehicleFromPosProc(Vehicle *v, void *data);
 

	
 
void VehicleServiceInDepot(Vehicle *v);
 
void VehiclePositionChanged(Vehicle *v);
 
Vehicle *GetLastVehicleInChain(Vehicle *v);
 
uint CountVehiclesInChain(const Vehicle *v);
 
bool IsEngineCountable(const Vehicle *v);
 
void DeleteVehicleChain(Vehicle *v);
 
void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
 
void *VehicleFromPosXY(int x, int y, void *data, VehicleFromPosProc *proc);
 
void CallVehicleTicks();
 
Vehicle *FindVehicleOnTileZ(TileIndex tile, byte z);
 
uint8 CalcPercentVehicleFilled(Vehicle *v, StringID *color);
 

	
 
void InitializeTrains();
 
byte VehicleRandomBits();
 
void ResetVehiclePosHash();
 
void ResetVehicleColorMap();
 

	
 
bool CanRefitTo(EngineID engine_type, CargoID cid_to);
 
CargoID FindFirstRefittableCargo(EngineID engine_type);
 
CommandCost GetRefitCost(EngineID engine_type);
 

	
 
void ViewportAddVehicles(DrawPixelInfo *dpi);
 

	
 
SpriteID GetRotorImage(const Vehicle *v);
 

	
 
uint32 VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y);
 

	
 
StringID VehicleInTheWayErrMsg(const Vehicle* v);
 
Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z, bool without_crashed = false);
 
Vehicle *GetVehicleTunnelBridge(TileIndex tile, TileIndex endtile);
 

	
 
bool UpdateSignalsOnSegment(TileIndex tile, DiagDirection direction);
 
void SetSignalsOnBothDir(TileIndex tile, byte track);
 

	
 
Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y);
 

	
 
void DecreaseVehicleValue(Vehicle *v);
 
void CheckVehicleBreakdown(Vehicle *v);
 
void AgeVehicle(Vehicle *v);
 
void VehicleEnteredDepotThisTick(Vehicle *v);
 

	
 
void BeginVehicleMove(Vehicle *v);
 
void EndVehicleMove(Vehicle *v);
 

	
 
UnitID GetFreeUnitNumber(VehicleType type);
 

	
 
void TrainConsistChanged(Vehicle *v);
 
void TrainPowerChanged(Vehicle *v);
 
Money GetTrainRunningCost(const Vehicle *v);
 

	
 
bool VehicleNeedsService(const Vehicle *v);
 

	
 
uint GenerateVehicleSortList(const Vehicle*** sort_list, uint16 *length_of_array, VehicleType type, PlayerID owner, uint32 index, uint16 window_type);
 
void BuildDepotVehicleList(VehicleType type, TileIndex tile, Vehicle ***engine_list, uint16 *engine_list_length, uint16 *engine_count, Vehicle ***wagon_list, uint16 *wagon_list_length, uint16 *wagon_count);
 
CommandCost SendAllVehiclesToDepot(VehicleType type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id);
 
void VehicleEnterDepot(Vehicle *v);
 

	
 
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g);
 

	
 
CommandCost MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs);
 
bool CanBuildVehicleInfrastructure(VehicleType type);
 

	
 
void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 
/* Flags to add to p2 for goto depot commands */
 
/* Note: bits 8-10 are used for VLW flags */
 
enum {
 
	DEPOT_SERVICE       = (1 << 0), // The vehicle will leave the depot right after arrival (serivce only)
 
	DEPOT_MASS_SEND     = (1 << 1), // Tells that it's a mass send to depot command (type in VLW flag)
 
	DEPOT_DONT_CANCEL   = (1 << 2), // Don't cancel current goto depot command if any
 
	DEPOT_LOCATE_HANGAR = (1 << 3), // Find another airport if the target one lacks a hangar
 
};
 

	
 
struct GetNewVehiclePosResult {
 
	int x, y;
 
	TileIndex old_tile;
 
	TileIndex new_tile;
 
};
 

	
 
/* returns true if staying in the same tile */
 
GetNewVehiclePosResult GetNewVehiclePos(const Vehicle *v);
 
Direction GetDirectionTowards(const Vehicle *v, int x, int y);
 

	
 
static inline bool IsPlayerBuildableVehicleType(VehicleType type)
 
{
 
	switch (type) {
 
		case VEH_TRAIN:
 
		case VEH_ROAD:
 
		case VEH_SHIP:
 
		case VEH_AIRCRAFT:
 
			return true;
 

	
 
		default: return false;
 
	}
 
}
 

	
 
static inline bool IsPlayerBuildableVehicleType(const BaseVehicle *v)
 
{
 
	return IsPlayerBuildableVehicleType(v->type);
 
}
 

	
 
const struct Livery *GetEngineLivery(EngineID engine_type, PlayerID player, EngineID parent_engine_type, const Vehicle *v);
 

	
 
/**
 
 * Get the colour map for an engine. This used for unbuilt engines in the user interface.
 
 * @param engine_type ID of engine
 
 * @param player ID of player
 
 * @return A ready-to-use palette modifier
 
 */
 
SpriteID GetEnginePalette(EngineID engine_type, PlayerID player);
 

	
 
/**
 
 * Get the colour map for a vehicle.
 
 * @param v Vehicle to get colour map for
 
 * @return A ready-to-use palette modifier
 
 */
 
SpriteID GetVehiclePalette(const Vehicle *v);
 

	
 
/* A lot of code calls for the invalidation of the status bar, which is widget 5.
 
 * Best is to have a virtual value for it when it needs to change again */
 
#define STATUS_BAR 5
 

	
 
extern const uint32 _veh_build_proc_table[];
 
extern const uint32 _veh_sell_proc_table[];
 
extern const uint32 _veh_refit_proc_table[];
 
extern const uint32 _send_to_depot_proc_table[];
 

	
 
/* Functions to find the right command for certain vehicle type */
 
static inline uint32 GetCmdBuildVeh(VehicleType type)
 
{
 
	return _veh_build_proc_table[type];
 
}
 

	
 
static inline uint32 GetCmdBuildVeh(const BaseVehicle *v)
 
{
 
	return GetCmdBuildVeh(v->type);
 
}
 

	
 
static inline uint32 GetCmdSellVeh(VehicleType type)
 
{
 
	return _veh_sell_proc_table[type];
 
}
 

	
 
static inline uint32 GetCmdSellVeh(const BaseVehicle *v)
 
{
 
	return GetCmdSellVeh(v->type);
 
}
 

	
 
static inline uint32 GetCmdRefitVeh(VehicleType type)
 
{
 
	return _veh_refit_proc_table[type];
 
}
 

	
 
static inline uint32 GetCmdRefitVeh(const BaseVehicle *v)
 
{
 
	return GetCmdRefitVeh(v->type);
 
}
 

	
 
static inline uint32 GetCmdSendToDepot(VehicleType type)
 
{
 
	return _send_to_depot_proc_table[type];
 
}
 

	
 
static inline uint32 GetCmdSendToDepot(const BaseVehicle *v)
 
{
 
	return GetCmdSendToDepot(v->type);
 
}
 

	
 
bool EnsureNoVehicleOnGround(TileIndex tile);
 
void StopAllVehicles();
 

	
 
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type);
 
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicle type);
 
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicle type);
 

	
 
extern VehicleID _vehicle_id_ctr_day;
 
extern Vehicle *_place_clicked_vehicle;
 
extern VehicleID _new_vehicle_id;
 
extern uint16 _returned_refit_capacity;
 

	
 
#endif /* VEHICLE_H */
src/vehicle_gui.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file vehicle_gui.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "player.h"
 
#include "station.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "vehicle.h"
 
#include "engine.h"
 
#include "gui.h"
 
#include "window_gui.h"
 
#include "textbuf_gui.h"
 
#include "command_func.h"
 
#include "variables.h"
 
#include "vehicle_gui.h"
 
#include "viewport.h"
 
#include "train.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_engine.h"
 
#include "newgrf_text.h"
 
#include "ship.h"
 
#include "aircraft.h"
 
#include "roadveh.h"
 
#include "depot.h"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "group_gui.h"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 
struct Sorting {
 
	Listing aircraft;
 
	Listing roadveh;
 
	Listing ship;
 
	Listing train;
 
};
 

	
 
static Sorting _sorting;
 

	
 
static bool   _internal_sort_order;     // descending/ascending
 

	
 
@@ -995,25 +995,25 @@ static void DrawVehicleListWindow(Window
 
	DrawString(85, 15, _vehicle_sort_listing[vl->l.sort_type], TC_BLACK);
 
	/* draw arrow pointing up/down for ascending/descending sorting */
 
	DoDrawString(vl->l.flags & VL_DESC ? DOWNARROW : UPARROW, 69, 15, TC_BLACK);
 

	
 
	max = min(w->vscroll.pos + w->vscroll.cap, vl->l.list_length);
 
	for (i = w->vscroll.pos; i < max; ++i) {
 
		const Vehicle *v = vl->sort_list[i];
 
		StringID str;
 

	
 
		SetDParam(0, v->profit_this_year);
 
		SetDParam(1, v->profit_last_year);
 

	
 
		DrawVehicleImage(v, x + 19, y + 6, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0, INVALID_VEHICLE);
 
		DrawVehicleImage(v, x + 19, y + 6, INVALID_VEHICLE, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0);
 
		DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
 

	
 
		if ((v->type == VEH_TRAIN    && v->string_id != STR_SV_TRAIN_NAME)   ||
 
			(v->type == VEH_ROAD     && v->string_id != STR_SV_ROADVEH_NAME) ||
 
			(v->type == VEH_SHIP     && v->string_id != STR_SV_SHIP_NAME)    ||
 
			(v->type == VEH_AIRCRAFT && v->string_id != STR_SV_AIRCRAFT_NAME)) {
 

	
 
			/* The vehicle got a name so we will print it */
 
			SetDParam(0, v->index);
 
			DrawString(x + 19, y, STR_01AB, TC_FROMSTRING);
 
		}
 

	
 
@@ -1535,25 +1535,25 @@ static void DrawVehicleDetailsWindow(Win
 
	SetDParam(0, v->service_interval);
 
	SetDParam(1, v->date_of_last_service);
 
	DrawString(13, w->height - (v->type != VEH_TRAIN ? 11 : 23), _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING);
 

	
 
	switch (v->type) {
 
		case VEH_TRAIN:
 
			DrawVehicleDetails(v, 2, 57, w->vscroll.pos, w->vscroll.cap, det_tab);
 
			break;
 

	
 
		case VEH_ROAD:
 
		case VEH_SHIP:
 
		case VEH_AIRCRAFT:
 
			DrawVehicleImage(v, 3, 57, 0, 0, INVALID_VEHICLE);
 
			DrawVehicleImage(v, 3, 57, INVALID_VEHICLE, 0, 0);
 
			DrawVehicleDetails(v, 75, 57, w->vscroll.pos, w->vscroll.cap, det_tab);
 
			break;
 

	
 
		default: NOT_REACHED();
 
	}
 
}
 

	
 
/** Message strings for renaming vehicles indexed by vehicle type. */
 
static const StringID _name_vehicle_title[] = {
 
	STR_8865_NAME_TRAIN,
 
	STR_902C_NAME_ROAD_VEHICLE,
 
	STR_9831_NAME_SHIP,
 
@@ -2159,12 +2159,23 @@ static void VehicleViewWndProc(Window *w
 
			if (veh_stopped != w->IsWidgetHidden(VVW_WIDGET_GOTO_DEPOT) || veh_stopped == w->IsWidgetHidden(VVW_WIDGET_CLONE_VEH)) {
 
				w->SetWidgetHiddenState( VVW_WIDGET_GOTO_DEPOT, veh_stopped);  // send to depot
 
				w->SetWidgetHiddenState(VVW_WIDGET_CLONE_VEH, !veh_stopped); // clone
 
				if (v->type == VEH_ROAD || v->type == VEH_TRAIN) {
 
					w->SetWidgetHiddenState( VVW_WIDGET_REFIT_VEH, !veh_stopped); // refit
 
					w->SetWidgetHiddenState(VVW_WIDGET_TURN_AROUND, veh_stopped);  // force turn around
 
				}
 
				SetWindowDirty(w);
 
			}
 
		} break;
 
	}
 
}
 

	
 
void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip)
 
{
 
	switch (v->type) {
 
		case VEH_TRAIN:    DrawTrainImage(v, x, y, selection, count, skip); break;
 
		case VEH_ROAD:     DrawRoadVehImage(v, x, y, selection, count);     break;
 
		case VEH_SHIP:     DrawShipImage(v, x, y, selection);               break;
 
		case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection);           break;
 
		default: NOT_REACHED();
 
	}
 
}
src/vehicle_gui.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file vehicle_gui.h */
 

	
 
#ifndef VEHICLE_GUI_H
 
#define VEHICLE_GUI_H
 

	
 
#include "window_gui.h"
 
#include "vehicle.h"
 
#include "vehicle_type.h"
 

	
 
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
 
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order);
 
void InitializeVehiclesGuiList();
 

	
 
/* sorter stuff */
 
void RebuildVehicleLists();
 
void ResortVehicleLists();
 
void SortVehicleList(vehiclelist_d *vl);
 
void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type);
 

	
 
#define PERIODIC_RESORT_DAYS 10
 
@@ -41,53 +41,44 @@ enum {
 
	VLW_MASK          = 0x700,
 
};
 

	
 
static inline bool ValidVLWFlags(uint16 flags)
 
{
 
	return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST);
 
}
 

	
 
void PlayerVehWndProc(Window *w, WindowEvent *e);
 

	
 
int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number);
 

	
 
void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection);
 
void DrawRoadVehImage(const Vehicle *v, int x, int y, int count, VehicleID selection);
 
void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip);
 
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count);
 
void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection);
 
void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection);
 

	
 
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type);
 

	
 
void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v);
 

	
 
uint ShowAdditionalText(int x, int y, uint w, EngineID engine);
 
uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine);
 

	
 
void ShowVehicleListWindow(const Vehicle *v);
 
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type);
 
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, StationID station);
 
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type, TileIndex depot_tile);
 

	
 
void ShowReplaceVehicleWindow(VehicleType vehicletype);
 
void DrawSmallOrderList(const Vehicle *v, int x, int y);
 
void ShowReplaceGroupVehicleWindow(GroupID group, VehicleType veh);
 

	
 
static inline void DrawVehicleImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection)
 
{
 
	switch (v->type) {
 
		case VEH_TRAIN:    DrawTrainImage(v, x, y, count, skip, selection); break;
 
		case VEH_ROAD:     DrawRoadVehImage(v, x, y, count, selection);     break;
 
		case VEH_SHIP:     DrawShipImage(v, x, y, selection);               break;
 
		case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection);           break;
 
		default: NOT_REACHED();
 
	}
 
}
 
void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip);
 

	
 
static inline uint GetVehicleListHeight(VehicleType type)
 
{
 
	return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
 
}
 

	
 
/* Unified window procedure */
 
void ShowVehicleViewWindow(const Vehicle *v);
 

	
 
#endif /* VEHICLE_GUI_H */
src/vehicle_type.h
Show inline comments
 
@@ -16,13 +16,40 @@ enum VehicleType {
 
	VEH_AIRCRAFT,
 
	VEH_SPECIAL,
 
	VEH_DISASTER,
 
	VEH_END,
 
	VEH_INVALID = 0xFF,
 
};
 
DECLARE_POSTFIX_INCREMENT(VehicleType);
 
template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID> {};
 
typedef TinyEnumT<VehicleType> VehicleTypeByte;
 

	
 
struct Vehicle;
 

	
 
struct BaseVehicle
 
{
 
	VehicleTypeByte type;    ///< Type of vehicle
 

	
 
	/**
 
	 * Is this vehicle a valid vehicle?
 
	 * @return true if and only if the vehicle is valid.
 
	 */
 
	inline bool IsValid() const { return this->type != VEH_INVALID; }
 
};
 

	
 
static const VehicleID INVALID_VEHICLE = 0xFFFF;
 

	
 
/* Effect vehicle types */
 
enum EffectVehicle {
 
	EV_CHIMNEY_SMOKE   = 0,
 
	EV_STEAM_SMOKE     = 1,
 
	EV_DIESEL_SMOKE    = 2,
 
	EV_ELECTRIC_SPARK  = 3,
 
	EV_SMOKE           = 4,
 
	EV_EXPLOSION_LARGE = 5,
 
	EV_BREAKDOWN_SMOKE = 6,
 
	EV_EXPLOSION_SMALL = 7,
 
	EV_BULLDOZER       = 8,
 
	EV_BUBBLE          = 9
 
};
 

	
 
#endif /* VEHICLE_TYPE_H */
src/viewport.cpp
Show inline comments
 
@@ -3,37 +3,37 @@
 
/** @file viewport.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "tile_cmd.h"
 
#include "gui.h"
 
#include "spritecache.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "landscape.h"
 
#include "viewport.h"
 
#include "vehicle.h"
 
#include "station.h"
 
#include "town.h"
 
#include "signs.h"
 
#include "waypoint.h"
 
#include "variables.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "vehicle_gui.h"
 
#include "blitter/factory.hpp"
 
#include "transparency.h"
 
#include "strings_func.h"
 
#include "zoom_func.h"
 
#include "vehicle_func.h"
 

	
 
#define VIEWPORT_DRAW_MEM (65536 * 2)
 

	
 
ZoomLevel _saved_scrollpos_zoom;
 

	
 
/**
 
 * The maximum number of viewports depends on the maximum number
 
 * of windows. Technically is could be the maximum number of
 
 * windows, but there is always at least one window that does
 
 * not need a viewport. Not having 'support' for that viewport
 
 * saves some time and memory.
 
 * For the introduction GUI and create game GUIs there is no
src/water_cmd.cpp
Show inline comments
 
@@ -3,44 +3,44 @@
 
/** @file water_cmd.cpp */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "bridge_map.h"
 
#include "bridge.h"
 
#include "cmd_helper.h"
 
#include "station_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "tile_cmd.h"
 
#include "landscape.h"
 
#include "vehicle.h"
 
#include "viewport.h"
 
#include "command_func.h"
 
#include "town.h"
 
#include "news.h"
 
#include "sound.h"
 
#include "depot.h"
 
#include "vehicle_gui.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "water.h"
 
#include "water_map.h"
 
#include "industry_map.h"
 
#include "newgrf.h"
 
#include "newgrf_canal.h"
 
#include "misc/autoptr.hpp"
 
#include "transparency.h"
 
#include "strings_func.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "vehicle_func.h"
 

	
 
/** Array for the shore sprites */
 
static const SpriteID _water_shore_sprites[] = {
 
	0,
 
	SPR_SHORE_TILEH_1,  // SLOPE_W
 
	SPR_SHORE_TILEH_2,  // SLOPE_S
 
	SPR_SHORE_TILEH_3,  // SLOPE_SW
 
	SPR_SHORE_TILEH_4,  // SLOPE_E
 
	0,
 
	SPR_SHORE_TILEH_6,  // SLOPE_SE
 
	0,
 
	SPR_SHORE_TILEH_8,  // SLOPE_N
src/waypoint.cpp
Show inline comments
 
@@ -8,35 +8,36 @@
 
#include "command_func.h"
 
#include "landscape.h"
 
#include "order.h"
 
#include "rail_map.h"
 
#include "rail.h"
 
#include "bridge_map.h"
 
#include "saveload.h"
 
#include "station.h"
 
#include "town.h"
 
#include "waypoint.h"
 
#include "variables.h"
 
#include "table/strings.h"
 
#include "vehicle.h"
 
#include "yapf/yapf.h"
 
#include "newgrf.h"
 
#include "string.h"
 
#include "misc/autoptr.hpp"
 
#include "strings_func.h"
 
#include "viewport.h"
 
#include "functions.h"
 
#include "window_func.h"
 
#include "economy_func.h"
 
#include "date_func.h"
 
#include "vehicle_func.h"
 
#include "vehicle_base.h"
 

	
 
enum {
 
	MAX_WAYPOINTS_PER_TOWN = 64,
 
};
 

	
 
DEFINE_OLD_POOL_GENERIC(Waypoint, Waypoint)
 

	
 

	
 
/**
 
 * Update the sign for the waypoint
 
 * @param wp Waypoint to update sign */
 
static void UpdateWaypointSign(Waypoint* wp)
src/window.cpp
Show inline comments
 
@@ -7,26 +7,26 @@
 
#include "openttd.h"
 
#include "debug.h"
 
#include "player.h"
 
#include "viewport.h"
 
#include "console.h"
 
#include "variables.h"
 
#include "table/sprites.h"
 
#include "genworld.h"
 
#include "blitter/factory.hpp"
 
#include "window_gui.h"
 
#include "zoom_func.h"
 
#include "core/alloc_func.hpp"
 
#include "vehicle.h"
 
#include "map_func.h"
 
#include "vehicle_base.h"
 

	
 
/* delta between mouse cursor and upper left corner of dragged window */
 
static Point _drag_delta;
 

	
 
static Window _windows[MAX_NUMBER_OF_WINDOWS];
 
Window *_z_windows[lengthof(_windows)];
 
Window **_last_z_window; ///< always points to the next free space in the z-array
 

	
 
void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...)
 
{
 
	va_list wdg_list;
 

	
src/yapf/yapf.hpp
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef  YAPF_HPP
 
#define  YAPF_HPP
 

	
 

	
 

	
 
#include "track_dir.hpp"
 

	
 
#include "../vehicle.h"
 
#include "../vehicle_base.h"
 
#include "../depot.h"
 
#include "../road_map.h"
 
#include "../tunnel_map.h"
 
#include "../bridge_map.h"
 
#include "../tunnelbridge_map.h"
 
#include "../bridge.h"
 
#include "../station.h"
 
#include "../station_map.h"
 
#include "../tile_cmd.h"
 
#include "../landscape.h"
 
#include "yapf.h"
 
#include "../pathfind.h"
src/yapf/yapf_rail.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file yapf_rail.cpp */
 

	
 
#include "../stdafx.h"
 

	
 
#include "yapf.hpp"
 
#include "yapf_node_rail.hpp"
 
#include "yapf_costrail.hpp"
 
#include "yapf_destrail.hpp"
 
#include "../vehicle_func.h"
 

	
 
#define DEBUG_YAPF_CACHE 0
 

	
 
int _total_pf_time_us = 0;
 

	
 

	
 

	
 

	
 

	
 
template <class Types>
 
class CYapfFollowAnyDepotRailT
 
{
0 comments (0 inline, 0 general)