Skip to content

Commit

Permalink
Fixed #164: Cars on a direct route to target show "Thinking of a park…
Browse files Browse the repository at this point in the history
…ing spot" after path recalculation
  • Loading branch information
VictorPhilipp committed Jul 1, 2018
1 parent 08533b7 commit 4b0f124
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions TLM/TLM/Manager/Impl/AdvancedParkingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ public ExtPathState UpdateCarPathState(ushort vehicleId, ref Vehicle vehicleData
// no return path calculated: ignore
#if DEBUG
if (debug)
Log._Debug($"AdvancedParkingManager.UpdateCarPathState({vehicleId}, ..., {mainPathState}): return path state is None. Ignoring and returning main path state.");
Log._Debug($"AdvancedParkingManager.UpdateCarPathState({vehicleId}, ..., {mainPathState}): return path state is None. Setting pathMode=DrivingToTarget and returning main path state.");
#endif
driverExtInstance.pathMode = ExtPathMode.DrivingToTarget;
return mainPathState;
case ExtPathState.Calculating:
// return path not read yet: wait for it
Expand All @@ -237,7 +238,7 @@ public ExtPathState UpdateCarPathState(ushort vehicleId, ref Vehicle vehicleData
driverExtInstance.ReleaseReturnPath();
#if DEBUG
if (fineDebug)
Log._Debug($"CAdvancedParkingManager.UpdateCarPathState({vehicleId}, ..., {mainPathState}): Path is ready for vehicle {vehicleId}, citizen instance {driverExtInstance.instanceId}! CurrentPathMode={driverExtInstance.pathMode}");
Log._Debug($"AdvancedParkingManager.UpdateCarPathState({vehicleId}, ..., {mainPathState}): Path is ready for vehicle {vehicleId}, citizen instance {driverExtInstance.instanceId}! CurrentPathMode={driverExtInstance.pathMode}");
#endif
byte laneTypes = CustomPathManager._instance.m_pathUnits.m_buffer[vehicleData.m_path].m_laneTypes;
bool usesPublicTransport = (laneTypes & (byte)(NetInfo.LaneType.PublicTransport)) != 0;
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/UI/TrafficManagerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ private void _guiVehicles() {
ushort vehSpeed = SpeedLimitManager.Instance.VehicleToCustomSpeed(vehicle.GetLastFrameVelocity().magnitude);

String labelStr = "V #" + i + " is a " + (vState.recklessDriver ? "reckless " : "") + vState.flags + " " + vState.vehicleType + " @ ~" + vehSpeed + " km/h [^2=" + vState.SqrVelocity + "] (len: " + vState.totalLength + ", " + vState.JunctionTransitState + " @ " + vState.currentSegmentId + " (" + vState.currentStartNode + "), l. " + vState.currentLaneIndex + " -> " + vState.nextSegmentId + ", l. " + vState.nextLaneIndex + "), w: " + vState.waitTime + "\n" +
"d: " + driverInst.instanceId + " m: " + driverInst.pathMode.ToString() + " f: " + driverInst.failedParkingAttempts + " l: " + driverInst.parkingSpaceLocation + " lid: " + driverInst.parkingSpaceLocationId + " ltsu: " + vState.lastTransitStateUpdate + " lpu: " + vState.lastPositionUpdate + " als: " + vState.lastAltLaneSelSegmentId + " rnd: " + Constants.ManagerFactory.VehicleBehaviorManager.GetVehicleRand((ushort)i);
"di: " + driverInst.instanceId + " dc: " + driverInst.GetCitizenId() + " m: " + driverInst.pathMode.ToString() + " f: " + driverInst.failedParkingAttempts + " l: " + driverInst.parkingSpaceLocation + " lid: " + driverInst.parkingSpaceLocationId + " ltsu: " + vState.lastTransitStateUpdate + " lpu: " + vState.lastPositionUpdate + " als: " + vState.lastAltLaneSelSegmentId + " rnd: " + Constants.ManagerFactory.VehicleBehaviorManager.GetVehicleRand((ushort)i);

Vector2 dim = _counterStyle.CalcSize(new GUIContent(labelStr));
Rect labelRect = new Rect(screenPos.x - dim.x / 2f, screenPos.y - dim.y - 50f, dim.x, dim.y);
Expand Down

0 comments on commit 4b0f124

Please sign in to comment.