v1.2.0 - Code refactoring
v1.2.0 - Refactoring: improved code structure and readability
No functional changes. This release improves maintainability and readability of the codebase.
Phase 1 — Constants & cleanup
- Extracted
ResetSessionState()to eliminate ~25 lines of duplicate reset logic shared betweenStartup()andStartSession() - Added named constants replacing bare magic numbers:
kNoLapTime(2147483640.0) — sentinel for no valid lap timekNoLapLimit(2147483640) — sentinel for time-based race (no lap limit)kCamTrackside(4) — trackside camera type index
- Moved
environmentAlreadySetfrompublictoprivate
Phase 2 — UpdateScoring() split
- Broke 390-line
UpdateScoring()into focused private methods:
| Method | Lines | Responsibility |
|---|---|---|
ScanVehicles() |
28 | Prelist pass: leader, best lap, allfinished |
SelectCameraQualifying() |
38 | Practice / qualifying camera logic |
SelectCameraRace() |
124 | Race camera logic (SBS, pit, last lap) |
DetectIncidents() |
60 | mResultsStream incident detection |
ResolveTargetVehicle() |
38 | needpos → needveh + camera type |
WriteSessionOutputs() |
69 | Time string, file writes, debug log |
UpdateScoring()reduced from ~390 to 73 lines (orchestration only)
Verified on
- rF2 (via
WantsToViewVehicle) - LMU (via REST API)