Skip to content

Commit

Permalink
Fix NRE. Improve support for evac buses
Browse files Browse the repository at this point in the history
  • Loading branch information
earalov committed May 23, 2017
1 parent 06c5247 commit 83250b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Detour/BusAIDetour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public override bool CanLeave(ushort vehicleID, ref Vehicle vehicleData)
{
//begin mod(+): Check if unbunching enabled for this line & stop. track if unbunching happens. Don't divide m_waitCounter by 2^4
ushort currentStop = VehicleManagerMod.m_cachedVehicleData[vehicleID].CurrentStop;
if (currentStop != 0 && NetManagerMod.m_cachedNodeData[currentStop].Unbunching &&
TransportLineMod.GetUnbunchingState(vehicleData.m_transportLine))
if (currentStop != 0 && (NetManagerMod.m_cachedNodeData[currentStop].Unbunching &&
TransportLineMod.GetUnbunchingState(vehicleData.m_transportLine) ||
vehicleData.Info?.m_class?.m_service == ItemClass.Service.Disaster))
{
var canLeaveStop = Singleton<TransportManager>.instance.m_lines
.m_buffer[(int)vehicleData.m_transportLine]
Expand Down
2 changes: 1 addition & 1 deletion Detour/TransportLineMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public static int CountLineActiveVehicles(ushort lineID, Action<Int32> callback
Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive))
{
//begin mod(+): callback
callback.Invoke(num3);
callback?.Invoke(num3);
//end mod
++num2;
}
Expand Down
2 changes: 1 addition & 1 deletion LineWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void Update()
ushort closestDepot = TransportLineMod.GetClosestDepot(lineID, position);
if ((int) closestDepot != 0)
TransportLineMod.SetDepot(lineID, closestDepot);
if (OptionsWrapper<Settings>.Options.ShowLineInfo)
if (OptionsWrapper<Settings>.Options.ShowLineInfo && lines.m_buffer[(int)lineID].Info?.m_class?.m_service != ItemClass.Service.Disaster)
WorldInfoPanel.Show<PublicTransportWorldInfoPanel>(position, new InstanceID()
{
TransportLine = lineID
Expand Down

0 comments on commit 83250b6

Please sign in to comment.