--- a/src/station_cmd.cpp Sun Apr 06 14:12:19 2008 +0000
+++ b/src/station_cmd.cpp Sun Apr 06 23:07:42 2008 +0000
@@ -465,12 +465,13 @@
for (int yc = y1; yc != y2; yc++) {
for (int xc = x1; xc != x2; xc++) {
- if (!(IsInsideBS(xc, x, w) && IsInsideBS(yc, y, h))) {
- TileIndex tile = TileXY(xc, yc);
-
+ TileIndex tile = TileXY(xc, yc);
+
+ if (!IsTileType(tile, MP_STATION)) {
GetProducedCargoProc *gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc;
if (gpc != NULL) {
- CargoID cargos[2] = { CT_INVALID, CT_INVALID };
+ CargoID cargos[256]; // Required for CBID_HOUSE_PRODUCE_CARGO.
+ memset(cargos, CT_INVALID, 256);
gpc(tile, cargos);
for (uint i = 0; i < lengthof(cargos); ++i) {
@@ -1898,7 +1899,7 @@
if (player == INVALID_PLAYER || v->owner == player) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_STATION && order->dest == station) {
+ if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == station) {
return true;
}
}
@@ -2184,6 +2185,9 @@
DrawTramCatenary(ti, axis == AXIS_X ? ROAD_X : ROAD_Y);
}
+ /* End now if buildings are invisible */
+ if (IsInvisibilitySet(TO_BUILDINGS)) return;
+
const DrawTileSeqStruct *dtss;
foreach_draw_tile_seq(dtss, t->seq) {
SpriteID image = dtss->image.sprite;
@@ -2396,33 +2400,27 @@
static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
{
+ StationID station_id = GetStationIndex(tile);
+ if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
+
if (v->type == VEH_TRAIN) {
if (IsRailwayStation(tile) && IsFrontEngine(v) &&
!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
- StationID station_id = GetStationIndex(tile);
-
- if ((!(v->current_order.flags & OFB_NON_STOP) && !_patches.new_nonstop) ||
- (v->current_order.type == OT_GOTO_STATION && v->current_order.dest == station_id)) {
- if (!(_patches.new_nonstop && v->current_order.flags & OFB_NON_STOP) &&
- v->current_order.type != OT_LEAVESTATION &&
- v->last_station_visited != station_id) {
- DiagDirection dir = DirToDiagDir(v->direction);
-
- x &= 0xF;
- y &= 0xF;
-
- if (DiagDirToAxis(dir) != AXIS_X) Swap(x, y);
- if (y == TILE_SIZE / 2) {
- if (dir != DIAGDIR_SE && dir != DIAGDIR_SW) x = TILE_SIZE - 1 - x;
- if (x == 12) return VETSB_ENTERED_STATION | (VehicleEnterTileStatus)(station_id << VETS_STATION_ID_OFFSET); /* enter station */
- if (x < 12) {
- uint16 spd;
-
- v->vehstatus |= VS_TRAIN_SLOWING;
- spd = _enter_station_speedtable[x];
- if (spd < v->cur_speed) v->cur_speed = spd;
- }
- }
+ DiagDirection dir = DirToDiagDir(v->direction);
+
+ x &= 0xF;
+ y &= 0xF;
+
+ if (DiagDirToAxis(dir) != AXIS_X) Swap(x, y);
+ if (y == TILE_SIZE / 2) {
+ if (dir != DIAGDIR_SE && dir != DIAGDIR_SW) x = TILE_SIZE - 1 - x;
+ if (x == 12) return VETSB_ENTERED_STATION | (VehicleEnterTileStatus)(station_id << VETS_STATION_ID_OFFSET); /* enter station */
+ if (x < 12) {
+ uint16 spd;
+
+ v->vehstatus |= VS_TRAIN_SLOWING;
+ spd = _enter_station_speedtable[x];
+ if (spd < v->cur_speed) v->cur_speed = spd;
}
}
}
@@ -2440,7 +2438,7 @@
/* Check if the vehicle is stopping at this road stop */
if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
- v->current_order.dest == GetStationIndex(tile)) {
+ v->current_order.GetDestination() == GetStationIndex(tile)) {
SetBit(v->u.road.state, RVS_IS_STOPPING);
rs->AllocateDriveThroughBay(side);
}