1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-17 03:29:09 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
rubidium
41e8be2835 (svn r21873) -Release: 1.1.0-beta4 2011-01-20 22:15:19 +00:00
305 changed files with 4128 additions and 3314 deletions

View File

@@ -319,5 +319,3 @@ AIIndustry.IsCargoAccepted <- function(industry_id, cargo_id)
AIAbstractList <- AIList;
AIList.ChangeItem <- AIList.SetValue;
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;

View File

@@ -70,5 +70,3 @@ AIIndustry.IsCargoAccepted <- function(industry_id, cargo_id)
AIAbstractList <- AIList;
AIList.ChangeItem <- AIList.SetValue;
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;

View File

@@ -15,6 +15,3 @@ regression =
[vehicle]
road_side = right
plane_speed = 2
[construction]
max_bridge_length = 100

View File

@@ -1,38 +1,3 @@
1.1.0-beta5 (2011-02-04)
------------------------------------------------------------------------
- Feature: GUI setting to disable reversing at signals (r21962)
- Feature: Not loading and not unloading is now possible (r21961)
- Change: [NewGRF] Disable the flipping of train engines/wagons in the depot by default for NewGRFs [FS#4462] (r21966)
- Change: Show the length of vehicles in tiles, instead of half tiles in the depot (r21960)
- Change: Replace longbridges settings with custom maximum bridge and tunnel length setting (r21959)
- Change: Randomize the vehicle a small UFO targets, do not use the one with lowest index (r21949)
- Fix: Do not count the number of vehicles but the length of vehicles to (configurably) limit train length [FS#4461] (r21960)
- Fix: [NewGRF] Reset the carry flag every 4 bytes in Action 6 when adding more than one variable (r21951)
- Fix: Road vehicle was moved under the bridge when it was destroyed by an UFO while on a bridge (r21948)
- Fix: Crash when converting a savegame with vehicles crashed in a tunnel entry, or with vehicles reversing there (r21947)
- Fix: Funny behaviour when a road vehicle reverses while overtaking, so abort the overtake attempt when reversing the road vehicle [FS#4447] (r21946)
- Fix: Not all vehicles should be tested to be inside a tunnel upon savegame load [FS#4460] (r21940)
- Fix: Do not remove existing road/tram bits when overbuilding stops of the opposite road type [FS#4457] (r21936)
- Fix: Allow to overbuild road stops which are built over trams (r21935)
- Fix: Automatic orders behave now stable wrt. service orders and are not added or removed depending on the need of servicing [FS#4440] (r21933)
- Fix: The town window would not be invalidated in the scenario editor if the ground changed and thus the required cargos for town growth [FS#4554] (r21929)
- Fix: Converting an expensive rail type to a cheap one could give more money than removing and rebuilding cost (r21919)
- Fix: Languages improperly sorted in the 'start server' window [FS#4443] (r21918)
- Fix: the minimum speed needed for (realistic) acceleration to work properly can sometimes be more than the (temporary) maximum speed causing Clamp to 'fail'. Make sure that the minimum speed always overrules the maximum speed [FS#4442] (r21916)
- Fix: Include the capacity of non-refittable vehicles in the refitted-capacity, if their cargo matches (r21904)
- Fix: Do not count articulated parts when passing the number of vehicles to refit to the command. That may exceed 8 bits (r21902)
- Fix: [NoAI] Hide automatic orders from AIs as they have no way of dealing with them (r21900)
- Fix: Do not show a vehicle selection in the RefitWindow for refit orders. You cannot select anything anyway (r21899)
- Fix: Using a pointer-iterator and adding things (thus reallocating) to the iterated array caused OpenTTD to crash on invalid pointers [FS#4438] (r21898)
- Fix: Only some scenarios from the main scenario folder and no heightmaps could be started in the 'start server' window [FS#4421] (r21892)
- Fix: Crash when scrolling outside of the main window (with some video backends) [FS#4434] (r21889)
- Fix: [NewGRF] String codes 0x80 and 0x81 were broken since the typechecking of string parameters [FS#4422] (r21885)
- Fix: When a train after reversing ended at the last bit of a bridge ramp and directed outside the bridge, it could still have track set to TRACK_BIT_WORMHOLE (r21880)
- Fix: When a single-vehicle train was reversed while on a slope, its GOINGUP/DOWN were not swapped (r21874)
- Remove: Settings for vehicle speed in the vehicle view, long date in status bar, drawing of bridge pillars, support for depot orders, time tabling and joining of stations upon building (r21958, r21957, r21956, r21955, r21954)
- Remove: The non-uniform stations setting; it has been broken for over a year, and thus not used [FS#4456] (r21953)
1.1.0-beta4 (2011-01-21)
------------------------------------------------------------------------
- Feature: [NewGRF] Rail type property to influence sorting of rail types in the drop down list [FS#4394] (r21866)

View File

@@ -1,6 +1,6 @@
OpenTTD's known bugs
Last updated: 2011-02-04
Release version: 1.1.0-beta5
Last updated: 2011-01-21
Release version: 1.1.0-beta4
------------------------------------------------------------------------

View File

@@ -1,9 +1,3 @@
openttd (1.1.0~beta5) unstable; urgency=low
* New upstream release 1.1.0-beta5
-- Matthijs Kooijman <matthijs@stdin.nl> Fri, 04 Feb 2011 22:00:00 +0100
openttd (1.1.0~beta4) unstable; urgency=low
* New upstream release 1.1.0-beta4

View File

@@ -1,6 +1,6 @@
@echo off
set OPENTTD_VERSION=1.1.0-beta5
set OPENTTD_VERSION=1.1.0-beta4
set OPENSFX_VERSION=0.8.0
set NOSOUND_VERSION=0.8.0
set OPENGFX_VERSION=0.7.0

View File

@@ -2,8 +2,8 @@
!define APPV_MAJOR 1
!define APPV_MINOR 1
!define APPV_MAINT 0
!define APPV_BUILD 4
!define APPV_EXTRA "-beta5"
!define APPV_BUILD 3
!define APPV_EXTRA "-beta4"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version

View File

@@ -1,6 +1,6 @@
OpenTTD readme
Last updated: 2011-02-04
Release version: 1.1.0-beta5
Last updated: 2011-01-21
Release version: 1.1.0-beta4
------------------------------------------------------------------------

View File

@@ -10,6 +10,7 @@
/** @file ai_config.cpp Implementation of AIConfig. */
#include "../stdafx.h"
#include "../openttd.h"
#include "../settings_type.h"
#include "../core/random_func.hpp"
#include "ai.hpp"

View File

@@ -10,6 +10,7 @@
/** @file ai_gui.cpp Window for configuring the AIs */
#include "../stdafx.h"
#include "../openttd.h"
#include "../table/sprites.h"
#include "../gui.h"
#include "../querystring_gui.h"

View File

@@ -15,6 +15,7 @@
#include "ai_info.hpp"
#include "ai_scanner.hpp"
#include "../settings_type.h"
#include "../openttd.h"
#include "../debug.h"
#include "../rev.h"

View File

@@ -74,7 +74,6 @@
#include "api/ai_waypointlist.hpp.sq"
#include "../company_base.h"
#include "../company_func.h"
#include "../fileio_func.h"
/** The maximum number of operations for saving or loading the data of an AI. */

View File

@@ -12,8 +12,11 @@
#ifndef AI_SCANNER_HPP
#define AI_SCANNER_HPP
#include <squirrel.h>
#include "../script/script_scanner.hpp"
#include "../core/string_compare_type.hpp"
#include "ai.hpp"
#include <map>
/**
* Class that scans for available AIs.

View File

@@ -12,7 +12,12 @@
#ifndef AI_STORAGE_HPP
#define AI_STORAGE_HPP
#include "../command_func.h"
#include "../map_func.h"
#include "../network/network.h"
#include "../company_func.h"
#include "../signs_func.h"
#include "../tunnelbridge.h"
#include "../vehicle_func.h"
#include "../road_type.h"
#include "../group.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_accounting.cpp Implementation of AIAccounting. */
#include "../../stdafx.h"
#include "ai_accounting.hpp"
Money AIAccounting::GetCosts()

View File

@@ -9,7 +9,6 @@
/** @file ai_airport.cpp Implementation of AIAirport. */
#include "../../stdafx.h"
#include "ai_airport.hpp"
#include "ai_station.hpp"
#include "../../station_base.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_base.cpp Implementation of AIBase. */
#include "../../stdafx.h"
#include "ai_base.hpp"
#include "../../network/network.h"
#include "../../core/random_func.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_basestation.cpp Implementation of AIBaseStation. */
#include "../../stdafx.h"
#include "ai_basestation.hpp"
#include "../../station_base.h"
#include "../../string_func.h"

View File

@@ -12,6 +12,7 @@
#ifndef AI_BASESTATION_HPP
#define AI_BASESTATION_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_bridge.cpp Implementation of AIBridge. */
#include "../../stdafx.h"
#include "ai_bridge.hpp"
#include "ai_rail.hpp"
#include "../ai_instance.hpp"
@@ -152,7 +151,9 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
{
if (!IsValidBridge(bridge_id)) return -1;
return min(::GetBridgeSpec(bridge_id)->max_length, _settings_game.construction.max_bridge_length) + 2;
uint max = ::GetBridgeSpec(bridge_id)->max_length;
if (max >= MAX_BRIDGE_LENGTH && _settings_game.construction.longbridges) max = MAX_BRIDGE_LENGTH_LONGBRIDGES;
return max + 2;
}
/* static */ int32 AIBridge::GetMinLength(BridgeID bridge_id)

View File

@@ -12,7 +12,9 @@
#ifndef AI_BRIDGE_HPP
#define AI_BRIDGE_HPP
#include "ai_object.hpp"
#include "ai_vehicle.hpp"
#include "ai_error.hpp"
/**
* Class that handles all bridge related functions.

View File

@@ -9,7 +9,6 @@
/** @file ai_bridgelist.cpp Implementation of AIBridgeList and friends. */
#include "../../stdafx.h"
#include "ai_bridgelist.hpp"
#include "ai_bridge.hpp"
#include "../../bridge.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_cargo.cpp Implementation of AICargo. */
#include "../../stdafx.h"
#include "ai_cargo.hpp"
#include "../../cargotype.h"
#include "../../economy_func.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_cargolist.cpp Implementation of AICargoList and friends. */
#include "../../stdafx.h"
#include "ai_cargolist.hpp"
#include "ai_industry.hpp"
#include "../../cargotype.h"

View File

@@ -33,7 +33,6 @@
* \li HasNext for all lists.
* \li AIAbstractList, use AIList instead.
* \li AIList::ChangeItem, use AIList::SetValue instead.
* \li AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, that error is never returned anymore.
*
* Other changes:
* \li AIEngine::GetMaxTractiveEffort can be used for road vehicles.

View File

@@ -9,7 +9,6 @@
/** @file ai_company.cpp Implementation of AICompany. */
#include "../../stdafx.h"
#include "ai_company.hpp"
#include "ai_error.hpp"
#include "../../command_func.h"

View File

@@ -12,10 +12,10 @@
#include "../../stdafx.h"
#include "../../string_func.h"
#include "../../company_base.h"
#include "../../company_func.h"
#include "../../rev.h"
#include "ai_controller.hpp"
#include "../ai_storage.hpp"
#include "../ai_instance.hpp"
#include "../ai_config.hpp"
#include "ai_log.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_date.cpp Implementation of AIDate. */
#include "../../stdafx.h"
#include "ai_date.hpp"
#include "../../date_func.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_depotlist.cpp Implementation of AIDepotList and friends. */
#include "../../stdafx.h"
#include "ai_depotlist.hpp"
#include "../../company_func.h"
#include "../../depot_base.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_engine.cpp Implementation of AIEngine. */
#include "../../stdafx.h"
#include "ai_engine.hpp"
#include "ai_cargo.hpp"
#include "../../company_func.h"

View File

@@ -12,7 +12,9 @@
#ifndef AI_ENGINE_HPP
#define AI_ENGINE_HPP
#include "ai_object.hpp"
#include "ai_vehicle.hpp"
#include "ai_road.hpp"
#include "ai_rail.hpp"
#include "ai_airport.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_enginelist.cpp Implementation of AIEngineList and friends. */
#include "../../stdafx.h"
#include "ai_enginelist.hpp"
#include "../../company_func.h"
#include "../../engine_base.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_error.cpp Implementation of AIError. */
#include "../../stdafx.h"
#include "ai_error.hpp"
#include "../../core/bitmath_func.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_event.cpp Implementation of AIEvent. */
#include "../../stdafx.h"
#include "ai_event_types.hpp"
#include <queue>

View File

@@ -9,7 +9,6 @@
/** @file ai_event_types.cpp Implementation of all EventTypes. */
#include "../../stdafx.h"
#include "ai_event_types.hpp"
#include "ai_vehicle.hpp"
#include "../../command_type.h"

View File

@@ -12,6 +12,7 @@
#ifndef AI_EVENT_TYPES_HPP
#define AI_EVENT_TYPES_HPP
#include "ai_object.hpp"
#include "ai_event.hpp"
#include "ai_company.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_execmode.cpp Implementation of AIExecMode. */
#include "../../stdafx.h"
#include "ai_execmode.hpp"
#include "../../company_base.h"
#include "../../company_func.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_gamesettings.cpp Implementation of AIGameSettings. */
#include "../../stdafx.h"
#include "ai_gamesettings.hpp"
#include "../../settings_internal.h"

View File

@@ -12,6 +12,7 @@
#ifndef AI_GAMESETTINGS_HPP
#define AI_GAMESETTINGS_HPP
#include "ai_object.hpp"
#include "ai_vehicle.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_group.cpp Implementation of AIGroup. */
#include "../../stdafx.h"
#include "ai_group.hpp"
#include "ai_engine.hpp"
#include "../ai_instance.hpp"

View File

@@ -12,6 +12,7 @@
#ifndef AI_GROUP_HPP
#define AI_GROUP_HPP
#include "ai_object.hpp"
#include "ai_vehicle.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_grouplist.cpp Implementation of AIGroupList and friends. */
#include "../../stdafx.h"
#include "ai_grouplist.hpp"
#include "../../company_func.h"
#include "../../group.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_industry.cpp Implementation of AIIndustry. */
#include "../../stdafx.h"
#include "ai_industry.hpp"
#include "ai_cargo.hpp"
#include "ai_map.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_industrylist.cpp Implementation of AIIndustryList and friends. */
#include "../../stdafx.h"
#include "ai_industrylist.hpp"
#include "../../industry.h"

View File

@@ -9,10 +9,8 @@
/** @file ai_industrytype.cpp Implementation of AIIndustryType. */
#include "../../stdafx.h"
#include "ai_industrytype.hpp"
#include "ai_map.hpp"
#include "ai_error.hpp"
#include "../../strings_func.h"
#include "../../industry.h"
#include "../../newgrf_industries.h"

View File

@@ -12,6 +12,8 @@
#ifndef AI_INDUSTRYTYPE_HPP
#define AI_INDUSTRYTYPE_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
#include "ai_list.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_industrytypelist.cpp Implementation of AIIndustryTypeList. */
#include "../../stdafx.h"
#include "ai_industrytypelist.hpp"
#include "../../industry.h"

View File

@@ -12,6 +12,7 @@
#ifndef AI_INDUSTRYTYPELIST_HPP
#define AI_INDUSTRYTYPELIST_HPP
#include "ai_list.hpp"
#include "ai_industrytype.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_list.cpp Implementation of AIList. */
#include "../../stdafx.h"
#include "ai_list.hpp"
#include "../../debug.h"
#include "../../script/squirrel.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_log.cpp Implementation of AILog. */
#include "../../stdafx.h"
#include "ai_log.hpp"
#include "../../core/alloc_func.hpp"
#include "../../company_func.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_map.cpp Implementation of AIMap. */
#include "../../stdafx.h"
#include "ai_map.hpp"
#include "../../tile_map.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_marine.cpp Implementation of AIMarine. */
#include "../../stdafx.h"
#include "ai_marine.hpp"
#include "ai_station.hpp"
#include "../../station_base.h"

View File

@@ -12,6 +12,7 @@
#ifndef AI_MARINE_HPP
#define AI_MARINE_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
/**

View File

@@ -11,11 +11,7 @@
#include "../../stdafx.h"
#include "../../script/squirrel.hpp"
#include "../../command_func.h"
#include "../../company_base.h"
#include "../../company_func.h"
#include "../../network/network.h"
#include "../../tunnelbridge.h"
#include "../ai_storage.hpp"
#include "../ai_instance.hpp"

View File

@@ -12,6 +12,7 @@
#ifndef AI_OBJECT_HPP
#define AI_OBJECT_HPP
#include "../../stdafx.h"
#include "../../misc/countedptr.hpp"
#include "../../road_type.h"
#include "../../rail_type.h"

View File

@@ -9,8 +9,6 @@
/** @file ai_order.cpp Implementation of AIOrder. */
#include "../../stdafx.h"
#include "ai_order.hpp"
#include "ai_vehicle.hpp"
#include "../ai_instance.hpp"
#include "../../debug.h"
@@ -48,7 +46,7 @@ static OrderType GetOrderTypeByTile(TileIndex t)
/* static */ bool AIOrder::IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position)
{
return AIVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::Vehicle::Get(vehicle_id)->GetNumManualOrders() || order_position == ORDER_CURRENT);
return AIVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::Vehicle::Get(vehicle_id)->GetNumOrders() || order_position == ORDER_CURRENT);
}
/**
@@ -65,14 +63,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
if (order_position == AIOrder::ORDER_INVALID) return NULL;
}
const Order *order = v->orders.list->GetFirstOrder();
while (order->GetType() == OT_AUTOMATIC) order = order->next;
while (order_position > 0) {
order_position = (AIOrder::OrderPosition)(order_position - 1);
order = order->next;
while (order->GetType() == OT_AUTOMATIC) order = order->next;
}
return order;
return v->GetOrder(order_position);
}
/* static */ bool AIOrder::IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position)
@@ -131,18 +122,8 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
{
if (!AIVehicle::IsValidVehicle(vehicle_id)) return ORDER_INVALID;
if (order_position == ORDER_CURRENT) {
int cur_order_pos = ::Vehicle::Get(vehicle_id)->cur_real_order_index;
const Order *order = ::Vehicle::Get(vehicle_id)->GetOrder(0);
if (order == NULL) return ORDER_INVALID;
int num_automatic_orders = 0;
for (int i = 0; i < cur_order_pos; i++) {
if (order->GetType() == OT_AUTOMATIC) num_automatic_orders++;
order = order->next;
}
return (AIOrder::OrderPosition)(cur_order_pos - num_automatic_orders);
}
return (order_position >= 0 && order_position < ::Vehicle::Get(vehicle_id)->GetNumManualOrders()) ? order_position : ORDER_INVALID;
if (order_position == ORDER_CURRENT) return (AIOrder::OrderPosition)::Vehicle::Get(vehicle_id)->cur_order_index;
return (order_position >= 0 && order_position < ::Vehicle::Get(vehicle_id)->GetNumOrders()) ? order_position : ORDER_INVALID;
}
@@ -279,7 +260,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
if (!IsValidVehicleOrder(vehicle_id, order_position)) return ORDER_INVALID;
if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return ORDER_INVALID;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
const Order *order = Vehicle::Get(vehicle_id)->GetOrder(order_position);
return (OrderPosition)order->GetConditionSkipToOrder();
}
@@ -288,7 +269,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
if (!IsValidVehicleOrder(vehicle_id, order_position)) return OC_INVALID;
if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return OC_INVALID;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
const Order *order = Vehicle::Get(vehicle_id)->GetOrder(order_position);
return (OrderCondition)order->GetConditionVariable();
}
@@ -297,7 +278,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
if (!IsValidVehicleOrder(vehicle_id, order_position)) return CF_INVALID;
if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return CF_INVALID;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
const Order *order = Vehicle::Get(vehicle_id)->GetOrder(order_position);
return (CompareFunction)order->GetConditionComparator();
}
@@ -306,7 +287,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
if (!IsValidVehicleOrder(vehicle_id, order_position)) return -1;
if (order_position == ORDER_CURRENT || !IsConditionalOrder(vehicle_id, order_position)) return -1;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
const Order *order = Vehicle::Get(vehicle_id)->GetOrder(order_position);
int32 value = order->GetConditionValue();
if (order->GetConditionVariable() == OCV_MAX_SPEED) value = value * 16 / 10;
return value;
@@ -318,7 +299,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
if (AIVehicle::GetVehicleType(vehicle_id) != AIVehicle::VT_RAIL) return STOPLOCATION_INVALID;
if (!IsGotoStationOrder(vehicle_id, order_position)) return STOPLOCATION_INVALID;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
const Order *order = Vehicle::Get(vehicle_id)->GetOrder(order_position);
return (AIOrder::StopLocation)order->GetStopLocation();
}
@@ -505,7 +486,7 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, order_position));
EnforcePrecondition(false, AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_position), order_flags));
const Order *order = ::ResolveOrder(vehicle_id, order_position);
const Order *order = Vehicle::Get(vehicle_id)->GetOrder(order_position);
AIOrderFlags current = GetOrderFlags(vehicle_id, order_position);

View File

@@ -12,6 +12,7 @@
#ifndef AI_ORDER_HPP
#define AI_ORDER_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
/**
@@ -112,13 +113,7 @@ public:
CF_INVALID = -1, ///< Invalid compare function, do not use.
};
/**
* Index in the list of orders for a vehicle. The first order has index 0, the second
* order index 1, etc. The current order can be queried by using ORDER_CURRENT. Do not
* use ORDER_INVALID yourself, it's used as return value by for example ResolveOrderPosition.
* @note Automatic orders are hidden from AIs, so OrderPosition 0 will always be the first
* manual order.
*/
/** Different constants related to the OrderPosition */
enum OrderPosition {
ORDER_CURRENT = 0xFF, ///< Constant that gets resolved to the current order.
ORDER_INVALID = -1, ///< An invalid order.

View File

@@ -9,7 +9,6 @@
/** @file ai_rail.cpp Implementation of AIRail. */
#include "../../stdafx.h"
#include "ai_rail.hpp"
#include "ai_map.hpp"
#include "ai_station.hpp"

View File

@@ -12,6 +12,8 @@
#ifndef AI_RAIL_HPP
#define AI_RAIL_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
#include "ai_tile.hpp"
/**
@@ -35,6 +37,9 @@ public:
/** Track not suitable for signals */
ERR_UNSUITABLE_TRACK, // [STR_ERROR_NO_SUITABLE_RAILROAD_TRACK]
/** Non-uniform stations is diabled */
ERR_NONUNIFORM_STATIONS_DISABLED, // [STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED]
/** This railtype cannot have crossings */
ERR_RAILTYPE_DISALLOWS_CROSSING, // [STR_ERROR_CROSSING_DISALLOWED]
};

View File

@@ -38,43 +38,46 @@ void SQAIRail_Register(Squirrel *engine)
SQAIRail.PreRegister(engine);
SQAIRail.AddConstructor<void (AIRail::*)(), 1>(engine, "x");
SQAIRail.DefSQConst(engine, AIRail::ERR_RAIL_BASE, "ERR_RAIL_BASE");
SQAIRail.DefSQConst(engine, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD");
SQAIRail.DefSQConst(engine, AIRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK");
SQAIRail.DefSQConst(engine, AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
SQAIRail.DefSQConst(engine, AIRail::RAILTYPE_INVALID, "RAILTYPE_INVALID");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SW, "RAILTRACK_NE_SW");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SE, "RAILTRACK_NW_SE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_NE, "RAILTRACK_NW_NE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_SW_SE, "RAILTRACK_SW_SE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SW, "RAILTRACK_NW_SW");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SE, "RAILTRACK_NE_SE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_INVALID, "RAILTRACK_INVALID");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL, "SIGNALTYPE_NORMAL");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY, "SIGNALTYPE_ENTRY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT, "SIGNALTYPE_EXIT");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO, "SIGNALTYPE_COMBO");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS, "SIGNALTYPE_PBS");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS_ONEWAY, "SIGNALTYPE_PBS_ONEWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_TWOWAY, "SIGNALTYPE_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL_TWOWAY, "SIGNALTYPE_NORMAL_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY_TWOWAY, "SIGNALTYPE_ENTRY_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT_TWOWAY, "SIGNALTYPE_EXIT_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO_TWOWAY, "SIGNALTYPE_COMBO_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NONE, "SIGNALTYPE_NONE");
SQAIRail.DefSQConst(engine, AIRail::BT_TRACK, "BT_TRACK");
SQAIRail.DefSQConst(engine, AIRail::BT_SIGNAL, "BT_SIGNAL");
SQAIRail.DefSQConst(engine, AIRail::BT_DEPOT, "BT_DEPOT");
SQAIRail.DefSQConst(engine, AIRail::BT_STATION, "BT_STATION");
SQAIRail.DefSQConst(engine, AIRail::BT_WAYPOINT, "BT_WAYPOINT");
SQAIRail.DefSQConst(engine, AIRail::ERR_RAIL_BASE, "ERR_RAIL_BASE");
SQAIRail.DefSQConst(engine, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD");
SQAIRail.DefSQConst(engine, AIRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK");
SQAIRail.DefSQConst(engine, AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");
SQAIRail.DefSQConst(engine, AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
SQAIRail.DefSQConst(engine, AIRail::RAILTYPE_INVALID, "RAILTYPE_INVALID");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SW, "RAILTRACK_NE_SW");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SE, "RAILTRACK_NW_SE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_NE, "RAILTRACK_NW_NE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_SW_SE, "RAILTRACK_SW_SE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SW, "RAILTRACK_NW_SW");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SE, "RAILTRACK_NE_SE");
SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_INVALID, "RAILTRACK_INVALID");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL, "SIGNALTYPE_NORMAL");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY, "SIGNALTYPE_ENTRY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT, "SIGNALTYPE_EXIT");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO, "SIGNALTYPE_COMBO");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS, "SIGNALTYPE_PBS");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS_ONEWAY, "SIGNALTYPE_PBS_ONEWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_TWOWAY, "SIGNALTYPE_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL_TWOWAY, "SIGNALTYPE_NORMAL_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY_TWOWAY, "SIGNALTYPE_ENTRY_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT_TWOWAY, "SIGNALTYPE_EXIT_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO_TWOWAY, "SIGNALTYPE_COMBO_TWOWAY");
SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NONE, "SIGNALTYPE_NONE");
SQAIRail.DefSQConst(engine, AIRail::BT_TRACK, "BT_TRACK");
SQAIRail.DefSQConst(engine, AIRail::BT_SIGNAL, "BT_SIGNAL");
SQAIRail.DefSQConst(engine, AIRail::BT_DEPOT, "BT_DEPOT");
SQAIRail.DefSQConst(engine, AIRail::BT_STATION, "BT_STATION");
SQAIRail.DefSQConst(engine, AIRail::BT_WAYPOINT, "BT_WAYPOINT");
AIError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD);
AIError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, AIRail::ERR_UNSUITABLE_TRACK);
AIError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED, AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING);
AIError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD);
AIError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, AIRail::ERR_UNSUITABLE_TRACK);
AIError::RegisterErrorMap(STR_ERROR_NONUNIFORM_STATIONS_DISALLOWED, AIRail::ERR_NONUNIFORM_STATIONS_DISABLED);
AIError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED, AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING);
AIError::RegisterErrorMapString(AIRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD");
AIError::RegisterErrorMapString(AIRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK");
AIError::RegisterErrorMapString(AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
AIError::RegisterErrorMapString(AIRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD");
AIError::RegisterErrorMapString(AIRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK");
AIError::RegisterErrorMapString(AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");
AIError::RegisterErrorMapString(AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetName, "GetName", 2, ".i");
SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTile, "IsRailTile", 2, ".i");

View File

@@ -9,7 +9,6 @@
/** @file ai_railtypelist.cpp Implementation of AIRailTypeList and friends. */
#include "../../stdafx.h"
#include "ai_railtypelist.hpp"
#include "../../rail.h"
#include "../../company_func.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_road.cpp Implementation of AIRoad. */
#include "../../stdafx.h"
#include "ai_map.hpp"
#include "ai_station.hpp"
#include "ai_cargo.hpp"

View File

@@ -12,6 +12,8 @@
#ifndef AI_ROAD_HPP
#define AI_ROAD_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
#include "ai_tile.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_sign.cpp Implementation of AISign. */
#include "../../stdafx.h"
#include "ai_sign.hpp"
#include "table/strings.h"
#include "../ai_instance.hpp"

View File

@@ -12,7 +12,9 @@
#ifndef AI_SIGN_HPP
#define AI_SIGN_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
#include "ai_company.hpp"
/**
* Class that handles all sign related functions.

View File

@@ -9,7 +9,6 @@
/** @file ai_signlist.cpp Implementation of AISignList and friends. */
#include "../../stdafx.h"
#include "ai_signlist.hpp"
#include "ai_sign.hpp"
#include "../../signs_base.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_station.cpp Implementation of AIStation. */
#include "../../stdafx.h"
#include "ai_station.hpp"
#include "ai_cargo.hpp"
#include "ai_map.hpp"

View File

@@ -12,6 +12,8 @@
#ifndef AI_STATION_HPP
#define AI_STATION_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
#include "ai_road.hpp"
#include "ai_basestation.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_stationlist.cpp Implementation of AIStationList and friends. */
#include "../../stdafx.h"
#include "ai_stationlist.hpp"
#include "ai_vehicle.hpp"
#include "../../company_func.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_subsidy.cpp Implementation of AISubsidy. */
#include "../../stdafx.h"
#include "ai_subsidy.hpp"
#include "ai_date.hpp"
#include "../../subsidy_base.h"

View File

@@ -12,6 +12,7 @@
#ifndef AI_SUBSIDY_HPP
#define AI_SUBSIDY_HPP
#include "ai_object.hpp"
#include "ai_company.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_subsidylist.cpp Implementation of AISubsidyList. */
#include "../../stdafx.h"
#include "ai_subsidylist.hpp"
#include "../../subsidy_base.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_testmode.cpp Implementation of AITestMode. */
#include "../../stdafx.h"
#include "ai_testmode.hpp"
#include "../../company_base.h"
#include "../../company_func.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_tile.cpp Implementation of AITile. */
#include "../../stdafx.h"
#include "ai_tile.hpp"
#include "ai_map.hpp"
#include "ai_town.hpp"

View File

@@ -12,6 +12,7 @@
#ifndef AI_TILE_HPP
#define AI_TILE_HPP
#include "ai_list.hpp"
#include "ai_error.hpp"
#include "ai_company.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_tilelist.cpp Implementation of AITileList and friends. */
#include "../../stdafx.h"
#include "ai_tilelist.hpp"
#include "ai_industry.hpp"
#include "../../industry.h"

View File

@@ -12,8 +12,8 @@
#ifndef AI_TILELIST_HPP
#define AI_TILELIST_HPP
#include "ai_station.hpp"
#include "ai_list.hpp"
#include "ai_station.hpp"
/**
* Creates an empty list, in which you can add tiles.

View File

@@ -9,7 +9,6 @@
/** @file ai_town.cpp Implementation of AITown. */
#include "../../stdafx.h"
#include "ai_town.hpp"
#include "ai_map.hpp"
#include "ai_cargo.hpp"

View File

@@ -12,6 +12,7 @@
#ifndef AI_TOWN_HPP
#define AI_TOWN_HPP
#include "ai_object.hpp"
#include "ai_company.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_townlist.cpp Implementation of AITownList and friends. */
#include "../../stdafx.h"
#include "ai_townlist.hpp"
#include "../../town.h"

View File

@@ -9,7 +9,6 @@
/** @file ai_tunnel.cpp Implementation of AITunnel. */
#include "../../stdafx.h"
#include "ai_tunnel.hpp"
#include "ai_rail.hpp"
#include "../ai_instance.hpp"

View File

@@ -12,6 +12,7 @@
#ifndef AI_TUNNEL_HPP
#define AI_TUNNEL_HPP
#include "ai_object.hpp"
#include "ai_vehicle.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_vehicle.cpp Implementation of AIVehicle. */
#include "../../stdafx.h"
#include "ai_engine.hpp"
#include "ai_cargo.hpp"
#include "ai_gamesettings.hpp"

View File

@@ -12,7 +12,10 @@
#ifndef AI_VEHICLE_HPP
#define AI_VEHICLE_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
#include "ai_road.hpp"
#include "ai_order.hpp"
/**
* Class that handles all vehicle related functions.

View File

@@ -9,7 +9,6 @@
/** @file ai_vehiclelist.cpp Implementation of AIVehicleList and friends. */
#include "../../stdafx.h"
#include "ai_vehiclelist.hpp"
#include "ai_group.hpp"
#include "ai_map.hpp"

View File

@@ -9,7 +9,6 @@
/** @file ai_waypoint.cpp Implementation of AIWaypoint. */
#include "../../stdafx.h"
#include "ai_waypoint.hpp"
#include "ai_rail.hpp"
#include "ai_marine.hpp"

View File

@@ -12,6 +12,8 @@
#ifndef AI_WAYPOINT_HPP
#define AI_WAYPOINT_HPP
#include "ai_object.hpp"
#include "ai_error.hpp"
#include "ai_basestation.hpp"
/**

View File

@@ -9,7 +9,6 @@
/** @file ai_waypointlist.cpp Implementation of AIWaypointList and friends. */
#include "../../stdafx.h"
#include "ai_waypointlist.hpp"
#include "ai_vehicle.hpp"
#include "../../company_func.h"

View File

@@ -50,10 +50,11 @@ struct Aircraft : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
byte turn_counter; ///< Ticks between each turn to prevent > 45 degree turns.
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
Aircraft() : SpecializedVehicleBase() {}
Aircraft() : SpecializedVehicle<Aircraft, VEH_AIRCRAFT>() {}
/** We want to 'destruct' the right class. */
virtual ~Aircraft() { this->PreDestructor(); }
const char *GetTypeString() const { return "aircraft"; }
void MarkDirty();
void UpdateDeltaXY(Direction direction);
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }

View File

@@ -605,7 +605,9 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
/* updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) {
v->cur_speed = spd;
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
if (_settings_client.gui.vehicle_speed) {
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
}
/* Adjust distance moved by plane speed setting */

View File

@@ -551,7 +551,7 @@ static const NWidgetPart _nested_build_airport_widgets[] = {
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, BAIRW_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, BAIRW_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL),
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, BAIRW_LAYOUT_DECREASE), SetMinimalSize(12, 0),SetDataTip(AWV_DECREASE, STR_NULL),
NWidget(WWT_LABEL, COLOUR_GREY, BAIRW_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, BAIRW_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
EndContainer(),

View File

@@ -221,7 +221,19 @@ bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *carg
}
}
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL;
switch (v->type) {
case VEH_TRAIN:
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticulatedPart() : NULL;
break;
case VEH_ROAD:
v = RoadVehicle::From(v)->HasArticulatedPart() ? v->Next() : NULL;
break;
default:
v = NULL;
break;
}
} while (v != NULL);
if (cargo_type != NULL) *cargo_type = first_cargo;
@@ -256,7 +268,19 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
assert(v->cargo_type < NUM_CARGO);
real_default_capacity[v->cargo_type] += v->cargo_cap;
v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL;
switch (v->type) {
case VEH_TRAIN:
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticulatedPart() : NULL;
break;
case VEH_ROAD:
v = RoadVehicle::From(v)->HasArticulatedPart() ? v->Next() : NULL;
break;
default:
v = NULL;
break;
}
} while (v != NULL);
/* Check whether the vehicle carries more cargos than expected */

View File

@@ -101,18 +101,18 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai
assert(!part_of_chain || new_head->IsPrimaryVehicle());
/* Loop through source parts */
for (Vehicle *src = old_veh; src != NULL; src = src->Next()) {
if (!part_of_chain && src->type == VEH_TRAIN && src != old_veh && src != Train::From(old_veh)->other_multiheaded_part && !src->IsArticulatedPart()) {
if (!part_of_chain && src->type == VEH_TRAIN && src != old_veh && src != Train::From(old_veh)->other_multiheaded_part && !Train::From(src)->IsArticulatedPart()) {
/* Skip vehicles, which do not belong to old_veh */
src = src->GetLastEnginePart();
src = Train::From(src)->GetLastEnginePart();
continue;
}
if (src->cargo_type >= NUM_CARGO || src->cargo.Count() == 0) continue;
/* Find free space in the new chain */
for (Vehicle *dest = new_head; dest != NULL && src->cargo.Count() > 0; dest = dest->Next()) {
if (!part_of_chain && dest->type == VEH_TRAIN && dest != new_head && dest != Train::From(new_head)->other_multiheaded_part && !dest->IsArticulatedPart()) {
if (!part_of_chain && dest->type == VEH_TRAIN && dest != new_head && dest != Train::From(new_head)->other_multiheaded_part && !Train::From(dest)->IsArticulatedPart()) {
/* Skip vehicles, which do not belong to new_head */
dest = dest->GetLastEnginePart();
dest = Train::From(dest)->GetLastEnginePart();
continue;
}
if (dest->cargo_type != src->cargo_type) continue;
@@ -218,7 +218,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool
*/
static EngineID GetNewEngineType(const Vehicle *v, const Company *c)
{
assert(v->type != VEH_TRAIN || !v->IsArticulatedPart());
assert(v->type != VEH_TRAIN || !Train::From(v)->IsArticulatedPart());
if (v->type == VEH_TRAIN && Train::From(v)->IsRearDualheaded()) {
/* we build the rear ends of multiheaded trains with the front ones */
@@ -292,7 +292,7 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic
* @param evaluate_callback shall the start/stop callback be evaluated?
* @return success or error
*/
static inline CommandCost CmdStartStopVehicle(const Vehicle *v, bool evaluate_callback)
static inline CommandCost StartStopVehicle(const Vehicle *v, bool evaluate_callback)
{
return DoCommand(0, v->index, evaluate_callback ? 1 : 0, DC_EXEC | DC_AUTOREPLACE, CMD_START_STOP_VEHICLE);
}
@@ -305,7 +305,7 @@ static inline CommandCost CmdStartStopVehicle(const Vehicle *v, bool evaluate_ca
* @param whole_chain move all vehicles following 'v' (true), or only 'v' (false)
* @return success or error
*/
static inline CommandCost CmdMoveVehicle(const Vehicle *v, const Vehicle *after, DoCommandFlag flags, bool whole_chain)
static inline CommandCost MoveVehicle(const Vehicle *v, const Vehicle *after, DoCommandFlag flags, bool whole_chain)
{
return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != NULL ? after->index : INVALID_VEHICLE, flags, CMD_MOVE_RAIL_VEHICLE);
}
@@ -330,10 +330,10 @@ static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head,
if (cost.Succeeded()) {
/* Start the vehicle, might be denied by certain things */
assert((new_head->vehstatus & VS_STOPPED) != 0);
cost.AddCost(CmdStartStopVehicle(new_head, true));
cost.AddCost(StartStopVehicle(new_head, true));
/* Stop the vehicle again, but do not care about evil newgrfs allowing starting but not stopping :p */
if (cost.Succeeded()) cost.AddCost(CmdStartStopVehicle(new_head, false));
if (cost.Succeeded()) cost.AddCost(StartStopVehicle(new_head, false));
}
/* Last do those things which do never fail (resp. we do not care about), but which are not undo-able */
@@ -379,7 +379,7 @@ static CommandCost ReplaceFreeUnit(Vehicle **single_unit, DoCommandFlag flags, b
if ((flags & DC_EXEC) != 0) {
/* Move the new vehicle behind the old */
CmdMoveVehicle(new_v, old_v, DC_EXEC, false);
MoveVehicle(new_v, old_v, DC_EXEC, false);
/* Take over cargo
* Note: We do only transfer cargo from the old to the new vehicle.
@@ -451,7 +451,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if (cost.Succeeded()) {
/* Separate the head, so we can start constructing the new chain */
Train *second = Train::From(old_head)->GetNextUnit();
if (second != NULL) cost.AddCost(CmdMoveVehicle(second, NULL, DC_EXEC | DC_AUTOREPLACE, true));
if (second != NULL) cost.AddCost(MoveVehicle(second, NULL, DC_EXEC | DC_AUTOREPLACE, true));
assert(Train::From(new_head)->GetNextUnit() == NULL);
@@ -470,11 +470,11 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
/* Move the old engine to a separate row with DC_AUTOREPLACE. Else
* moving the wagon in front may fail later due to unitnumber limit.
* (We have to attach wagons without DC_AUTOREPLACE.) */
CmdMoveVehicle(old_vehs[i], NULL, DC_EXEC | DC_AUTOREPLACE, false);
MoveVehicle(old_vehs[i], NULL, DC_EXEC | DC_AUTOREPLACE, false);
}
if (last_engine == NULL) last_engine = append;
cost.AddCost(CmdMoveVehicle(append, new_head, DC_EXEC, false));
cost.AddCost(MoveVehicle(append, new_head, DC_EXEC, false));
if (cost.Failed()) break;
}
if (last_engine == NULL) last_engine = new_head;
@@ -493,10 +493,10 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if (RailVehInfo(append->engine_type)->railveh_type == RAILVEH_WAGON) {
/* Insert wagon after 'last_engine' */
CommandCost res = CmdMoveVehicle(append, last_engine, DC_EXEC, false);
CommandCost res = MoveVehicle(append, last_engine, DC_EXEC, false);
if (res.Succeeded() && wagon_removal && new_head->gcache.cached_total_length > old_total_length) {
CmdMoveVehicle(append, NULL, DC_EXEC | DC_AUTOREPLACE, false);
MoveVehicle(append, NULL, DC_EXEC | DC_AUTOREPLACE, false);
break;
}
@@ -565,12 +565,12 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if ((flags & DC_EXEC) == 0) {
/* Separate the head, so we can reattach the old vehicles */
Train *second = Train::From(old_head)->GetNextUnit();
if (second != NULL) CmdMoveVehicle(second, NULL, DC_EXEC | DC_AUTOREPLACE, true);
if (second != NULL) MoveVehicle(second, NULL, DC_EXEC | DC_AUTOREPLACE, true);
assert(Train::From(old_head)->GetNextUnit() == NULL);
for (int i = num_units - 1; i > 0; i--) {
CommandCost ret = CmdMoveVehicle(old_vehs[i], old_head, DC_EXEC | DC_AUTOREPLACE, false);
CommandCost ret = MoveVehicle(old_vehs[i], old_head, DC_EXEC | DC_AUTOREPLACE, false);
assert(ret.Succeeded());
}
}
@@ -671,7 +671,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
bool was_stopped = free_wagon || ((v->vehstatus & VS_STOPPED) != 0);
/* Stop the vehicle */
if (!was_stopped) cost.AddCost(CmdStartStopVehicle(v, true));
if (!was_stopped) cost.AddCost(StartStopVehicle(v, true));
if (cost.Failed()) return cost;
assert(v->IsStoppedInDepot());
@@ -699,7 +699,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
}
/* Restart the vehicle */
if (!was_stopped) cost.AddCost(CmdStartStopVehicle(v, false));
if (!was_stopped) cost.AddCost(StartStopVehicle(v, false));
}
if (cost.Succeeded() && nothing_to_do) cost = CommandCost(STR_ERROR_AUTOREPLACE_NOTHING_TO_DO);

View File

@@ -19,6 +19,7 @@
#include "window_func.h"
#include "autoreplace_func.h"
#include "company_func.h"
#include "widgets/dropdown_type.h"
#include "engine_base.h"
#include "window_gui.h"
#include "engine_gui.h"

View File

@@ -16,6 +16,7 @@
#include "depot_func.h"
#include "slope_func.h"
#include "tile_map.h"
#include "openttd.h"
/**
* Autoslope check for tiles with an entrance on an edge.

View File

@@ -13,6 +13,7 @@
#define BLITTER_32BPP_OPTIMIZED_HPP
#include "32bpp_simple.hpp"
#include "factory.hpp"
class Blitter_32bppOptimized : public Blitter_32bppSimple {
public:

View File

@@ -12,6 +12,7 @@
#ifndef BLITTER_NULL_HPP
#define BLITTER_NULL_HPP
#include "base.hpp"
#include "factory.hpp"
class Blitter_Null : public Blitter {

View File

@@ -43,7 +43,7 @@ typedef uint BridgeType; ///< Bridge spec number.
struct BridgeSpec {
Year avail_year; ///< the year where it becomes available
byte min_length; ///< the minimum length (not counting start and end tile)
uint16 max_length; ///< the maximum length (not counting start and end tile)
byte max_length; ///< the maximum length (not counting start and end tile)
uint16 price; ///< the price multiplier
uint16 speed; ///< maximum travel speed (1 unit = 1/1.6 mph = 1 km-ish/h)
SpriteID sprite; ///< the sprite which is used in the GUI
@@ -72,4 +72,7 @@ int CalcBridgeLenCostFactor(int x);
void ResetBridges();
static const uint MAX_BRIDGE_LENGTH = 16; ///< Maximum length of the bridge
static const uint MAX_BRIDGE_LENGTH_LONGBRIDGES = 100; ///< Maximum length of the bridge with longbridges enabled
#endif /* BRIDGE_H */

View File

@@ -12,6 +12,7 @@
#include "stdafx.h"
#include "gui.h"
#include "command_func.h"
#include "bridge.h"
#include "rail.h"
#include "strings_func.h"
#include "window_func.h"
@@ -21,6 +22,7 @@
#include "sortlist_type.h"
#include "widgets/dropdown_func.h"
#include "core/geometry_func.hpp"
#include "openttd.h"
#include "cmd_helper.h"
#include "tunnelbridge_map.h"
#include "road_gui.h"

Some files were not shown because too many files have changed in this diff Show More