--- a/openttd.c Sat Feb 24 01:02:15 2007 +0000
+++ b/openttd.c Sat Feb 24 01:14:54 2007 +0000
@@ -1585,6 +1585,15 @@
SettingsDisableElrail(_patches.disable_elrails);
}
+ /* Buoys do now store the owner of the previous water tile, which can never
+ * be OWNER_NONE. So replace OWNER_NONE with OWNER_WATER. */
+ if (CheckSavegameVersion(46)) {
+ Station *st;
+ FOR_ALL_STATIONS(st) {
+ if (IsBuoy(st) && IsTileOwner(st->xy, OWNER_NONE)) SetTileOwner(st->xy, OWNER_WATER);
+ }
+ }
+
return true;
}
--- a/order_cmd.c Sat Feb 24 01:02:15 2007 +0000
+++ b/order_cmd.c Sat Feb 24 01:14:54 2007 +0000
@@ -167,6 +167,16 @@
}
+static TileIndex GetOrderLocation(const Order *o)
+{
+ switch (o->type) {
+ default: NOT_REACHED();
+ case OT_GOTO_STATION: return GetStation(o->dest)->xy;
+ case OT_GOTO_DEPOT: return GetDepot(o->dest)->xy;
+ }
+}
+
+
/** Add an order to the orderlist of a vehicle.
* @param tile unused
* @param p1 various bitstuffed elements
@@ -343,18 +353,30 @@
* handle any more then this.. */
if (v->num_orders >= MAX_BACKUP_ORDER_COUNT) return_cmd_error(STR_8832_TOO_MANY_ORDERS);
- /* For ships, make sure that the station is not too far away from the
- * previous destination, for human players with new pathfinding disabled */
- if (v->type == VEH_Ship && IsHumanPlayer(v->owner) &&
- sel_ord != 0 && GetVehicleOrder(v, sel_ord - 1)->type == OT_GOTO_STATION
- && !_patches.new_pathfinding_all) {
+ if (v->type == VEH_Ship &&
+ IsHumanPlayer(v->owner) &&
+ !_patches.new_pathfinding_all) {
+ // Make sure the new destination is not too far away from the previous
+ const Order *prev = NULL;
+ const Order *o;
+ uint n = 0;
- int dist = DistanceManhattan(
- GetStation(GetVehicleOrder(v, sel_ord - 1)->dest)->xy,
- GetStation(new_order.dest)->xy // XXX type != OT_GOTO_STATION?
- );
- if (dist >= 130)
- return_cmd_error(STR_0210_TOO_FAR_FROM_PREVIOUS_DESTINATIO);
+ /* 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. */
+ for (o = v->orders; o != NULL; o = o->next) {
+ if (o->type == OT_GOTO_STATION || o->type == OT_GOTO_DEPOT) prev = o;
+ if (++n == sel_ord && prev != NULL) break;
+ }
+ if (prev != NULL) {
+ uint dist = DistanceManhattan(
+ GetOrderLocation(prev),
+ GetOrderLocation(&new_order)
+ );
+ if (dist >= 130) {
+ return_cmd_error(STR_0210_TOO_FAR_FROM_PREVIOUS_DESTINATIO);
+ }
+ }
}
if (flags & DC_EXEC) {
--- a/station_cmd.c Sat Feb 24 01:02:15 2007 +0000
+++ b/station_cmd.c Sat Feb 24 01:14:54 2007 +0000
@@ -231,12 +231,6 @@
BEGIN_TILE_LOOP(tile_cur, w + 2, h + 2, tile - TileDiffXY(1, 1))
if (IsTileType(tile_cur, MP_STATION)) {
StationID t = GetStationIndex(tile_cur);
- {
- Station *st = GetStation(t);
- // you cannot take control of an oilrig!!
- if (st->airport_type == AT_OILRIG && st->facilities == (FACIL_AIRPORT|FACIL_DOCK))
- continue;
- }
if (closest_station == INVALID_STATION) {
closest_station = t;
@@ -1016,7 +1010,7 @@
if (st != NULL) {
// Reuse an existing station.
- if (st->owner != OWNER_NONE && st->owner != _current_player)
+ if (st->owner != _current_player)
return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
if (st->train_tile != 0) {
@@ -1451,7 +1445,7 @@
}
if (st != NULL) {
- if (st->owner != OWNER_NONE && st->owner != _current_player) {
+ if (st->owner != _current_player) {
return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
}
@@ -1706,7 +1700,7 @@
}
if (st != NULL) {
- if (st->owner != OWNER_NONE && st->owner != _current_player)
+ if (st->owner != _current_player)
return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
if (!StationRect_BeforeAddRect(st, tile, w, h, RECT_MODE_TEST)) return CMD_ERROR;
@@ -1987,7 +1981,7 @@
}
if (st != NULL) {
- if (st->owner != OWNER_NONE && st->owner != _current_player)
+ if (st->owner != _current_player)
return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
if (!StationRect_BeforeAddRect(st, tile, _dock_w_chk[direction], _dock_h_chk[direction], RECT_MODE_TEST)) return CMD_ERROR;
--- a/viewport.c Sat Feb 24 01:02:15 2007 +0000
+++ b/viewport.c Sat Feb 24 01:14:54 2007 +0000
@@ -1617,7 +1617,7 @@
{
const Sign *si;
- if (!(_display_opt & DO_SHOW_SIGNS)) return false;
+ if (!(_display_opt & DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
switch (vp->zoom) {
case 0: