diff options
author | frosch <frosch@openttd.org> | 2009-03-09 18:56:50 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-03-09 18:56:50 +0000 |
commit | 90a81da62bbee3a39355742ce352367ec7211b5a (patch) | |
tree | 0c5d38ac95f618e15346ea12e51c1d4d9733f387 | |
parent | 0f2af502315fda4eb05b6700bf571b78018f5f47 (diff) | |
download | openttd-90a81da62bbee3a39355742ce352367ec7211b5a.tar.xz |
(svn r15654) -Fix: Only ever call any vehicle callbacks after the whole articulated engine has been built. (except 0x16)
-rw-r--r-- | src/articulated_vehicles.cpp | 2 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp index a53facf80..07eac790d 100644 --- a/src/articulated_vehicles.cpp +++ b/src/articulated_vehicles.cpp @@ -307,7 +307,7 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type) u = new (u) RoadVehicle(); previous->SetNext(u); u->u.road.first_engine = v->engine_type; - u->u.road.cached_veh_length = GetRoadVehLength(u); + u->u.road.cached_veh_length = 8; // Callback is called when the consist is finished u->u.road.state = RVSB_IN_DEPOT; u->u.road.roadtype = v->u.road.roadtype; diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 649c54312..185c9250b 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -254,7 +254,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint v->u.road.roadtype = HasBit(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD; v->u.road.compatible_roadtypes = RoadTypeToRoadTypes(v->u.road.roadtype); - v->u.road.cached_veh_length = GetRoadVehLength(v); + v->u.road.cached_veh_length = 8; v->vehicle_flags = 0; if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE); @@ -263,8 +263,9 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint AddArticulatedParts(vl, VEH_ROAD); - /* Call callback 36s after the whole consist has been constructed */ + /* Call various callbacks after the whole consist has been constructed */ for (Vehicle *u = v; u != NULL; u = u->Next()) { + u->u.road.cached_veh_length = GetRoadVehLength(u); /* Cargo capacity is zero if and only if the vehicle cannot carry anything */ if (u->cargo_cap != 0) u->cargo_cap = GetVehicleProperty(u, 0x0F, u->cargo_cap); } |