summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-02-25 13:07:29 +0000
committerPeterN <peter@fuzzle.org>2019-03-31 17:22:54 +0100
commitf656f5e8eb8835aad2ad19ca9ade253666b17089 (patch)
tree6aa9731527dfc54ddc3f80403494943ec09ab9be /src
parent66bed86bbb76ff799e79df1796535f592af81a1f (diff)
downloadopenttd-f656f5e8eb8835aad2ad19ca9ade253666b17089.tar.xz
Change: Remove ship max order distance.
It is skipped when NPF is in use. It is trivial to work around by adding and removing dummy orders. It is mostly alleviated by the ship path cache in YAPF.
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp37
-rw-r--r--src/ship.h2
2 files changed, 0 insertions, 39 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index dae6e58ad..2bfe5d29b 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -23,7 +23,6 @@
#include "core/random_func.hpp"
#include "aircraft.h"
#include "roadveh.h"
-#include "ship.h"
#include "station_base.h"
#include "waypoint_base.h"
#include "company_base.h"
@@ -900,42 +899,6 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (!Order::CanAllocateItem()) return_cmd_error(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS);
if (v->orders.list == NULL && !OrderList::CanAllocateItem()) return_cmd_error(STR_ERROR_NO_MORE_SPACE_FOR_ORDERS);
- if (v->type == VEH_SHIP && _settings_game.pf.pathfinder_for_ships != VPF_NPF) {
- /* Make sure the new destination is not too far away from the previous */
- const Order *prev = NULL;
- uint n = 0;
-
- /* Find the last goto station or depot order before the insert location.
- * If the order is to be inserted at the beginning of the order list this
- * finds the last order in the list. */
- const Order *o;
- FOR_VEHICLE_ORDERS(v, o) {
- switch (o->GetType()) {
- case OT_GOTO_STATION:
- case OT_GOTO_DEPOT:
- case OT_GOTO_WAYPOINT:
- prev = o;
- break;
-
- default: break;
- }
- if (++n == sel_ord && prev != NULL) break;
- }
- if (prev != NULL) {
- uint dist;
- if (new_order.IsType(OT_CONDITIONAL)) {
- /* The order is not yet inserted, so we have to do the first iteration here. */
- dist = GetOrderDistance(prev, v->GetOrder(new_order.GetConditionSkipToOrder()), v);
- } else {
- dist = GetOrderDistance(prev, &new_order, v);
- }
-
- if (dist >= SHIP_MAX_ORDER_DISTANCE) {
- return_cmd_error(STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION);
- }
- }
- }
-
if (flags & DC_EXEC) {
Order *new_o = new Order();
new_o->AssignOrder(new_order);
diff --git a/src/ship.h b/src/ship.h
index 60d4466d6..6f818efb2 100644
--- a/src/ship.h
+++ b/src/ship.h
@@ -57,8 +57,6 @@ struct Ship FINAL : public SpecializedVehicle<Ship, VEH_SHIP> {
void SetDestTile(TileIndex tile);
};
-static const uint SHIP_MAX_ORDER_DISTANCE = 130;
-
/**
* Iterate over all ships.
* @param var The variable used for iteration.