File diff r11916:e3a8d08bf479 → r11917:612c11f7ab47
src/articulated_vehicles.cpp
Show inline comments
 
@@ -45,13 +45,13 @@ uint CountArticulatedParts(EngineID engi
 
 * @param type the type of the engine
 
 * @param cargo_type returns the default cargo type, if needed
 
 * @return capacity
 
 */
 
static inline uint16 GetVehicleDefaultCapacity(EngineID engine, VehicleType type, CargoID *cargo_type)
 
{
 
	const Engine *e = GetEngine(engine);
 
	const Engine *e = Engine::Get(engine);
 
	CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : (CargoID)CT_INVALID);
 
	if (cargo_type != NULL) *cargo_type = cargo;
 
	if (cargo == CT_INVALID) return 0;
 
	return e->GetDisplayDefaultCapacity();
 
}
 

	
 
@@ -110,13 +110,13 @@ uint16 *GetCapacityOfArticulatedParts(En
 
 * @return true if refittable
 
 */
 
bool IsArticulatedVehicleRefittable(EngineID engine)
 
{
 
	if (IsEngineRefittable(engine)) return true;
 

	
 
	const Engine *e = GetEngine(engine);
 
	const Engine *e = Engine::Get(engine);
 
	if (e->type != VEH_TRAIN && e->type != VEH_ROAD) return false;
 

	
 
	if (!HasBit(e->info.callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return false;
 

	
 
	for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL);
 
@@ -232,13 +232,13 @@ bool IsArticulatedVehicleCarryingDiffere
 
 *   For autoreplace/-renew:
 
 *    - Default cargo type (without capacity)
 
 *    - intersection and union of refit masks.
 
 */
 
void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
 
{
 
	const Engine *engine = GetEngine(v->engine_type);
 
	const Engine *engine = Engine::Get(v->engine_type);
 

	
 
	uint32 purchase_refit_union = GetUnionOfArticulatedRefitMasks(v->engine_type, v->type, true);
 
	uint32 purchase_refit_intersection = GetIntersectionOfArticulatedRefitMasks(v->engine_type, v->type, true);
 
	uint16 *purchase_default_capacity = GetCapacityOfArticulatedParts(v->engine_type, v->type);
 

	
 
	uint32 real_refit_union = 0;
 
@@ -300,13 +300,13 @@ void AddArticulatedParts(Vehicle *first,
 
		if (!Vehicle::CanAllocateItem()) return;
 

	
 
		EngineID engine_type = GetNewEngineID(GetEngineGRF(v->engine_type), type, GB(callback, 0, 7));
 
		bool flip_image = HasBit(callback, 7);
 

	
 
		Vehicle *previous = u;
 
		const Engine *e_artic = GetEngine(engine_type);
 
		const Engine *e_artic = Engine::Get(engine_type);
 
		switch (type) {
 
			default: NOT_REACHED();
 

	
 
			case VEH_TRAIN:
 
				u = new Train();
 
				u->subtype = 0;