Refactor SpeedLimit
struct
#438
Labels
code cleanup
Refactor code, remove old code, improve maintainability
Milestone
SpeedLimit
struct
#438
The struct is currently located in the
TrafficManager.Traffic.Data
namespace. This namespace been moved to the TMPE.API project to allow for reuse in other mods.However, the
SpeedLimit
struct does not hold any information - it is merely used as a utility class and only consists of static methods which should be avoided (see #211). It also mixes UI and game logic.Tasks:
SpeedLimitManager
SpeedLimitsTool
?)EnumerateSpeedLimits
,ToMphPreciseString
,ToKmphPreciseString
,ToMphRounded
,ToMphPrecise
,ToKmphPrecise
,ToKmphRounded
,GetPrevious
,GetNext
,GetVerticalTextureScale
to a UI related class (SpeedLimitsTool
?)NearlyEqual
andIsZero
to a (new?) utility class, e.g.FloatUtils
IsValidRange
toSpeedLimitManager
VehicleBehaviorManager.FindBestLane()
such that the variableoptImprovementSpeed
stores velocitiy in game units (and not in km/h).MinMinSafeSpeedImprovement
andMaxMinSafeSpeedImprovement
inDynamicLaneSelection
such that they hold velocities in game units (and not in km/h).velocity
(float) andunit
(SpeedUnit
) to theSpeedLimit
struct and update UI code to use it properly (as a composite value). If not required, remove the struct entirely.The text was updated successfully, but these errors were encountered: