--- a/src/vehicle.cpp Thu Apr 17 08:40:01 2008 +0000
+++ b/src/vehicle.cpp Fri Apr 18 23:33:51 2008 +0000
@@ -19,7 +19,6 @@
#include "player_func.h"
#include "debug.h"
#include "vehicle_gui.h"
-#include "depot.h"
#include "rail_type.h"
#include "train.h"
#include "aircraft.h"
@@ -47,6 +46,7 @@
#include "string_func.h"
#include "settings_type.h"
#include "oldpool_func.h"
+#include "depot_map.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -835,11 +835,9 @@
if (v->progress > 0) {
v->progress--;
} else {
- TileIndex tile;
-
BeginVehicleMove(v);
- tile = TileVirtXY(v->x_pos, v->y_pos);
+ TileIndex tile = TileVirtXY(v->x_pos, v->y_pos);
if (!IsTileType(tile, MP_INDUSTRY)) {
EndVehicleMove(v);
delete v;
@@ -1487,10 +1485,10 @@
/* decrease reliability */
v->reliability = rel = max((rel_old = v->reliability) - v->reliability_spd_dec, 0);
- if ((rel_old >> 8) != (rel >> 8))
- InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+ if ((rel_old >> 8) != (rel >> 8)) InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
if (v->breakdown_ctr != 0 || v->vehstatus & VS_STOPPED ||
+ _opt.diff.vehicle_breakdowns < 1 ||
v->cur_speed < 5 || _game_mode == GM_MENU) {
return;
}
@@ -1499,16 +1497,13 @@
/* increase chance of failure */
int chance = v->breakdown_chance + 1;
- if (Chance16I(1,25,r)) chance += 25;
+ if (Chance16I(1, 25, r)) chance += 25;
v->breakdown_chance = min(255, chance);
/* calculate reliability value to use in comparison */
rel = v->reliability;
if (v->type == VEH_SHIP) rel += 0x6666;
- /* disabled breakdowns? */
- if (_opt.diff.vehicle_breakdowns < 1) return;
-
/* reduced breakdowns? */
if (_opt.diff.vehicle_breakdowns == 1) rel += 0x6666;
@@ -2074,7 +2069,7 @@
break;
}
- case VLW_GROUP_LIST:
+ case VLW_GROUP_LIST:
FOR_ALL_VEHICLES(v) {
if (v->type == type && v->IsPrimaryVehicle() &&
v->owner == owner && v->group_id == index) {
@@ -3217,7 +3212,7 @@
/* check if at a standstill (not stopped only) in a depot
* the check is down here to make it possible to alter stop/service for trains entering the depot */
- if (this->type == VEH_TRAIN && IsTileDepotType(this->tile, TRANSPORT_RAIL) && this->cur_speed == 0) return CMD_ERROR;
+ if (this->type == VEH_TRAIN && IsRailDepotTile(this->tile) && this->cur_speed == 0) return CMD_ERROR;
TileIndex location;
DestinationID destination;