Merge branch 'master' into jgrpp
# Conflicts: # cmake/CompileFlags.cmake # src/crashlog.cpp # src/fileio.cpp # src/fileio_func.h # src/fios_gui.cpp # src/ini_load.cpp # src/ini_type.h # src/lang/english.txt # src/lang/german.txt # src/lang/korean.txt # src/network/network_client.cpp # src/order_base.h # src/order_cmd.cpp # src/os/windows/win32.cpp # src/road_cmd.cpp # src/saveload/saveload.cpp # src/saveload/saveload.h # src/settings.cpp # src/station_cmd.cpp # src/stdafx.h # src/table/settings.ini # src/tree_cmd.cpp # src/tree_gui.cpp # src/vehicle_base.h # src/video/cocoa/cocoa_v.mm # src/video/cocoa/event.mm # src/video/cocoa/wnd_quartz.mm # src/viewport.cpp # src/widgets/tree_widget.h
This commit is contained in:
@@ -45,8 +45,8 @@
|
||||
/* DestinationID must be at least as large as every these below, because it can
|
||||
* be any of them
|
||||
*/
|
||||
assert_compile(sizeof(DestinationID) >= sizeof(DepotID));
|
||||
assert_compile(sizeof(DestinationID) >= sizeof(StationID));
|
||||
static_assert(sizeof(DestinationID) >= sizeof(DepotID));
|
||||
static_assert(sizeof(DestinationID) >= sizeof(StationID));
|
||||
|
||||
OrderPool _order_pool("Order");
|
||||
INSTANTIATE_POOL_METHODS(Order)
|
||||
@@ -63,8 +63,7 @@ void IntialiseOrderDestinationRefcountMap()
|
||||
ClearOrderDestinationRefcountMap();
|
||||
for (const Vehicle *v : Vehicle::Iterate()) {
|
||||
if (v != v->FirstShared()) continue;
|
||||
const Order *order;
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
for(const Order *order : v->Orders()) {
|
||||
if (order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT)) {
|
||||
_order_destination_refcount_map[OrderDestinationRefcountMapKey(order->GetDestination(), v->owner, order->GetType(), v->type)]++;
|
||||
}
|
||||
@@ -1251,8 +1250,7 @@ void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord)
|
||||
|
||||
/* As we insert an order, the order to skip to will be 'wrong'. */
|
||||
VehicleOrderID cur_order_id = 0;
|
||||
Order *order;
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
for (Order *order : v->Orders()) {
|
||||
if (order->IsType(OT_CONDITIONAL)) {
|
||||
VehicleOrderID order_id = order->GetConditionSkipToOrder();
|
||||
if (order_id >= sel_ord) {
|
||||
@@ -1408,8 +1406,7 @@ void DeleteOrder(Vehicle *v, VehicleOrderID sel_ord)
|
||||
|
||||
/* As we delete an order, the order to skip to will be 'wrong'. */
|
||||
VehicleOrderID cur_order_id = 0;
|
||||
Order *order = nullptr;
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
for (Order *order : v->Orders()) {
|
||||
if (order->IsType(OT_CONDITIONAL)) {
|
||||
VehicleOrderID order_id = order->GetConditionSkipToOrder();
|
||||
if (order_id >= sel_ord) {
|
||||
@@ -1550,8 +1547,7 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
}
|
||||
|
||||
/* As we move an order, the order to skip to will be 'wrong'. */
|
||||
Order *order;
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
for (Order *order : v->Orders()) {
|
||||
if (order->IsType(OT_CONDITIONAL)) {
|
||||
VehicleOrderID order_id = order->GetConditionSkipToOrder();
|
||||
if (order_id == moving_order) {
|
||||
@@ -2194,9 +2190,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
/* Is the vehicle already in the shared list? */
|
||||
if (src->FirstShared() == dst->FirstShared()) return CMD_ERROR;
|
||||
|
||||
const Order *order;
|
||||
|
||||
FOR_VEHICLE_ORDERS(src, order) {
|
||||
for (const Order *order : src->Orders()) {
|
||||
if (OrderGoesToStation(dst, order)) {
|
||||
/* Allow copying unreachable destinations if they were already unreachable for the source.
|
||||
* This is basically to allow cloning / autorenewing / autoreplacing vehicles, while the stations
|
||||
@@ -2283,8 +2277,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
|
||||
/* Trucks can't copy all the orders from busses (and visa versa),
|
||||
* and neither can helicopters and aircraft. */
|
||||
const Order *order;
|
||||
FOR_VEHICLE_ORDERS(src, order) {
|
||||
for (const Order *order : src->Orders()) {
|
||||
if (OrderGoesToStation(dst, order) &&
|
||||
!CanVehicleUseStation(dst, Station::Get(order->GetDestination()))) {
|
||||
return_cmd_error(STR_ERROR_CAN_T_COPY_SHARE_ORDER);
|
||||
@@ -2308,7 +2301,6 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
const Order *order;
|
||||
Order *first = nullptr;
|
||||
Order **order_dst;
|
||||
|
||||
@@ -2318,7 +2310,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
DeleteVehicleOrders(dst, true, ShouldResetOrderIndicesOnOrderCopy(src, dst));
|
||||
|
||||
order_dst = &first;
|
||||
FOR_VEHICLE_ORDERS(src, order) {
|
||||
for (const Order *order : src->Orders()) {
|
||||
*order_dst = new Order();
|
||||
(*order_dst)->AssignOrder(*order);
|
||||
order_dst = &(*order_dst)->next;
|
||||
@@ -2463,14 +2455,13 @@ void CheckOrders(const Vehicle *v)
|
||||
/* Only check every 20 days, so that we don't flood the message log */
|
||||
/* The check is skipped entirely in case the current vehicle is virtual (a.k.a a 'template train') */
|
||||
if (v->owner == _local_company && v->day_counter % 20 == 0 && !HasBit(v->subtype, GVSF_VIRTUAL)) {
|
||||
const Order *order;
|
||||
StringID message = INVALID_STRING_ID;
|
||||
|
||||
/* Check the order list */
|
||||
int n_st = 0;
|
||||
bool has_depot_order = false;
|
||||
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
for (const Order *order : v->Orders()) {
|
||||
/* Dummy order? */
|
||||
if (order->IsType(OT_DUMMY)) {
|
||||
message = STR_NEWS_VEHICLE_HAS_VOID_ORDER;
|
||||
@@ -2566,9 +2557,7 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination, bool
|
||||
*/
|
||||
bool Vehicle::HasDepotOrder() const
|
||||
{
|
||||
const Order *order;
|
||||
|
||||
FOR_VEHICLE_ORDERS(this, order) {
|
||||
for (const Order *order : this->Orders()) {
|
||||
if (order->IsType(OT_GOTO_DEPOT)) return true;
|
||||
}
|
||||
|
||||
@@ -2632,9 +2621,7 @@ uint16 GetServiceIntervalClamped(uint interval, bool ispercent)
|
||||
*/
|
||||
static bool CheckForValidOrders(const Vehicle *v)
|
||||
{
|
||||
const Order *order;
|
||||
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
for (const Order *order : v->Orders()) {
|
||||
switch (order->GetType()) {
|
||||
case OT_GOTO_STATION:
|
||||
case OT_GOTO_DEPOT:
|
||||
@@ -3090,11 +3077,10 @@ CommandCost CmdMassChangeOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||
if (flags & DC_EXEC) {
|
||||
for (Vehicle *v : Vehicle::Iterate()) {
|
||||
if (v->type == vehtype && v->IsPrimaryVehicle() && CheckOwnership(v->owner).Succeeded()) {
|
||||
Order *order;
|
||||
int index = 0;
|
||||
bool changed = false;
|
||||
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
for(Order *order : v->Orders()) {
|
||||
if (order->GetDestination() == from_dest && order->IsType(order_type) &&
|
||||
!(order_type == OT_GOTO_DEPOT && order->GetDepotActionType() & ODATFB_NEAREST_DEPOT)) {
|
||||
Order new_order;
|
||||
|
Reference in New Issue
Block a user