Merge branch 'master' into wait_in_depot

This commit is contained in:
Jonathan G Rennison
2015-08-03 01:06:55 +01:00
468 changed files with 25326 additions and 22041 deletions

View File

@@ -87,11 +87,22 @@ enum VisualEffect {
VE_TYPE_ELECTRIC = 3, ///< Electric sparks
VE_DISABLE_EFFECT = 6, ///< Flag to disable visual effect
VE_ADVANCED_EFFECT = VE_DISABLE_EFFECT, ///< Flag for advanced effects
VE_DISABLE_WAGON_POWER = 7, ///< Flag to disable wagon power
VE_DEFAULT = 0xFF, ///< Default value to indicate that visual effect should be based on engine class
};
/** Models for spawning visual effects. */
enum VisualEffectSpawnModel {
VESM_NONE = 0, ///< No visual effect
VESM_STEAM, ///< Steam model
VESM_DIESEL, ///< Diesel model
VESM_ELECTRIC, ///< Electric model
VESM_END
};
/**
* Enum to handle ground vehicle subtypes.
* This is defined here instead of at #GroundVehicle because some common function require access to these flags.
@@ -687,6 +698,11 @@ public:
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; }
@@ -1058,14 +1074,12 @@ struct SpecializedVehicle : public Vehicle {
*/
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);
}
};
@@ -1076,28 +1090,6 @@ struct SpecializedVehicle : public Vehicle {
*/
#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.
*/
struct DisasterVehicle FINAL : public SpecializedVehicle<DisasterVehicle, VEH_DISASTER> {
SpriteID image_override; ///< Override for the default disaster vehicle sprite.
VehicleID big_ufo_destroyer_target; ///< The big UFO that this destroyer is supposed to bomb.
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
DisasterVehicle() : SpecializedVehicleBase() {}
/** We want to 'destruct' the right class. */
virtual ~DisasterVehicle() {}
void UpdateDeltaXY(Direction direction);
bool Tick();
};
/**
* Iterate over disaster vehicles.
* @param var The variable used to iterate over.
*/
#define FOR_ALL_DISASTERVEHICLES(var) FOR_ALL_VEHICLES_OF_TYPE(DisasterVehicle, var)
/** Generates sequence of free UnitID numbers */
struct FreeUnitIDGenerator {
bool *cache; ///< array of occupied unit id numbers