diff --git a/game/state/city/vehicle.cpp b/game/state/city/vehicle.cpp index 1f7231989..4c756b212 100644 --- a/game/state/city/vehicle.cpp +++ b/game/state/city/vehicle.cpp @@ -1,7 +1,8 @@ #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES +#include "game/state/gametime.h" +#include #endif -#include "game/state/city/vehicle.h" #include "framework/configfile.h" #include "framework/framework.h" #include "framework/logger.h" @@ -11,6 +12,7 @@ #include "game/state/city/building.h" #include "game/state/city/city.h" #include "game/state/city/scenery.h" +#include "game/state/city/vehicle.h" #include "game/state/city/vehiclemission.h" #include "game/state/city/vequipment.h" #include "game/state/gameevent.h" @@ -31,8 +33,10 @@ #include "game/state/tilemap/tileobject_vehicle.h" #include "game/ui/general/messagebox.h" #include "library/sp.h" +#include #include #include +#include #include #include #include @@ -558,7 +562,6 @@ class FlyingVehicleMover : public VehicleMover // d += 0.12f * (float)M_PI; vehicle.ticksToTurn = floorf(d / vehicle.angularVelocity); - // FIXME: Introduce proper turning speed // Here we just slow down velocity if we're moving too quickly if (vehicle.position != vehicle.goalPosition) { @@ -571,7 +574,8 @@ class FlyingVehicleMover : public VehicleMover 2.0f); if (ticksToMove < vehicle.ticksToTurn) { - vehicle.velocity *= (float)ticksToMove / (float)vehicle.ticksToTurn; + vehicle.velocity *= + std::abs(vehicle.angularVelocity) * TURNING_SLOW_DOWN_CORRECTION; } } } diff --git a/game/state/city/vehicle.h b/game/state/city/vehicle.h index e3ac97306..33dacfd3d 100644 --- a/game/state/city/vehicle.h +++ b/game/state/city/vehicle.h @@ -57,6 +57,9 @@ static const int FV_SCRAPPED_COST_PERCENT = 25; static const int FUEL_TICKS_PER_SECOND = 144; // How much ticks is required to spend one unit of fuel static const int FUEL_TICKS_PER_UNIT = 40000; +// Correction factor for turning slowdown mechanic, purely found by data analysis, could not +// establish any logical conclusion +static const float TURNING_SLOW_DOWN_CORRECTION = 38.893f; class Image; class TileObjectVehicle;