(svn r16441) -Codechange: new class SpecializedVehicle used as superclass for all vehicle types

This commit is contained in:
smatz
2009-05-26 22:10:13 +00:00
parent aa546e513f
commit 7ee882d03f
15 changed files with 150 additions and 135 deletions

View File

@@ -96,7 +96,7 @@ struct AircraftCache {
*
* As side-effect the vehicle type is set correctly.
*/
struct Aircraft : public Vehicle {
struct Aircraft : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
AircraftCache acache; ///< Cache of often used calculated values
uint16 crashed_counter;
@@ -125,10 +125,10 @@ struct Aircraft : public Vehicle {
void OnNewDay();
TileIndex GetOrderStationLocation(StationID station);
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
Aircraft *Next() { return (Aircraft *)this->Vehicle::Next(); }
const Aircraft *Next() const { return (const Aircraft *)this->Vehicle::Next(); }
};
#define FOR_ALL_AIRCRAFT(var) FOR_ALL_VEHICLES_OF_TYPE(Aircraft, var)
SpriteID GetRotorImage(const Aircraft *v);
Station *GetTargetAirportIfValid(const Aircraft *v);