Merge branch 'master' into jgrpp
# Conflicts: # config.lib # projects/openttd_vs140.vcxproj # projects/openttd_vs140.vcxproj.filters # projects/openttd_vs141.vcxproj # projects/openttd_vs141.vcxproj.filters # projects/openttd_vs142.vcxproj # projects/openttd_vs142.vcxproj.filters # src/aircraft_cmd.cpp # src/base_station_base.h # src/core/pool_type.hpp # src/disaster_vehicle.cpp # src/economy.cpp # src/engine.cpp # src/group.h # src/group_cmd.cpp # src/group_gui.cpp # src/lang/english.txt # src/lang/german.txt # src/linkgraph/linkgraph_gui.cpp # src/network/network_command.cpp # src/network/network_server.cpp # src/openttd.cpp # src/order_cmd.cpp # src/road_cmd.cpp # src/saveload/afterload.cpp # src/saveload/cargopacket_sl.cpp # src/saveload/linkgraph_sl.cpp # src/saveload/order_sl.cpp # src/saveload/station_sl.cpp # src/saveload/town_sl.cpp # src/saveload/vehicle_sl.cpp # src/screenshot.cpp # src/screenshot.h # src/settings_gui.cpp # src/settings_type.h # src/smallmap_gui.cpp # src/station.cpp # src/station_cmd.cpp # src/table/settings.ini # src/toolbar_gui.cpp # src/town_cmd.cpp # src/train.h # src/train_cmd.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_base.h # src/vehiclelist.cpp # src/window_type.h
This commit is contained in:
@@ -61,8 +61,7 @@ CommandCost CmdInsertOrderIntl(DoCommandFlag flags, Vehicle *v, VehicleOrderID s
|
||||
void IntialiseOrderDestinationRefcountMap()
|
||||
{
|
||||
ClearOrderDestinationRefcountMap();
|
||||
const Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
for (const Vehicle *v : Vehicle::Iterate()) {
|
||||
if (v != v->FirstShared()) continue;
|
||||
const Order *order;
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
@@ -450,6 +449,20 @@ void OrderList::Initialize(Order *chain, Vehicle *v)
|
||||
for (const Vehicle *u = v->NextShared(); u != nullptr; u = u->NextShared()) ++this->num_vehicles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recomputes Timetable duration.
|
||||
* Split out into a separate function so it can be used by afterload.
|
||||
*/
|
||||
void OrderList::RecalculateTimetableDuration()
|
||||
{
|
||||
this->timetable_duration = 0;
|
||||
for (Order *o = this->first; o != nullptr; o = o->next) {
|
||||
if (!o->IsType(OT_CONDITIONAL)) {
|
||||
this->timetable_duration += o->GetTimetabledWait() + o->GetTimetabledTravel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Free a complete order chain.
|
||||
* @param keep_orderlist If this is true only delete the orders, otherwise also delete the OrderList.
|
||||
@@ -2327,14 +2340,12 @@ void CheckOrders(const Vehicle *v)
|
||||
*/
|
||||
void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool hangar)
|
||||
{
|
||||
Vehicle *v;
|
||||
|
||||
/* Aircraft have StationIDs for depot orders and never use DepotIDs
|
||||
* This fact is handled specially below
|
||||
*/
|
||||
|
||||
/* Go through all vehicles */
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
for (Vehicle *v : Vehicle::Iterate()) {
|
||||
Order *order = &v->current_order;
|
||||
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) && !hangar ? OT_GOTO_STATION : order->GetType()) == type &&
|
||||
(!hangar || v->type == VEH_AIRCRAFT) && v->current_order.GetDestination() == destination) {
|
||||
@@ -2859,8 +2870,7 @@ CommandCost CmdMassChangeOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||
DestinationID to_dest = GB(p2, 0, 16);
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
for (Vehicle *v : Vehicle::Iterate()) {
|
||||
if (v->type == vehtype && v->IsPrimaryVehicle() && CheckOwnership(v->owner).Succeeded()) {
|
||||
Order *order;
|
||||
int index = 0;
|
||||
|
Reference in New Issue
Block a user