Skip to content

Commit

Permalink
added more debug options
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorPhilipp committed Jul 14, 2018
1 parent e8d4b0d commit 55b07e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TLM/TLM/State/ConfigData/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using TrafficManager.Traffic;
using static TrafficManager.Traffic.Data.ExtCitizenInstance;

namespace TrafficManager.State.ConfigData {
#if DEBUG
Expand Down Expand Up @@ -41,6 +42,7 @@ public class Debug {
public int CitizenInstanceId = 0;
public uint CitizenId = 0;
public ExtVehicleType ExtVehicleType = ExtVehicleType.None;
public ExtPathMode ExtPathMode = ExtPathMode.None;
}
#endif
}
13 changes: 13 additions & 0 deletions TLM/TLM/UI/TrafficManagerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using CSUtil.Commons;
using TrafficManager.Manager.Impl;
using TrafficManager.Traffic.Data;
using static TrafficManager.Traffic.Data.ExtCitizenInstance;

namespace TrafficManager.UI {
[UsedImplicitly]
Expand Down Expand Up @@ -948,6 +949,12 @@ private void _guiVehicles() {
ushort segmentId = vState.currentSegmentId;
ushort vehSpeed = SpeedLimitManager.Instance.VehicleToCustomSpeed(vehicle.GetLastFrameVelocity().magnitude);

#if DEBUG
if (GlobalConfig.Instance.Debug.ExtPathMode != ExtPathMode.None && driverInst.pathMode != GlobalConfig.Instance.Debug.ExtPathMode) {
continue;
}
#endif

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" +
"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);

Expand Down Expand Up @@ -997,6 +1004,12 @@ private void _guiCitizens() {
_counterStyle.normal.textColor = new Color(1f, 0f, 1f);
//_counterStyle.normal.background = MakeTex(1, 1, new Color(0f, 0f, 0f, 0.4f));

#if DEBUG
if (GlobalConfig.Instance.Debug.ExtPathMode != ExtPathMode.None && ExtCitizenInstanceManager.Instance.ExtInstances[i].pathMode != GlobalConfig.Instance.Debug.ExtPathMode) {
continue;
}
#endif

String labelStr = "Inst. " + i + ", Cit. " + citizenInstance.m_citizen + ",\nm: " + ExtCitizenInstanceManager.Instance.ExtInstances[i].pathMode.ToString() + ", tm: " + ExtCitizenManager.Instance.ExtCitizens[citizenInstance.m_citizen].transportMode + ", ltm: " + ExtCitizenManager.Instance.ExtCitizens[citizenInstance.m_citizen].lastTransportMode + ", ll: " + ExtCitizenManager.Instance.ExtCitizens[citizenInstance.m_citizen].lastLocation;
if (citizenInstance.m_citizen != 0) {
Citizen citizen = Singleton<CitizenManager>.instance.m_citizens.m_buffer[citizenInstance.m_citizen];
Expand Down

0 comments on commit 55b07e7

Please sign in to comment.