summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-08 05:44:37 +0000
committercelestar <celestar@openttd.org>2006-04-08 05:44:37 +0000
commitfd10af66d7c27eea4ccab8b41e54136793468f71 (patch)
tree14ad62cfc66dd0cfa337b481541f4b08e6f70fdf
parent9760d3dccf127d8462790d7296ef50551de12751 (diff)
downloadopenttd-fd10af66d7c27eea4ccab8b41e54136793468f71.tar.xz
(svn r4320) -Fix/Codechange: rs->num_vehicles is no longer saved or loaded, but computed on the fly. Partly fixes FS#101
-rw-r--r--station_cmd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 51a863c4f..7cdc82c04 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -2749,7 +2749,7 @@ static const SaveLoad _roadstop_desc[] = {
SLE_REF(RoadStop,prev, REF_ROADSTOPS),
SLE_CONDNULL(4, 0, 24),
- SLE_CONDVAR(RoadStop, num_vehicles, SLE_UINT8, 25, SL_MAX_VERSION),
+ SLE_CONDNULL(1, 25, 25),
SLE_END()
};
@@ -2910,6 +2910,7 @@ static void Save_ROADSTOP(void)
static void Load_ROADSTOP(void)
{
int index;
+ Vehicle *v;
while ((index = SlIterateArray()) != -1) {
RoadStop *rs;
@@ -2918,9 +2919,12 @@ static void Load_ROADSTOP(void)
error("RoadStops: failed loading savegame: too many RoadStops");
rs = GetRoadStop(index);
- rs->num_vehicles = 0;
SlObject(rs, _roadstop_desc);
}
+
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == VEH_Road && v->u.road.slot != NULL) GetRoadStopByTile(v->dest_tile, v->cargo_type == CT_PASSENGERS ? RS_BUS : RS_TRUCK)->num_vehicles++;
+ }
}
const ChunkHandler _station_chunk_handlers[] = {