|
@@ -687,24 +687,29 @@ public:
|
|
|
* @param location where do we go to?
|
|
|
* @param destination what hangar do we go to?
|
|
|
* @param reverse should the vehicle be reversed?
|
|
|
* @return true if a depot could be found.
|
|
|
*/
|
|
|
virtual bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse) { return false; }
|
|
|
|
|
|
CommandCost SendToDepot(DoCommandFlag flags, DepotCommand command);
|
|
|
|
|
|
void UpdateVisualEffect(bool allow_power_change = true);
|
|
|
void ShowVisualEffect() const;
|
|
|
|
|
|
void UpdatePosition();
|
|
|
void UpdateViewport(bool dirty);
|
|
|
void UpdatePositionAndViewport();
|
|
|
void MarkAllViewportsDirty() const;
|
|
|
|
|
|
inline uint16 GetServiceInterval() const { return this->service_interval; }
|
|
|
|
|
|
inline void SetServiceInterval(uint16 interval) { this->service_interval = interval; }
|
|
|
|
|
|
inline bool ServiceIntervalIsCustom() const { return HasBit(this->vehicle_flags, VF_SERVINT_IS_CUSTOM); }
|
|
|
|
|
|
inline bool ServiceIntervalIsPercent() const { return HasBit(this->vehicle_flags, VF_SERVINT_IS_PERCENT); }
|
|
|
|
|
|
inline void SetServiceIntervalIsCustom(bool on) { SB(this->vehicle_flags, VF_SERVINT_IS_CUSTOM, 1, on); }
|
|
|
|
|
|
inline void SetServiceIntervalIsPercent(bool on) { SB(this->vehicle_flags, VF_SERVINT_IS_PERCENT, 1, on); }
|
|
|
|
|
@@ -1058,32 +1063,30 @@ struct SpecializedVehicle : public Vehic
|
|
|
{
|
|
|
assert(v->type == Type);
|
|
|
return (const T *)v;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Update vehicle sprite- and position caches
|
|
|
* @param force_update Force updating the vehicle on the viewport.
|
|
|
* @param update_delta Also update the delta?
|
|
|
*/
|
|
|
inline void UpdateViewport(bool force_update, bool update_delta)
|
|
|
{
|
|
|
extern void VehicleUpdateViewport(Vehicle *v, bool dirty);
|
|
|
|
|
|
/* Explicitly choose method to call to prevent vtable dereference -
|
|
|
* it gives ~3% runtime improvements in games with many vehicles */
|
|
|
if (update_delta) ((T *)this)->T::UpdateDeltaXY(this->direction);
|
|
|
SpriteID old_image = this->cur_image;
|
|
|
this->cur_image = ((T *)this)->T::GetImage(this->direction, EIT_ON_MAP);
|
|
|
if (force_update || this->cur_image != old_image) VehicleUpdateViewport(this, true);
|
|
|
if (force_update || this->cur_image != old_image) this->Vehicle::UpdateViewport(true);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Iterate over all vehicles of a particular type.
|
|
|
* @param name The type of vehicle to iterate over.
|
|
|
* @param var The variable used to iterate over.
|
|
|
*/
|
|
|
#define FOR_ALL_VEHICLES_OF_TYPE(name, var) FOR_ALL_ITEMS_FROM(name, vehicle_index, var, 0) if (var->type == name::EXPECTED_TYPE)
|
|
|
|
|
|
/**
|
|
|
* Disasters, like submarines, skyrangers and their shadows, belong to this class.
|