Changeset - r6980:3b43790d6e21
[Not reviewed]
master
0 21 0
maedhros - 17 years ago 2007-06-20 19:17:22
maedhros@openttd.org
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
21 files changed with 147 insertions and 13 deletions:
0 comments (0 inline, 0 general)
config.lib
Show inline comments
 
@@ -312,19 +312,19 @@ check_params() {
 
	if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then
 
		echo "configure: error: invalid option --os=$os"
 
		echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]"
 
		exit 1
 
	fi
 
	# cpu_type can be either 32 or 64
 
	if [ -z "`echo $cpu_type | grep '^32$\|^64$\|^DETECT$'`" ]; then
 
	if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
 
		echo "configure: error: invalid option --cpu-type=$cpu_type"
 
		echo " Available options are: --cpu-type[=DETECT|32|64]"
 
		exit 1
 
	fi
 
	# enable_debug should be between 0 and 4
 
	if [ -z "`echo $enable_debug | grep '^[0123]$'`" ]; then
 
	if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then
 
		echo "configure: error: invalid option --enable-debug=$enable_debug"
 
		echo " Available options are: --enable-debug[=0123]"
 
		exit 1
 
	fi
 

	
 
	detect_awk
 
@@ -1509,38 +1509,38 @@ detect_library() {
 
		return 0
 
	fi
 

	
 
	log 2 "detecting $2"
 

	
 
	if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
 
		eval "$2=`ls -1 /usr/include/*.h 2>/dev/null | grep \"\/$4\$\"`"
 
		eval "$2=`ls -1 /usr/include/*.h 2>/dev/null | egrep \"\/$4\$\"`"
 
		eval "res=\$$2"
 
		if [ -z "$res" ]; then
 
			log 2 "  trying /usr/include/$4... no"
 
			eval "$2=`ls -1 /usr/local/include/*.h 2>/dev/null | grep \"\/$4\$\"`"
 
			eval "$2=`ls -1 /usr/local/include/*.h 2>/dev/null | egrep \"\/$4\$\"`"
 
		fi
 
		eval "res=\$$2"
 
		if [ -z "$res" ]; then
 
			log 2 "  trying /usr/local/include/$4... no"
 
		fi
 

	
 
		eval "res=\$$2"
 
		if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
 
			eval "res=\$$2"
 
			log 2 "  trying $res... found"
 
			# Now find the static lib, if needed
 
			eval "$2=`ls /lib/*.a 2>/dev/null | grep \"\/$3\$\"`"
 
			eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
 
			eval "res=\$$2"
 
			if [ -z "$res" ]; then
 
				log 2 "  trying /lib/$3... no"
 
				eval "$2=`ls /usr/lib/*.a 2>/dev/null | grep \"\/$3\$\"`"
 
				eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
 
			fi
 
			eval "res=\$$2"
 
			if [ -z "$res" ]; then
 
				log 2 "  trying /usr/lib/$3... no"
 
				eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | grep \"\/$3\$\"`"
 
				eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
 
			fi
 
			eval "res=\$$2"
 
			if [ -z "$res" ]; then
 
				log 2 "  trying /usr/local/lib/$3... no"
 
				log 1 "configure: error: $2 couldn't be found"
 
				log 1 "configure: error: you requested a static link, but I can't find $3"
 
@@ -1910,13 +1910,13 @@ make_sed() {
 
	# We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL
 
	#  We do this here, and not sooner, so universal builds also have this
 
	#  automatically correct
 
	# FOUR_BYTE_BOOL is needed, because C++ uses 4byte for a bool on PPC, where
 
	#  we use 1 byte per bool normally in C part. So convert that last one to 4
 
	#  bytes too, but only for PPC.
 
	ppc=`$cc_host -dumpmachine | grep "powerpc\|ppc"`
 
	ppc=`$cc_host -dumpmachine | egrep "powerpc|ppc"`
 
	if [ -n "$ppc" ]; then
 
		T_CFLAGS="$CFLAGS -DFOUR_BYTE_BOOL"
 
		osx_sysroot_version=10.3.9
 
	else
 
		T_CFLAGS="$CFLAGS"
 
		osx_sysroot_version=10.4u
projects/openttd.vcproj
Show inline comments
 
@@ -651,12 +651,15 @@
 
				RelativePath=".\..\src\thread.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\tile.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\timetable.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\town.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train.h">
 
			</File>
 
			<File
 
@@ -787,12 +790,15 @@
 
				RelativePath=".\..\src\subsidy_gui.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\terraform_gui.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\timetable_gui.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\town_gui.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train_gui.cpp">
 
			</File>
 
			<File
 
@@ -842,12 +848,15 @@
 
				RelativePath=".\..\src\ship_cmd.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\station_cmd.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\timetable_cmd.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\town_cmd.cpp">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train_cmd.cpp">
 
			</File>
 
			<File
projects/openttd_vs80.vcproj
Show inline comments
 
@@ -1097,12 +1097,16 @@
 
			</File>
 
			<File
 
				RelativePath=".\..\src\tile.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\timetable.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\town.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train.h"
 
				>
 
@@ -1277,12 +1281,16 @@
 
			</File>
 
			<File
 
				RelativePath=".\..\src\terraform_gui.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\timetable_gui.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\town_gui.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train_gui.cpp"
 
				>
 
@@ -1349,12 +1357,16 @@
 
			</File>
 
			<File
 
				RelativePath=".\..\src\station_cmd.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\timetable_cmd.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\town_cmd.cpp"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train_cmd.cpp"
 
				>
source.list
Show inline comments
 
@@ -182,12 +182,13 @@ spritecache.h
 
station.h
 
stdafx.h
 
string.h
 
tgp.h
 
thread.h
 
tile.h
 
timetable.h
 
town.h
 
train.h
 
transparency_gui.h
 
variables.h
 
vehicle.h
 
vehicle_gui.h
 
@@ -228,12 +229,13 @@ settings_gui.cpp
 
ship_gui.cpp
 
signs_gui.cpp
 
smallmap_gui.cpp
 
station_gui.cpp
 
subsidy_gui.cpp
 
terraform_gui.cpp
 
timetable_gui.cpp
 
town_gui.cpp
 
train_gui.cpp
 
transparency_gui.cpp
 
vehicle_gui.cpp
 

	
 
# Landscape
 
@@ -247,12 +249,13 @@ misc_cmd.cpp
 
order_cmd.cpp
 
rail_cmd.cpp
 
road_cmd.cpp
 
roadveh_cmd.cpp
 
ship_cmd.cpp
 
station_cmd.cpp
 
timetable_cmd.cpp
 
town_cmd.cpp
 
train_cmd.cpp
 
tree_cmd.cpp
 
tunnelbridge_cmd.cpp
 
unmovable_cmd.cpp
 
water_cmd.cpp
src/aircraft_cmd.cpp
Show inline comments
 
@@ -11,12 +11,13 @@
 
#include "landscape.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "depot.h"
 
#include "engine.h"
 
#include "command.h"
 
#include "station.h"
 
#include "news.h"
 
#include "sound.h"
 
@@ -1346,12 +1347,13 @@ static void ProcessAircraftOrder(Vehicle
 
	switch (v->current_order.type) {
 
		case OT_GOTO_DEPOT:
 
			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
 
			if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
 
					!VehicleNeedsService(v)) {
 
				v->cur_order_index++;
 
				UpdateVehicleTimetable(v, true);
 
			}
 
			break;
 

	
 
		case OT_LOADING: return;
 

	
 
		default: break;
 
@@ -2083,12 +2085,13 @@ static bool AirportFindFreeHelipad(Vehic
 
	return false; // it shouldn't get here anytime, but just to be sure
 
}
 

	
 
static void AircraftEventHandler(Vehicle *v, int loop)
 
{
 
	v->tick_counter++;
 
	v->current_order_time++;
 

	
 
	if (v->vehstatus & VS_CRASHED) {
 
		HandleCrashedAircraft(v);
 
		return;
 
	}
 

	
src/command.cpp
Show inline comments
 
@@ -174,12 +174,14 @@ DEF_COMMAND(CmdDeleteGroup);
 
DEF_COMMAND(CmdAddVehicleGroup);
 
DEF_COMMAND(CmdAddSharedVehicleGroup);
 
DEF_COMMAND(CmdRemoveAllVehiclesGroup);
 
DEF_COMMAND(CmdSetGroupReplaceProtection);
 

	
 
DEF_COMMAND(CmdMoveOrder);
 
DEF_COMMAND(CmdChangeTimetable);
 
DEF_COMMAND(CmdSetVehicleOnTime);
 

	
 
/* The master command table */
 
static const Command _command_proc_table[] = {
 
	{CmdBuildRailroadTrack,                  0}, /*   0 */
 
	{CmdRemoveRailroadTrack,                 0}, /*   1 */
 
	{CmdBuildSingleRail,                     0}, /*   2 */
 
@@ -328,12 +330,14 @@ static const Command _command_proc_table
 
	{CmdRenameGroup,                         0}, /* 122 */
 
	{CmdAddVehicleGroup,                     0}, /* 123 */
 
	{CmdAddSharedVehicleGroup,               0}, /* 124 */
 
	{CmdRemoveAllVehiclesGroup,              0}, /* 125 */
 
	{CmdSetGroupReplaceProtection,           0}, /* 126 */
 
	{CmdMoveOrder,                           0}, /* 127 */
 
	{CmdChangeTimetable,                     0}, /* 128 */
 
	{CmdSetVehicleOnTime,                    0}, /* 129 */
 
};
 

	
 
/* This function range-checks a cmd, and checks if the cmd is not NULL */
 
bool IsValidCommand(uint cmd)
 
{
 
	cmd &= 0xFF;
src/command.h
Show inline comments
 
@@ -150,12 +150,14 @@ enum {
 
	CMD_ADD_VEHICLE_GROUP            = 123,
 
	CMD_ADD_SHARED_VEHICLE_GROUP     = 124,
 
	CMD_REMOVE_ALL_VEHICLES_GROUP    = 125,
 
	CMD_SET_GROUP_REPLACE_PROTECTION = 126,
 

	
 
	CMD_MOVE_ORDER                   = 127,
 
	CMD_CHANGE_TIMETABLE             = 128,
 
	CMD_SET_VEHICLE_ON_TIME          = 129,
 
};
 

	
 
enum {
 
	DC_EXEC            = 0x01,
 
	DC_AUTO            = 0x02, ///< don't allow building on structures
 
	DC_QUERY_COST      = 0x04, ///< query cost only,  don't build.
src/lang/english.txt
Show inline comments
 
@@ -1100,12 +1100,14 @@ STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING
 
STR_CONFIG_PATCHES_SCROLLWHEEL_ZOOM                             :Zoom map
 
STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLL                           :Scroll map
 
STR_CONFIG_PATCHES_SCROLLWHEEL_OFF                              :Off
 
STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER                       :{LTBLUE}Map scrollwheel speed: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME                            :{LTBLUE}Automatically pause when starting a new game: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS                       :{LTBLUE}Use the advanced vehicle list: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_TIMETABLE_ALLOW                              :{LTBLUE}Enable timetabling for vehicles: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS                           :{LTBLUE}Show timetable in ticks rather than days: {ORANGE}{STRING1}
 

	
 
STR_CONFIG_PATCHES_MAX_TRAINS                                   :{LTBLUE}Max trains per player: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_MAX_ROADVEH                                  :{LTBLUE}Max road vehicles per player: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_MAX_AIRCRAFT                                 :{LTBLUE}Max aircraft per player: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_MAX_SHIPS                                    :{LTBLUE}Max ships per player: {ORANGE}{STRING1}
 

	
 
@@ -2604,12 +2606,19 @@ STR_8810_GO_NON_STOP_TO_LOAD            
 
STR_8811_GO_TO_NON_STOP_TRANSFER_LOAD                           :Go non-stop to {STATION} (Transfer and wait for full load)
 
STR_GO_TO_TRAIN_DEPOT                                           :Go to {TOWN} Train Depot
 
STR_SERVICE_AT_TRAIN_DEPOT                                      :Service at {TOWN} Train Depot
 
STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT                             :Go non-stop to {TOWN} Train Depot
 
STR_SERVICE_NON_STOP_AT_TRAIN_DEPOT                             :Service non-stop at {TOWN} Train Depot
 

	
 
STR_TIMETABLE_GO_TO                                             :{STRING1} {STRING2}
 
STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Travel (not timetabled)
 
STR_TIMETABLE_TRAVEL_FOR                                        :Travel for {STRING1}
 
STR_TIMETABLE_STAY_FOR                                          :and stay for {STRING1}
 
STR_TIMETABLE_DAYS                                              :{COMMA} day{P "" s}
 
STR_TIMETABLE_TICKS                                             :{COMMA} tick{P "" s}
 

	
 
STR_HEADING_FOR_TRAIN_DEPOT                                     :{ORANGE}Heading for {TOWN} Train Depot
 
STR_HEADING_FOR_TRAIN_DEPOT_VEL                                 :{ORANGE}Heading for {TOWN} Train Depot, {VELOCITY}
 
STR_HEADING_FOR_TRAIN_DEPOT_SERVICE                             :{LTBLUE}Service at {TOWN} Train Depot
 
STR_HEADING_FOR_TRAIN_DEPOT_SERVICE_VEL                         :{LTBLUE}Service at {TOWN} Train Depot, {VELOCITY}
 

	
 
STR_INVALID_ORDER                                               :{RED} (Invalid Order)
 
@@ -2645,12 +2654,14 @@ STR_8825_NON_STOP                       
 
STR_8826_GO_TO                                                  :{BLACK}Go To
 
STR_8827_FULL_LOAD                                              :{BLACK}Full Load
 
STR_8828_UNLOAD                                                 :{BLACK}Unload
 
STR_REFIT                                                       :{BLACK}Refit
 
STR_REFIT_TIP                                                   :{BLACK}Select what cargo type to refit to in this order. Control click to remove refit instruction
 
STR_REFIT_ORDER                                                 :(Refit to {STRING})
 
STR_TIMETABLE_VIEW                                              :{BLACK}Timetable
 
STR_TIMETABLE_VIEW_TOOLTIP                                      :{BLACK}Switch to the timetable view
 
STR_8829_ORDERS                                                 :{WHITE}{VEHICLE} (Orders)
 
STR_882A_END_OF_ORDERS                                          :{SETX 10}- - End of Orders - -
 
STR_FULLLOAD_OR_SERVICE                                         :{SKIP}{SKIP}{STRING}
 
STR_SERVICE                                                     :{BLACK}Service
 
STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE                           :{WHITE}Can't build railway vehicle...
 
STR_882C_BUILT_VALUE                                            :{LTBLUE}{STRING}{BLACK}   Built: {LTBLUE}{NUM}{BLACK} Value: {LTBLUE}{CURRENCY}
 
@@ -2701,12 +2712,16 @@ STR_8852_ORDERS_LIST_CLICK_ON_ORDER     
 
STR_8853_SKIP_THE_CURRENT_ORDER                                 :{BLACK}Skip the current order, and start the next. CTRL + click skips to the selected order
 
STR_8854_DELETE_THE_HIGHLIGHTED                                 :{BLACK}Delete the highlighted order
 
STR_8855_MAKE_THE_HIGHLIGHTED_ORDER                             :{BLACK}Make the highlighted order non-stop
 
STR_8856_INSERT_A_NEW_ORDER_BEFORE                              :{BLACK}Insert a new order before the highlighted order, or add to end of list
 
STR_8857_MAKE_THE_HIGHLIGHTED_ORDER                             :{BLACK}Make the highlighted order force the vehicle to wait for a full load
 
STR_8858_MAKE_THE_HIGHLIGHTED_ORDER                             :{BLACK}Make the highlighted order force the vehicle to unload
 
STR_TIMETABLE_TOOLTIP                                           :{BLACK}Timetable - click on an order to highlight it.
 
STR_TIMETABLE_WAIT_TIME_TOOLTIP                                 :{BLACK}Change the amount of time that the highlighted order should take
 
STR_TIMETABLE_CLEAR_TIME_TOOLTIP                                :{BLACK}Clear the amount of time for the highlighted order
 
STR_TIMETABLE_RESET_LATENESS_TOOLTIP                            :{BLACK}Reset the lateness counter, so the vehicle will be on time
 
STR_SERVICE_HINT                                                :{BLACK}Skip this order unless a service is needed
 
STR_VEHICLE_INFO_COST_WEIGHT_SPEED_POWER                        :{BLACK}Cost: {CURRENCY} Weight: {WEIGHT_S}{}Speed: {VELOCITY}  Power: {POWER}{}Running Cost: {CURRENCY}/yr{}Capacity: {CARGO}
 
STR_885C_BROKEN_DOWN                                            :{RED}Broken down
 
STR_885D_AGE_RUNNING_COST_YR                                    :{BLACK}Age: {LTBLUE}{STRING2}{BLACK}   Running Cost: {LTBLUE}{CURRENCY}/yr
 
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED                         :{BLACK}Weight: {LTBLUE}{WEIGHT_S}  {BLACK}Power: {LTBLUE}{POWER}{BLACK} Max. speed: {LTBLUE}{VELOCITY}
 
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE                  :{BLACK}Weight: {LTBLUE}{WEIGHT_S} {BLACK}Power: {LTBLUE}{POWER}{BLACK} Max. speed: {LTBLUE}{VELOCITY} {BLACK}Max. T.E.: {LTBLUE}{FORCE}
 
@@ -2722,23 +2737,33 @@ STR_8867_NAME_TRAIN                     
 
STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL                            :{BLACK}{BIGFONT}Train Crash!{}{COMMA} die in fireball after collision
 
STR_8869_CAN_T_REVERSE_DIRECTION                                :{WHITE}Can't reverse direction of train...
 
STR_886A_RENAME_TRAIN_VEHICLE_TYPE                              :{WHITE}Rename train vehicle type
 
STR_886B_CAN_T_RENAME_TRAIN_VEHICLE                             :{WHITE}Can't rename train vehicle type...
 
STR_886D_MAKE_THE_HIGHLIGHTED_ORDER                             :{BLACK}Make the highlighted order force the vehicle to dump cargo
 
STR_886F_TRANSFER                                               :{BLACK}Transfer
 
STR_CLEAR_TIME                                                  :{BLACK}Clear Time
 
STR_RESET_LATENESS                                              :{BLACK}Reset Late Counter
 

	
 
STR_TRAIN_STOPPING                                              :{RED}Stopping
 
STR_TRAIN_STOPPING_VEL                                          :{RED}Stopping, {VELOCITY}
 
STR_INCOMPATIBLE_RAIL_TYPES                                     :Incompatible rail types
 
STR_TRAIN_NO_POWER                                              :{RED}No power
 
STR_TRAIN_START_NO_CATENARY                                     :This track lacks catenary, so the train can't start
 

	
 
STR_NEW_VEHICLE_NOW_AVAILABLE                                   :{BLACK}{BIGFONT}New {STRING} now available!
 
STR_NEW_VEHICLE_TYPE                                            :{BLACK}{BIGFONT}{STRING}
 
STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE                         :{BLACK}New {STRING} now available!  -  {STRING}
 

	
 
STR_CAN_T_TIMETABLE_VEHICLE                                     :{WHITE}Can't timetable vehicle...
 
STR_TIMETABLE_ONLY_WAIT_AT_STATIONS                             :{WHITE}Vehicles can only wait at stations.
 
STR_TIMETABLE_NOT_STOPPING_HERE                                 :{WHITE}This vehicle is not stopping at this station.
 
STR_TIMETABLE_CHANGE_TIME                                       :{BLACK}Change Time
 
STR_TIMETABLE_STATUS_ON_TIME                                    :This vehicle is currently running on time
 
STR_TIMETABLE_STATUS_LATE                                       :This vehicle is currently running {STRING1} late
 
STR_TIMETABLE_STATUS_EARLY                                      :This vehicle is currently running {STRING1} early
 

	
 
##id 0x9000
 
STR_9000_ROAD_VEHICLE_IN_THE_WAY                                :{WHITE}Road vehicle in the way
 
STR_9001_ROAD_VEHICLES                                          :{WHITE}{COMPANY} - {COMMA} Road Vehicle{P "" s}
 
STR_9002                                                        :{WHITE}{VEHICLE}
 
STR_9003_ROAD_VEHICLE_DEPOT                                     :{WHITE}{TOWN} Road Vehicle Depot
 
STR_9004_NEW_VEHICLES                                           :{BLACK}New Vehicles
 
@@ -2944,12 +2969,14 @@ STR_A03F_REFIT_AIRCRAFT_TO_CARRY        
 
STR_A040_SELECT_CARGO_TYPE_TO_CARRY                             :{GOLD}Select cargo type to carry:
 
STR_A041_NEW_CAPACITY_COST_OF_REFIT                             :{BLACK}New capacity: {GOLD}{STRING1}{}{BLACK}Cost of refit: {GOLD}{CURRENCY}
 
STR_A042_CAN_T_REFIT_AIRCRAFT                                   :{WHITE}Can't refit aircraft...
 
STR_GO_TO_AIRPORT_HANGAR                                        :Go to {STATION} Hangar
 
SERVICE_AT_AIRPORT_HANGAR                                       :Service at {STATION} Hangar
 

	
 
STR_TIMETABLE_TITLE                                             :{WHITE}{VEHICLE} (Timetable)
 

	
 
##id 0xB000
 
STR_B000_ZEPPELIN_DISASTER_AT                                   :{BLACK}{BIGFONT}Zeppelin disaster at {STATION}!
 
STR_B001_ROAD_VEHICLE_DESTROYED                                 :{BLACK}{BIGFONT}Road vehicle destroyed in 'UFO' collision!
 
STR_B002_OIL_REFINERY_EXPLOSION                                 :{BLACK}{BIGFONT}Oil refinery explosion near {TOWN}!
 
STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS                        :{BLACK}{BIGFONT}Factory destroyed in suspicious circumstances near {TOWN}!
 
STR_B004_UFO_LANDS_NEAR                                         :{BLACK}{BIGFONT}'UFO' lands near {TOWN}!
src/openttd.h
Show inline comments
 
@@ -567,12 +567,13 @@ enum WindowClass {
 
	WC_ENDSCREEN,
 
	WC_SIGN_LIST,
 
	WC_GENERATE_LANDSCAPE,
 
	WC_GENERATE_PROGRESS_WINDOW,
 
	WC_CONFIRM_POPUP_QUERY,
 
	WC_TRANSPARENCY_TOOLBAR,
 
	WC_VEHICLE_TIMETABLE,
 
};
 

	
 

	
 
enum ExpensesType {
 
	EXPENSES_CONSTRUCTION =  0,
 
	EXPENSES_NEW_VEHICLES =  1,
src/order.h
Show inline comments
 
@@ -83,13 +83,13 @@ enum {
 
	CO_UNSHARE = 2
 
};
 

	
 
/* If you change this, keep in mind that it is saved on 3 places:
 
 * - Load_ORDR, all the global orders
 
 * - Vehicle -> current_order
 
 * - REF_SHEDULE (all REFs are currently limited to 16 bits!!)
 
 * - REF_ORDER (all REFs are currently limited to 16 bits!!)
 
 */
 
struct Order {
 
	Order *next;          ///< Pointer to next order. If NULL, end of list
 

	
 
	OrderTypeByte type;
 
	uint8  flags;
 
@@ -97,12 +97,15 @@ struct Order {
 

	
 
	OrderID index;         ///< Index of the order, is not saved or anything, just for reference
 

	
 
	CargoID refit_cargo; // Refit CargoID
 
	byte refit_subtype; // Refit subtype
 

	
 
	uint16 wait_time;    ///< How long in ticks to wait at the destination.
 
	uint16 travel_time;  ///< How long in ticks the journey to this destination should take.
 

	
 
	bool IsValid() const;
 
	void Free();
 
	void FreeChain();
 
};
 

	
 
#define MAX_BACKUP_ORDER_COUNT 40
 
@@ -194,12 +197,14 @@ static inline Order UnpackOrder(uint32 p
 
	order.flags   = GB(packed,  8,  8);
 
	order.dest    = GB(packed, 16, 16);
 
	order.next    = NULL;
 
	order.index   = 0; // avoid compiler warning
 
	order.refit_cargo   = CT_NO_REFIT;
 
	order.refit_subtype = 0;
 
	order.wait_time     = 0;
 
	order.travel_time   = 0;
 
	return order;
 
}
 

	
 
/* Functions */
 
void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *order);
 
void RestoreVehicleOrders(const Vehicle* v, const BackuppedOrders* order);
src/order_cmd.cpp
Show inline comments
 
@@ -45,12 +45,14 @@ Order UnpackOldOrder(uint16 packed)
 
	order.flags   = GB(packed, 4, 4);
 
	order.dest    = GB(packed, 8, 8);
 
	order.next    = NULL;
 

	
 
	order.refit_cargo   = CT_NO_REFIT;
 
	order.refit_subtype = 0;
 
	order.wait_time     = 0;
 
	order.travel_time   = 0;
 
	order.index = 0; // avoid compiler warning
 

	
 
	// Sanity check
 
	// TTD stores invalid orders as OT_NOTHING with non-zero flags/station
 
	if (!order.IsValid() && (order.flags != 0 || order.dest != 0)) {
 
		order.type = OT_DUMMY;
 
@@ -72,24 +74,27 @@ static Order UnpackVersion4Order(uint16 
 
	order.flags = GB(packed, 4, 4);
 
	order.dest  = GB(packed, 8, 8);
 
	order.next  = NULL;
 
	order.index = 0; // avoid compiler warning
 
	order.refit_cargo   = CT_NO_REFIT;
 
	order.refit_subtype = 0;
 
	order.wait_time     = 0;
 
	order.travel_time   = 0;
 
	return order;
 
}
 

	
 
/**
 
 *
 
 * Updates the widgets of a vehicle which contains the order-data
 
 *
 
 */
 
void InvalidateVehicleOrder(const Vehicle *v)
 
{
 
	InvalidateWindow(WC_VEHICLE_VIEW,   v->index);
 
	InvalidateWindow(WC_VEHICLE_ORDERS, v->index);
 
	InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index);
 
}
 

	
 
/**
 
 *
 
 * Swap two orders
 
 *
 
@@ -124,12 +129,14 @@ static Order *AllocateOrder()
 

	
 
			memset(order, 0, sizeof(*order));
 
			order->index = index;
 
			order->next = NULL;
 
			order->refit_cargo   = CT_NO_REFIT;
 
			order->refit_subtype = 0;
 
			order->wait_time     = 0;
 
			order->travel_time   = 0;
 

	
 
			return order;
 
		}
 
	}
 

	
 
	/* Check if we can add a block to the pool */
 
@@ -149,12 +156,15 @@ void AssignOrder(Order *order, Order dat
 
	order->type  = data.type;
 
	order->flags = data.flags;
 
	order->dest  = data.dest;
 

	
 
	order->refit_cargo   = data.refit_cargo;
 
	order->refit_subtype = data.refit_subtype;
 

	
 
	order->wait_time   = data.wait_time;
 
	order->travel_time = data.travel_time;
 
}
 

	
 

	
 
/**
 
 * Delete all news items regarding defective orders about a vehicle
 
 * This could kill still valid warnings (for example about void order when just
 
@@ -1314,12 +1324,14 @@ static const SaveLoad _order_desc[] = {
 
	SLE_VAR(Order, type,  SLE_UINT8),
 
	SLE_VAR(Order, flags, SLE_UINT8),
 
	SLE_VAR(Order, dest,  SLE_UINT16),
 
	SLE_REF(Order, next,  REF_ORDER),
 
	SLE_CONDVAR(Order, refit_cargo,    SLE_UINT8, 36, SL_MAX_VERSION),
 
	SLE_CONDVAR(Order, refit_subtype,  SLE_UINT8, 36, SL_MAX_VERSION),
 
	SLE_CONDVAR(Order, wait_time,      SLE_UINT16, 67, SL_MAX_VERSION),
 
	SLE_CONDVAR(Order, travel_time,    SLE_UINT16, 67, SL_MAX_VERSION),
 

	
 
	/* Leftover from the minor savegame version stuff
 
	 * We will never use those free bytes, but we have to keep this line to allow loading of old savegames */
 
	SLE_CONDNULL(10, 5, 35),
 
	SLE_END()
 
};
src/order_gui.cpp
Show inline comments
 
@@ -21,17 +21,19 @@
 
#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"
 

	
 
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,
 
@@ -537,12 +539,19 @@ static void OrdersWndProc(Window *w, Win
 
				assert(w->widget[ORDER_WIDGET_REFIT].left          == w->widget[ORDER_WIDGET_UNLOAD].left);
 
				assert(w->widget[ORDER_WIDGET_REFIT].right         == w->widget[ORDER_WIDGET_UNLOAD].right);
 
				assert(w->widget[ORDER_WIDGET_REFIT].top           == w->widget[ORDER_WIDGET_UNLOAD].top);
 
				assert(w->widget[ORDER_WIDGET_REFIT].bottom        == w->widget[ORDER_WIDGET_UNLOAD].bottom);
 
				assert(w->widget[ORDER_WIDGET_REFIT].display_flags == w->widget[ORDER_WIDGET_UNLOAD].display_flags);
 
			}
 

	
 
			if (_patches.timetabling) {
 
				w->widget[ORDER_WIDGET_CAPTION].right -= 61;
 
			} else {
 
				HideWindowWidget(w, ORDER_WIDGET_TIMETABLE_VIEW);
 
			}
 

	
 
			break;
 

	
 
	case WE_PAINT:
 
		DrawOrdersWindow(w);
 
		break;
 

	
 
@@ -620,12 +629,17 @@ static void OrdersWndProc(Window *w, Win
 
			OrderClick_Refit(w, v);
 
			break;
 

	
 
		case ORDER_WIDGET_TRANSFER:
 
			OrderClick_Transfer(w, v);
 
			break;
 

	
 
		case ORDER_WIDGET_TIMETABLE_VIEW:
 
			ShowTimetableWindow(v);
 
			break;
 

	
 
		case ORDER_WIDGET_SHARED_ORDER_LIST:
 
			ShowVehicleListWindow(v);
 
			break;
 
		}
 
	} break;
 

	
 
@@ -730,12 +744,13 @@ static void OrdersWndProc(Window *w, Win
 
/**
 
 * Widget definition for player train orders
 
 */
 
static const Widget _orders_train_widgets[] = {
 
	{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},               // ORDER_WIDGET_CLOSEBOX
 
	{    WWT_CAPTION,   RESIZE_RIGHT,   14,    11,   398,     0,    13, STR_8829_ORDERS,         STR_018C_WINDOW_TITLE_DRAG_THIS},     // ORDER_WIDGET_CAPTION
 
	{ WWT_PUSHTXTBTN,   RESIZE_LR,      14,   338,   398,     0,    13, STR_TIMETABLE_VIEW,      STR_TIMETABLE_VIEW_TOOLTIP},          // ORDER_WIDGET_TIMETABLE_VIEW
 

	
 
	{      WWT_PANEL,   RESIZE_RB,      14,     0,   386,    14,    75, 0x0,                     STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
 

	
 
	{  WWT_SCROLLBAR,   RESIZE_LRB,     14,   387,   398,    14,    75, 0x0,                     STR_0190_SCROLL_BAR_SCROLLS_LIST},    // ORDER_WIDGET_SCROLLBAR
 

	
 
	{ WWT_PUSHTXTBTN,   RESIZE_TB,      14,     0,    52,    76,    87, STR_8823_SKIP,           STR_8853_SKIP_THE_CURRENT_ORDER},     // ORDER_WIDGET_SKIP
 
@@ -766,12 +781,13 @@ static const WindowDesc _orders_train_de
 
/**
 
 * Widget definition for player orders (!train)
 
 */
 
static const Widget _orders_widgets[] = {
 
	{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},               // ORDER_WIDGET_CLOSEBOX
 
	{    WWT_CAPTION,   RESIZE_RIGHT,   14,    11,   409,     0,    13, STR_8829_ORDERS,         STR_018C_WINDOW_TITLE_DRAG_THIS},     // ORDER_WIDGET_CAPTION
 
	{ WWT_PUSHTXTBTN,   RESIZE_LR,      14,   349,   409,     0,    13, STR_TIMETABLE_VIEW,      STR_TIMETABLE_VIEW_TOOLTIP},          // ORDER_WIDGET_TIMETABLE_VIEW
 

	
 
	{      WWT_PANEL,   RESIZE_RB,      14,     0,   397,    14,    75, 0x0,                     STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
 

	
 
	{  WWT_SCROLLBAR,   RESIZE_LRB,     14,   398,   409,    14,    75, 0x0,                     STR_0190_SCROLL_BAR_SCROLLS_LIST},    // ORDER_WIDGET_SCROLLBAR
 

	
 
	{ WWT_PUSHTXTBTN,   RESIZE_TB,      14,     0,    63,    76,    87, STR_8823_SKIP,           STR_8853_SKIP_THE_CURRENT_ORDER},     // ORDER_WIDGET_SKIP
 
@@ -802,12 +818,13 @@ static const WindowDesc _orders_desc = {
 
/**
 
 * Widget definition for competitor orders
 
 */
 
static const Widget _other_orders_widgets[] = {
 
	{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,        STR_018B_CLOSE_WINDOW},               // ORDER_WIDGET_CLOSEBOX
 
	{    WWT_CAPTION,   RESIZE_RIGHT,   14,    11,   331,     0,    13, STR_A00B_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS},     // ORDER_WIDGET_CAPTION
 
	{ WWT_PUSHTXTBTN,   RESIZE_LR,      14,   271,   331,     0,    13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP},          // ORDER_WIDGET_TIMETABLE_VIEW
 

	
 
	{      WWT_PANEL,   RESIZE_RB,      14,     0,   319,    14,    75, 0x0,             STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
 

	
 
	{  WWT_SCROLLBAR,   RESIZE_LRB,     14,   320,   331,    14,    75, 0x0,             STR_0190_SCROLL_BAR_SCROLLS_LIST},    // ORDER_WIDGET_SCROLLBAR
 

	
 
	{      WWT_EMPTY,   RESIZE_NONE,    14,     0,   319,    76,    87, 0x0,             STR_NULL},                            // ORDER_WIDGET_SKIP
src/roadveh_cmd.cpp
Show inline comments
 
@@ -11,12 +11,13 @@
 
#include "roadveh.h"
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "engine.h"
 
#include "command.h"
 
#include "station.h"
 
#include "news.h"
 
#include "pathfind.h"
 
#include "npf.h"
 
@@ -755,12 +756,13 @@ static void ProcessRoadVehOrder(Vehicle 
 
		case OT_GOTO_DEPOT:
 
			/* Let a depot order in the orderlist interrupt. */
 
			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
 
			if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
 
					!VehicleNeedsService(v)) {
 
				v->cur_order_index++;
 
				UpdateVehicleTimetable(v, true);
 
			}
 
			break;
 

	
 
		case OT_LOADING:
 
		case OT_LEAVESTATION:
 
			return;
 
@@ -1781,12 +1783,13 @@ again:
 
}
 

	
 
static void RoadVehController(Vehicle *v)
 
{
 
	/* decrease counters */
 
	v->tick_counter++;
 
	v->current_order_time++;
 
	if (v->u.road.reverse_ctr != 0) v->u.road.reverse_ctr--;
 

	
 
	/* handle crashed */
 
	if (v->u.road.crashed_ctr != 0) {
 
		RoadVehIsCrashed(v);
 
		return;
src/saveload.cpp
Show inline comments
 
@@ -26,13 +26,13 @@
 
#include "saveload.h"
 
#include "network/network.h"
 
#include "variables.h"
 
#include <setjmp.h>
 
#include <list>
 

	
 
extern const uint16 SAVEGAME_VERSION = 66;
 
extern const uint16 SAVEGAME_VERSION = 67;
 
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();
 

	
src/settings.cpp
Show inline comments
 
@@ -1346,12 +1346,13 @@ const SettingDesc _patch_settings[] = {
 
	 SDT_VAR(Patches, liveries,           SLE_UINT8, S,MS,  2, 0,  2, 0, STR_CONFIG_PATCHES_LIVERIES,              RedrawScreen),
 
	SDT_BOOL(Patches, prefer_teamchat,               S, 0, false,        STR_CONFIG_PATCHES_PREFER_TEAMCHAT,       NULL),
 
	SDT_VAR(Patches, scrollwheel_scrolling,SLE_UINT8,S,MS, 0,  0,  2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING, NULL),
 
	SDT_VAR(Patches,scrollwheel_multiplier,SLE_UINT8,S, 0, 5,  1, 15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER,NULL),
 
	SDT_BOOL(Patches, pause_on_newgame,              S, 0, false,        STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME,     NULL),
 
	SDT_BOOL(Patches, advanced_vehicle_list,         S, 0, true,        STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,     NULL),
 
	SDT_BOOL(Patches, timetable_in_ticks,            S, 0, false,        STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS,    NULL),
 

	
 
	/***************************************************************************/
 
	/* Construction section of the GUI-configure patches window */
 
	SDT_BOOL(Patches, build_on_slopes,               0, 0,  true,        STR_CONFIG_PATCHES_BUILDONSLOPES,       NULL),
 
	SDT_BOOL(Patches, extra_dynamite,                0, 0, false,        STR_CONFIG_PATCHES_EXTRADYNAMITE,       NULL),
 
	SDT_BOOL(Patches, longbridges,                   0, 0,  true,        STR_CONFIG_PATCHES_LONGBRIDGES,         NULL),
 
@@ -1391,12 +1392,13 @@ const SettingDesc _patch_settings[] = {
 
	 SDT_VAR(Patches, servint_ships,     SLE_UINT16, 0,D0,   360,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS,        InValidateDetailsWindow),
 
	 SDT_VAR(Patches, servint_aircraft,  SLE_UINT16, 0,D0,   100,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT,     InValidateDetailsWindow),
 
	SDT_BOOL(Patches, no_servicing_if_no_breakdowns, 0, 0, false,                    STR_CONFIG_PATCHES_NOSERVICE,            NULL),
 
	SDT_BOOL(Patches, wagon_speed_limits,            0, 0,  true,                    STR_CONFIG_PATCHES_WAGONSPEEDLIMITS,     NULL),
 
	SDT_CONDBOOL(Patches, disable_elrails, 38, SL_MAX_VERSION, 0, 0, false,          STR_CONFIG_PATCHES_DISABLE_ELRAILS,      SettingsDisableElrail),
 
	SDT_CONDVAR(Patches, freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0, 0, 1, 1, 255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS, NULL),
 
	SDT_CONDBOOL(Patches, timetabling,              67, SL_MAX_VERSION, 0, 0, true,  STR_CONFIG_PATCHES_TIMETABLE_ALLOW,      NULL),
 

	
 
	/***************************************************************************/
 
	/* Station section of the GUI-configure patches window */
 
	SDT_BOOL(Patches, join_stations,           0, 0,  true,        STR_CONFIG_PATCHES_JOINSTATIONS,       NULL),
 
	SDT_BOOL(Patches, full_load_any,           0, 0,  true,        STR_CONFIG_PATCHES_FULLLOADANY,        NULL),
 
	SDT_BOOL(Patches, improved_load,           0, 0, false,        STR_CONFIG_PATCHES_IMPROVEDLOAD,       NULL),
src/settings_gui.cpp
Show inline comments
 
@@ -649,12 +649,13 @@ static const char *_patches_ui[] = {
 
	 *  the cocoa (OSX) driver generates input for it.
 
	 *  Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */
 
	"scrollwheel_scrolling",
 
	"scrollwheel_multiplier",
 
	"pause_on_newgame",
 
	"advanced_vehicle_list",
 
	"timetable_in_ticks",
 
};
 

	
 
static const char *_patches_construction[] = {
 
	"build_on_slopes",
 
	"extra_dynamite",
 
	"longbridges",
 
@@ -732,12 +733,13 @@ static const char *_patches_vehicles[] =
 
	"servint_ships",
 
	"servint_aircraft",
 
	"no_servicing_if_no_breakdowns",
 
	"wagon_speed_limits",
 
	"disable_elrails",
 
	"freight_trains",
 
	"timetabling",
 
};
 

	
 
struct PatchEntry {
 
	const SettingDesc *setting;
 
	uint index;
 
};
 
@@ -974,25 +976,25 @@ static void PatchesSelectionWndProc(Wind
 
}
 

	
 
static const Widget _patches_selection_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    10,     0,    10,     0,    13, STR_00C5,                        STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,   RESIZE_NONE,    10,    11,   369,     0,    13, STR_CONFIG_PATCHES_CAPTION,      STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{      WWT_PANEL,   RESIZE_NONE,    10,     0,   369,    14,    41, 0x0,                             STR_NULL},
 
{      WWT_PANEL,   RESIZE_NONE,    10,     0,   369,    42,   370, 0x0,                             STR_NULL},
 
{      WWT_PANEL,   RESIZE_NONE,    10,     0,   369,    42,   380, 0x0,                             STR_NULL},
 

	
 
{    WWT_TEXTBTN,   RESIZE_NONE,     3,    10,    96,    16,    27, STR_CONFIG_PATCHES_GUI,          STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,     3,    97,   183,    16,    27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,     3,   184,   270,    16,    27, STR_CONFIG_PATCHES_VEHICLES,     STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,     3,   271,   357,    16,    27, STR_CONFIG_PATCHES_STATIONS,     STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,     3,    10,    96,    28,    39, STR_CONFIG_PATCHES_ECONOMY,      STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,     3,    97,   183,    28,    39, STR_CONFIG_PATCHES_AI,           STR_NULL},
 
{   WIDGETS_END},
 
};
 

	
 
static const WindowDesc _patches_selection_desc = {
 
	WDP_CENTER, WDP_CENTER, 370, 371,
 
	WDP_CENTER, WDP_CENTER, 370, 381,
 
	WC_GAME_OPTIONS, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
 
	_patches_selection_widgets,
 
	PatchesSelectionWndProc,
 
};
 

	
src/ship_cmd.cpp
Show inline comments
 
@@ -8,12 +8,13 @@
 
#include "table/strings.h"
 
#include "functions.h"
 
#include "landscape.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "command.h"
 
#include "pathfind.h"
 
#include "station_map.h"
 
#include "station.h"
 
#include "news.h"
 
#include "engine.h"
 
@@ -255,12 +256,13 @@ static void ProcessShipOrder(Vehicle *v)
 
	switch (v->current_order.type) {
 
		case OT_GOTO_DEPOT:
 
			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
 
			if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
 
					!VehicleNeedsService(v)) {
 
				v->cur_order_index++;
 
				UpdateVehicleTimetable(v, true);
 
			}
 
			break;
 

	
 
		case OT_LOADING:
 
		case OT_LEAVESTATION:
 
			return;
 
@@ -645,12 +647,13 @@ static void ShipController(Vehicle *v)
 
	const byte *b;
 
	Direction dir;
 
	Track track;
 
	TrackBits tracks;
 

	
 
	v->tick_counter++;
 
	v->current_order_time++;
 

	
 
	if (v->breakdown_ctr != 0) {
 
		if (v->breakdown_ctr <= 2) {
 
			HandleBrokenShip(v);
 
			return;
 
		}
 
@@ -692,12 +695,13 @@ static void ShipController(Vehicle *v)
 
						IsBuoyTile(v->dest_tile) &&
 
						DistanceManhattan(v->dest_tile, gp.new_tile) <= 3) {
 
					/* We got within 3 tiles of our target buoy, so let's skip to our
 
					 * next order */
 
					v->cur_order_index++;
 
					v->current_order.type = OT_DUMMY;
 
					UpdateVehicleTimetable(v, true);
 
					InvalidateVehicleOrder(v);
 
				} else {
 
					/* Non-buoy orders really need to reach the tile */
 
					if (v->dest_tile == gp.new_tile) {
 
						if (v->current_order.type == OT_GOTO_DEPOT) {
 
							if ((gp.x & 0xF) == 8 && (gp.y & 0xF) == 8) {
src/train_cmd.cpp
Show inline comments
 
@@ -12,12 +12,13 @@
 
#include "station_map.h"
 
#include "table/strings.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "tunnel_map.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "articulated_vehicles.h"
 
#include "command.h"
 
#include "pathfind.h"
 
#include "npf.h"
 
#include "station.h"
 
#include "table/train_cmd.h"
 
@@ -2377,12 +2378,13 @@ static bool ProcessTrainOrder(Vehicle *v
 
	switch (v->current_order.type) {
 
		case OT_GOTO_DEPOT:
 
			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false;
 
			if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) &&
 
					!VehicleNeedsService(v)) {
 
				v->cur_order_index++;
 
				UpdateVehicleTimetable(v, true);
 
			}
 
			break;
 

	
 
		case OT_LOADING:
 
		case OT_LEAVESTATION:
 
			return false;
 
@@ -2392,20 +2394,22 @@ static bool ProcessTrainOrder(Vehicle *v
 

	
 
	/* check if we've reached the waypoint? */
 
	bool at_waypoint = false;
 
	if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
 
		v->cur_order_index++;
 
		at_waypoint = true;
 
		UpdateVehicleTimetable(v, true);
 
	}
 

	
 
	/* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */
 
	if (_patches.new_nonstop &&
 
			v->current_order.flags & OF_NON_STOP &&
 
			IsTileType(v->tile, MP_STATION) &&
 
			v->current_order.dest == GetStationIndex(v->tile)) {
 
		v->cur_order_index++;
 
		UpdateVehicleTimetable(v, true);
 
	}
 

	
 
	/* Get the current order */
 
	if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
 

	
 
	const Order *order = GetVehicleOrder(v, v->cur_order_index);
 
@@ -3293,12 +3297,14 @@ void Train_Tick(Vehicle *v)
 
	if (_age_cargo_skip_counter == 0 && v->cargo_days != 0xff)
 
		v->cargo_days++;
 

	
 
	v->tick_counter++;
 

	
 
	if (IsFrontEngine(v)) {
 
		v->current_order_time++;
 

	
 
		TrainLocoHandler(v, false);
 

	
 
		/* make sure vehicle wasn't deleted. */
 
		if (v->type == VEH_TRAIN && IsFrontEngine(v))
 
			TrainLocoHandler(v, true);
 
	} else if (IsFreeWagon(v) && HASBITS(v->vehstatus, VS_CRASHED)) {
src/variables.h
Show inline comments
 
@@ -232,12 +232,15 @@ struct Patches {
 
	uint8 larger_towns;      ///< The number of cities to build. These start off larger and grow twice as fast
 
	uint8 initial_city_size; ///< Multiplier for the initial size of the cities compared to towns
 

	
 
	bool pause_on_newgame;   ///< Whether to start new games paused or not.
 

	
 
	TownLayoutByte town_layout;  ///< Select town layout
 

	
 
	bool timetabling;        ///< Whether to allow timetabling.
 
	bool timetable_in_ticks; ///< Whether to show the timetable in ticks rather than days.
 
};
 

	
 
VARDEF Patches _patches;
 

	
 

	
 
struct Cheat {
src/vehicle.cpp
Show inline comments
 
@@ -12,12 +12,13 @@
 
#include "table/strings.h"
 
#include "functions.h"
 
#include "landscape.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "vehicle.h"
 
#include "timetable.h"
 
#include "gfx.h"
 
#include "viewport.h"
 
#include "news.h"
 
#include "command.h"
 
#include "saveload.h"
 
#include "player.h"
 
@@ -2332,12 +2333,13 @@ void VehicleEnterDepot(Vehicle *v)
 
			}
 
		}
 

	
 
		if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
 
			/* Part of orders */
 
			v->cur_order_index++;
 
			UpdateVehicleTimetable(v, true);
 
		} else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
 
			/* Force depot visit */
 
			v->vehstatus |= VS_STOPPED;
 
			if (v->owner == _local_player) {
 
				StringID string;
 

	
 
@@ -2784,12 +2786,16 @@ extern const SaveLoad _common_veh_desc[]
 
	SLE_CONDVARX(cpp_offsetof(Vehicle, current_order) + cpp_offsetof(Order, dest),  SLE_UINT16, 5, SL_MAX_VERSION),
 

	
 
	/* Refit in current order */
 
	SLE_CONDVARX(cpp_offsetof(Vehicle, current_order) + cpp_offsetof(Order, refit_cargo),    SLE_UINT8, 36, SL_MAX_VERSION),
 
	SLE_CONDVARX(cpp_offsetof(Vehicle, current_order) + cpp_offsetof(Order, refit_subtype),  SLE_UINT8, 36, SL_MAX_VERSION),
 

	
 
	/* Timetable in current order */
 
	SLE_CONDVARX(cpp_offsetof(Vehicle, current_order) + cpp_offsetof(Order, wait_time),      SLE_UINT16, 67, SL_MAX_VERSION),
 
	SLE_CONDVARX(cpp_offsetof(Vehicle, current_order) + cpp_offsetof(Order, travel_time),    SLE_UINT16, 67, SL_MAX_VERSION),
 

	
 
	    SLE_REF(Vehicle, orders,               REF_ORDER),
 

	
 
	SLE_CONDVAR(Vehicle, age,                  SLE_FILE_U16 | SLE_VAR_I32,  0, 30),
 
	SLE_CONDVAR(Vehicle, age,                  SLE_INT32,                  31, SL_MAX_VERSION),
 
	SLE_CONDVAR(Vehicle, max_age,              SLE_FILE_U16 | SLE_VAR_I32,  0, 30),
 
	SLE_CONDVAR(Vehicle, max_age,              SLE_INT32,                  31, SL_MAX_VERSION),
 
@@ -2825,12 +2831,15 @@ extern const SaveLoad _common_veh_desc[]
 

	
 
	    SLE_REF(Vehicle, next_shared,          REF_VEHICLE),
 
	    SLE_REF(Vehicle, prev_shared,          REF_VEHICLE),
 

	
 
	SLE_CONDVAR(Vehicle, group_id,             SLE_UINT16,                60, SL_MAX_VERSION),
 

	
 
	SLE_CONDVAR(Vehicle, current_order_time,   SLE_UINT32,                67, SL_MAX_VERSION),
 
	SLE_CONDVAR(Vehicle, lateness_counter,     SLE_INT32,                 67, SL_MAX_VERSION),
 

	
 
	/* reserve extra space in savegame here. (currently 10 bytes) */
 
	SLE_CONDNULL(10,                                                       2, SL_MAX_VERSION),
 

	
 
	SLE_END()
 
};
 

	
 
@@ -3067,12 +3076,13 @@ void Vehicle::BeginLoading()
 
		/* Furthermore add the Non Stop flag to mark that this station
 
		 * is the actual destination of the vehicle, which is (for example)
 
		 * necessary to be known for HandleTrainLoading to determine
 
		 * whether the train is lost or not; not marking a train lost
 
		 * that arrives at random stations is bad. */
 
		this->current_order.flags |= OF_NON_STOP;
 
		UpdateVehicleTimetable(this, true);
 
	} else {
 
		/* This is just an unordered intermediate stop */
 
		this->current_order.flags = 0;
 
	}
 

	
 
	current_order.type = OT_LOADING;
 
@@ -3093,21 +3103,26 @@ void Vehicle::BeginLoading()
 
void Vehicle::LeaveStation()
 
{
 
	assert(current_order.type == OT_LOADING);
 
	current_order.type = OT_LEAVESTATION;
 
	current_order.flags = 0;
 
	GetStation(this->last_station_visited)->loading_vehicles.remove(this);
 

	
 
	UpdateVehicleTimetable(this, false);
 
}
 

	
 

	
 
void Vehicle::HandleLoading(bool mode)
 
{
 
	switch (this->current_order.type) {
 
		case OT_LOADING: {
 
			uint wait_time = max(this->current_order.wait_time - this->lateness_counter, 0);
 

	
 
			/* Not the first call for this tick, or still loading */
 
			if (mode || !HASBIT(this->vehicle_flags, VF_LOADING_FINISHED)) return;
 
			if (mode || !HASBIT(this->vehicle_flags, VF_LOADING_FINISHED) ||
 
					(_patches.timetabling && this->current_order_time < wait_time)) return;
 

	
 
			this->PlayLeaveStationSound();
 

	
 
			Order b = this->current_order;
 
			this->LeaveStation();
 

	
src/vehicle.h
Show inline comments
 
@@ -317,12 +317,16 @@ struct Vehicle {
 
	Money cargo_feeder_share;      ///< value of feeder pickup to be paid for on delivery of cargo
 
	TileIndex cargo_loaded_at_xy;  ///< tile index where feeder cargo was loaded
 
	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.
 

	
 
	union {
 
		VehicleRail rail;
 
		VehicleAir air;
 
		VehicleRoad road;
 
		VehicleSpecial special;
 
		VehicleDisaster disaster;
0 comments (0 inline, 0 general)