diff --git a/src/vehicle_base.h b/src/vehicle_base.h --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -755,7 +755,7 @@ public: * and that shall not be resetted for the new vehicle. * @param src The old vehicle */ - inline void CopyVehicleConfigAndStatistics(const Vehicle *src) + inline void CopyVehicleConfigAndStatistics(Vehicle *src) { this->CopyConsistPropertiesFrom(src); @@ -766,6 +766,8 @@ public: this->profit_this_year = src->profit_this_year; this->profit_last_year = src->profit_last_year; + + src->unitnumber = 0; } @@ -1270,19 +1272,6 @@ struct SpecializedVehicle : public Vehic static Pool::IterateWrapper Iterate(size_t from = 0) { return Pool::IterateWrapper(from); } }; -/** Generates sequence of free UnitID numbers */ -struct FreeUnitIDGenerator { - bool *cache; ///< array of occupied unit id numbers - UnitID maxid; ///< maximum ID at the moment of constructor call - UnitID curid; ///< last ID returned; 0 if none - - FreeUnitIDGenerator(VehicleType type, CompanyID owner); - UnitID NextID(); - - /** Releases allocated memory */ - ~FreeUnitIDGenerator() { free(this->cache); } -}; - /** Sentinel for an invalid coordinate. */ static const int32_t INVALID_COORD = 0x7fffffff;