diff options
author | rubidium <rubidium@openttd.org> | 2009-07-22 08:59:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-22 08:59:57 +0000 |
commit | 68ead6b84f56ad3c93d05ad3e09b7fbb8173cf26 (patch) | |
tree | ee33bd19b96a138530a84e86e7ffd60c0700f9d9 /src/order_cmd.cpp | |
parent | 2646a99d29535a44c5998f080131cbca2e85bdcf (diff) | |
download | openttd-68ead6b84f56ad3c93d05ad3e09b7fbb8173cf26.tar.xz |
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
-Change: make (rail) waypoints sub classes of 'base stations', make buoys waypoints and unify code between them where possible.
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r-- | src/order_cmd.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 0fb5087c0..7e3a890e1 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -542,18 +542,19 @@ CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 } case OT_GOTO_WAYPOINT: { + const Waypoint *wp = Waypoint::GetIfValid(new_order.GetDestination()); + if (wp == NULL) return CMD_ERROR; + switch (v->type) { default: return CMD_ERROR; - case VEH_TRAIN: { - const Waypoint *wp = Waypoint::GetIfValid(new_order.GetDestination()); - if (wp == NULL || !CheckOwnership(wp->owner)) return CMD_ERROR; - } break; + case VEH_TRAIN: + if (!CheckOwnership(wp->owner)) return CMD_ERROR; + break; - case VEH_SHIP: { - const Station *st = Station::GetIfValid(new_order.GetDestination()); - if (st == NULL || (!CheckOwnership(st->owner) && st->owner != OWNER_NONE)) return CMD_ERROR; - } break; + case VEH_SHIP: + if (!CheckOwnership(wp->owner) && wp->owner != OWNER_NONE) return CMD_ERROR; + break; } /* Order flags can be any of the following for waypoints: |