File diff r21719:0f172a6b8939 → r21720:231348c28655
src/vehicle_base.h
Show inline comments
 
@@ -693,12 +693,17 @@ public:
 

	
 
	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); }
 

	
 
@@ -1064,20 +1069,18 @@ struct SpecializedVehicle : public Vehic
 
	 * 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.