Skip to content

Commit f92b040

Browse files
committed
Merge branch '1.10.0'
2 parents 8df4524 + d21272a commit f92b040

File tree

206 files changed

+15815
-9214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+15815
-9214
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "TLM/OptionsFramework"]
2+
path = TLM/OptionsFramework
3+
url = ../OptionsFramework.git

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,44 @@ A work-in-progress modification for **Cities: Skylines** to add additional traff
44
User manual: http://www.viathinksoft.de/tmpe
55

66
# Changelog
7+
1.10.0, 07/30/2017
8+
- New feature: Dynamic Lane Selection
9+
- New feature: Adaptive step switching
10+
- New feature: Individual vehicles may be removed from the game
11+
- New option: Vehicle restrictions aggression
12+
- New option: Vehicles follow priority rules at junctions with timed traffic lights
13+
- Improved path-finding performance
14+
- Improved performance traffic measurement engine performance
15+
- Improved vehicle state tracking
16+
- Reorganized global configuration file (sorry, your main menu and main button positions are reset)
17+
- The option "Road condition has a bigger impact on vehicle speed" is only shown if the Snowfall DLC is owned
18+
- The flow/wait calculation mode to be used is now configurable via the global configuration file
19+
- Added path-find statistics label
20+
- Added confirmation dialog for "Clear Traffic" button
21+
- Currently active timed traffic light step is remembered
22+
- Trains do not wait for each other anymore near timed traffic lights
23+
- It is now possible to connect train station tracks and outside connections with the lane connector
24+
- Disabling the Parking AI triggers graceful clean up procedure
25+
- Relocated some options
26+
- Workaround for a base game issue that causes trams to get stuck
27+
- Trains do not longer stop in front of green timed traffic lights
28+
- Vehicles use queue skipping to prioritize path-finding runs that are caused by road modifications
29+
- Adding a vehicle separate light to a timed traffic lights applies the main light configuration
30+
- Parking AI: Vehicles can now find parking spaces at the opposite road side
31+
- Parking AI: Included an improved fallback logic for some edge cases
32+
- Parking AI: Citizens should now be more successful in returning their cars back home
33+
- Parking AI: Tuned parking radius parameters
34+
- Parking AI: If the limit for parked vehicles is reached and parking fails due to it, no alternative parking space is queried
35+
- Vehicle AI: Busses prefer lanes with correct lane arrow over incorrect ones
36+
- Bugfix: Using the bulldozer tool might lead to inconsistent road geometry information
37+
- Bugfix: Citizens that fail to approach their parked car fly towards their target building
38+
- Bugfix: Parking AI: Path-finding fails if cars are parked too far away from a road
39+
- Bugfix: Parking AI: Citizens approaching a car start to float away
40+
- Bugfix: "Heavy vehicles prefer outer lanes on highways" does not work
41+
- Bugfix: The lane connector does not allow connecting all available lane end points at train stations and on bidirectional one-lane train tracks
42+
- Bugfix: Vehicles may get stuck in several situations
43+
- Upgrading to a road with bus lanes now copies an already existing traffic light state to the new traffic light
44+
745
1.9.6, 05/28/2017
846
- Updated Simplified Chinese translation
947
- Bugfix: Vehicles cannot perform u-turns at junctions with only one outgoing segment (thanks to @Sunbird for reporting this issue)

TLM/TLM/Traffic/ArrowDirection.cs renamed to TLM/CSUtil.Commons/ArrowDirection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
using System.Collections.Generic;
33
using System.Text;
44

5-
namespace TrafficManager.Traffic {
5+
namespace CSUtil.Commons {
66
public enum ArrowDirection {
7-
None,
8-
Left,
9-
Forward,
10-
Right,
11-
Turn
7+
None = 0,
8+
Left = 1,
9+
Forward = 2,
10+
Right = 3,
11+
Turn = 4
1212
}
1313
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace CSUtil.Commons {
7+
public class ArrowDirectionUtil {
8+
public static ArrowDirection InvertLeftRight(ArrowDirection dir) {
9+
if (dir == ArrowDirection.Left)
10+
dir = ArrowDirection.Right;
11+
else if (dir == ArrowDirection.Right)
12+
dir = ArrowDirection.Left;
13+
return dir;
14+
}
15+
16+
/// <summary>
17+
/// Calculates the direction of <paramref name="toRelDir"/> in relation to ArrowDirection.TURN.
18+
/// </summary>
19+
/// <param name="fromDir">source direction</param>
20+
/// <param name="toRelDir">target direction, relative to <paramref name="fromDir"/></param>
21+
/// <returns></returns>
22+
public static ArrowDirection MakeAbsolute(ArrowDirection fromDir, ArrowDirection toRelDir) {
23+
if (fromDir == ArrowDirection.None) {
24+
// invalid direction
25+
return ArrowDirection.None;
26+
}
27+
28+
if (toRelDir == ArrowDirection.None) {
29+
// invalid direction
30+
return ArrowDirection.None;
31+
}
32+
33+
if (fromDir == ArrowDirection.Turn) {
34+
// toRelDir is already relative to TURN
35+
return toRelDir;
36+
}
37+
38+
if (toRelDir == ArrowDirection.Turn) {
39+
// toRelDir is fromDir
40+
return fromDir;
41+
}
42+
43+
int fromDirBase0 = (int)fromDir - 1;
44+
int toRelDirBase1 = (int)toRelDir;
45+
/*
46+
* Direction | Base 0 | Base 1
47+
* ==========+========+=======
48+
* Left | 0 | 1
49+
* Forward | 1 | 2
50+
* Right | 2 | 3
51+
*
52+
*
53+
* Direction 1 | Direction 2 | Dir. 1 B0 | Dir. 2 B1 | Sum | (Sum + 1) % 4 | Desired dir.
54+
* ============+=============+===========+===========+=====|===============+=============
55+
* Left | Left | 0 | 1 | 1 | 2 | (Forward, 2)
56+
* Left | Forward | 0 | 2 | 2 | 3 | (Right, 3)
57+
* Left | Right | 0 | 3 | 3 | 0 | (Turn, 4)
58+
* Forward | Left | 1 | 1 | 2 | 3 | (Right, 3)
59+
* Forward | Forward | 1 | 2 | 3 | 0 | (Turn, 4)
60+
* Forward | Right | 1 | 3 | 4 | 1 | (Left, 1)
61+
* Right | Left | 2 | 1 | 3 | 0 | (Turn, 4)
62+
* Right | Forward | 2 | 2 | 4 | 1 | (Left, 1)
63+
* Right | Right | 2 | 3 | 5 | 2 | (Forward, 2)
64+
*/
65+
66+
int ret = (fromDirBase0 + toRelDirBase1 + 1) % 4;
67+
if (ret == 0) {
68+
ret = 4;
69+
}
70+
return (ArrowDirection)ret;
71+
}
72+
}
73+
}

TLM/CSUtil.Commons/CSUtil.Commons.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
</Reference>
4343
</ItemGroup>
4444
<ItemGroup>
45+
<Compile Include="ArrowDirection.cs" />
46+
<Compile Include="ArrowDirectionUtil.cs" />
4547
<Compile Include="EnumUtil.cs" />
4648
<Compile Include="Log.cs" />
4749
<Compile Include="LogicUtil.cs" />

TLM/OptionsFramework

Submodule OptionsFramework added at fd20287

TLM/TLM/Constants.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Linq;
55
using System.Text;
6+
using TrafficManager.Manager;
67

78
namespace TrafficManager {
89
public static class Constants {
@@ -15,5 +16,11 @@ public static IServiceFactory ServiceFactory {
1516
#endif
1617
}
1718
}
19+
20+
public static IManagerFactory ManagerFactory {
21+
get {
22+
return Manager.Impl.ManagerFactory.Instance;
23+
}
24+
}
1825
}
1926
}

TLM/TLM/Custom/AI/CustomAmbulanceAI.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
using TrafficManager.Custom.PathFinding;
66
using TrafficManager.Geometry;
77
using TrafficManager.Manager;
8+
using TrafficManager.Manager.Impl;
89
using TrafficManager.Traffic;
10+
using TrafficManager.Traffic.Data;
911
using UnityEngine;
1012

1113
namespace TrafficManager.Custom.AI {
@@ -15,8 +17,7 @@ public bool CustomStartPathFind(ushort vehicleID, ref Vehicle vehicleData, Vecto
1517
//Log._Debug($"CustomAmbulanceAI.CustomStartPathFind called for vehicle {vehicleID}");
1618
#endif
1719

18-
ExtVehicleType vehicleType = (vehicleData.m_flags & Vehicle.Flags.Emergency2) != 0 ? ExtVehicleType.Emergency : ExtVehicleType.Service;
19-
VehicleStateManager.Instance._GetVehicleState(vehicleID).VehicleType = vehicleType;
20+
ExtVehicleType vehicleType = VehicleStateManager.Instance.OnStartPathFind(vehicleID, ref vehicleData, (vehicleData.m_flags & Vehicle.Flags.Emergency2) != 0 ? ExtVehicleType.Emergency : ExtVehicleType.Service);
2021

2122
VehicleInfo info = this.m_info;
2223
bool allowUnderground = (vehicleData.m_flags & (Vehicle.Flags.Underground | Vehicle.Flags.Transition)) != 0;
@@ -38,13 +39,8 @@ public bool CustomStartPathFind(ushort vehicleID, ref Vehicle vehicleData, Vecto
3839
}
3940
uint path;
4041
// NON-STOCK CODE START
41-
if (CustomPathManager._instance.CreatePath(vehicleType, vehicleID, ExtCitizenInstance.ExtPathType.None, out path, ref Singleton<SimulationManager>.instance.m_randomizer, Singleton<SimulationManager>.instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, 20000f, this.IsHeavyVehicle(), this.IgnoreBlocked(vehicleID, ref vehicleData), false, false)) {
42+
if (CustomPathManager._instance.CreatePath(vehicleType, vehicleID, ExtCitizenInstance.ExtPathType.None, out path, ref Singleton<SimulationManager>.instance.m_randomizer, Singleton<SimulationManager>.instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, 20000f, this.IsHeavyVehicle(), this.IgnoreBlocked(vehicleID, ref vehicleData), false, (vehicleData.m_flags & Vehicle.Flags.Spawned) != 0)) {
4243
// NON-STOCK CODE END
43-
#if USEPATHWAITCOUNTER
44-
VehicleState state = VehicleStateManager.Instance._GetVehicleState(vehicleID);
45-
state.PathWaitCounter = 0;
46-
#endif
47-
4844
if (vehicleData.m_path != 0u) {
4945
Singleton<PathManager>.instance.ReleasePath(vehicleData.m_path);
5046
}

TLM/TLM/Custom/AI/CustomBuildingAI.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using System.Text;
77
using TrafficManager.Manager;
8+
using TrafficManager.Manager.Impl;
89
using TrafficManager.State;
910
using TrafficManager.Traffic;
1011
using TrafficManager.UI;
@@ -16,7 +17,7 @@ public Color CustomGetColor(ushort buildingID, ref Building data, InfoManager.In
1617
// NON-STOCK CODE START
1718
if (Options.prohibitPocketCars) {
1819
Color? color;
19-
if (AdvancedParkingManager.Instance.GetBuildingInfoViewColor(buildingID, ref data, infoMode, out color)) {
20+
if (AdvancedParkingManager.Instance.GetBuildingInfoViewColor(buildingID, ref data, ref ExtBuildingManager.Instance.ExtBuildings[buildingID], infoMode, out color)) {
2021
return (Color)color;
2122
}
2223
}

TLM/TLM/Custom/AI/CustomBusAI.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using TrafficManager.Geometry;
77
using TrafficManager.Manager;
88
using TrafficManager.Traffic;
9+
using TrafficManager.Traffic.Data;
910
using UnityEngine;
1011

1112
namespace TrafficManager.Custom.AI {
@@ -36,11 +37,7 @@ public bool CustomStartPathFind(ushort vehicleID, ref Vehicle vehicleData, Vecto
3637
uint path;
3738
// NON-STOCK CODE START
3839
if (CustomPathManager._instance.CreatePath(
39-
ExtVehicleType.Bus, vehicleID, ExtCitizenInstance.ExtPathType.None, out path, ref Singleton<SimulationManager>.instance.m_randomizer, Singleton<SimulationManager>.instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, 20000f, this.IsHeavyVehicle(), this.IgnoreBlocked(vehicleID, ref vehicleData), true, false)) {
40-
#if USEPATHWAITCOUNTER
41-
VehicleState state = VehicleStateManager.Instance._GetVehicleState(vehicleID);
42-
state.PathWaitCounter = 0;
43-
#endif
40+
ExtVehicleType.Bus, vehicleID, ExtCitizenInstance.ExtPathType.None, out path, ref Singleton<SimulationManager>.instance.m_randomizer, Singleton<SimulationManager>.instance.m_currentBuildIndex, startPosA, startPosB, endPosA, endPosB, NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle, info.m_vehicleType, 20000f, this.IsHeavyVehicle(), this.IgnoreBlocked(vehicleID, ref vehicleData), true, true)) {
4441
// NON-STOCK CODE END
4542

4643
if (vehicleData.m_path != 0u) {

0 commit comments

Comments
 (0)