Changeset - r10612:dd2ff4b0ddc7
[Not reviewed]
master
0 2 0
frosch - 16 years ago 2009-01-07 17:50:20
frosch@openttd.org
(svn r14903) -Fix: First create all articulated parts of roadvehicles, then call callback 36 capacity, also call it for all articulated parts.
2 files changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/articulated_vehicles.cpp
Show inline comments
 
@@ -274,13 +274,13 @@ void AddArticulatedParts(Vehicle **vl, V
 
				u->u.rail.track = v->u.rail.track;
 
				u->u.rail.railtype = v->u.rail.railtype;
 
				u->u.rail.first_engine = v->engine_type;
 

	
 
				u->spritenum = rvi_artic->image_index;
 
				u->cargo_type = rvi_artic->cargo_type;
 
				u->cargo_cap = rvi_artic->capacity;
 
				u->cargo_cap = rvi_artic->capacity;  // Callback 36 is called when the consist is finished
 

	
 
				SetArticulatedPart(u);
 
			} break;
 

	
 
			case VEH_ROAD: {
 
				const RoadVehicleInfo *rvi_artic = RoadVehInfo(engine_type);
 
@@ -293,13 +293,13 @@ void AddArticulatedParts(Vehicle **vl, V
 

	
 
				u->u.road.roadtype = v->u.road.roadtype;
 
				u->u.road.compatible_roadtypes = v->u.road.compatible_roadtypes;
 

	
 
				u->spritenum = rvi_artic->image_index;
 
				u->cargo_type = rvi_artic->cargo_type;
 
				u->cargo_cap = rvi_artic->capacity;
 
				u->cargo_cap = rvi_artic->capacity;  // Callback 36 is called when the consist is finished
 

	
 
				SetRoadVehArticPart(u);
 
			} break;
 
		}
 

	
 
		if (flip_image) u->spritenum++;
src/roadveh_cmd.cpp
Show inline comments
 
@@ -271,16 +271,21 @@ CommandCost CmdBuildRoadVeh(TileIndex ti
 
		v->u.road.compatible_roadtypes = RoadTypeToRoadTypes(v->u.road.roadtype);
 
		v->u.road.cached_veh_length = GetRoadVehLength(v);
 

	
 
		v->vehicle_flags = 0;
 
		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 

	
 
		v->cargo_cap = GetVehicleProperty(v, 0x0F, rvi->capacity);
 
		v->cargo_cap = rvi->capacity;
 

	
 
		AddArticulatedParts(vl, VEH_ROAD);
 

	
 
		/* Call callback 36s after the whole consist has been constructed */
 
		for (Vehicle *u = v; u != NULL; u = u->Next()) {
 
			u->cargo_cap = GetVehicleProperty(u, 0x0F, u->cargo_cap);
 
		}
 

	
 
		VehiclePositionChanged(v);
 

	
 
		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 
		InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
 
		InvalidateWindow(WC_COMPANY, v->owner);
 
		if (IsLocalCompany())
0 comments (0 inline, 0 general)