Skip to content

Commit 30ed1e8

Browse files
authored
Merge pull request #1641 from CitiesSkylinesMods/game-update/compatiblity_fix_1_15_x
TM:PE 11.7.0.0 - compatibility patch 1.15.x
2 parents 24651dd + 2c08b08 commit 30ed1e8

File tree

69 files changed

+1132
-381
lines changed

Some content is hidden

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

69 files changed

+1132
-381
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ This changelog includes all versions and major variants of the mod going all the
2929

3030
> Date format: dd/mm/yyyy
3131
32+
#### TM:PE V[11.7.0.0](https://github.com/CitiesSkylinesMods/TMPE/compare/11.6.6.3...11.7.0.0) STABLE, 14/09/2022
33+
34+
- [New] Compatibility patch for game update 1.15.0-f5
35+
- [Fixed] Message about the reason of disabled options not showing correctly, updated translation
36+
- [Updated] Lane connection code cleanup #1615 (kianzarrin)
37+
- [Updated] Translations
38+
- [Steam] [TM:PE v11 STABLE](https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252)
39+
40+
#### TM:PE V11.7.0.0 TEST, 14/09/2022
41+
42+
- [New] Compatibility patch for game update 1.15.0-f5
43+
- [Fixed] Message about the reason of disabled options not showing correctly, updated translation
44+
- [Updated] Lane connection code cleanup #1615 (kianzarrin)
45+
- [Updated] Translations
46+
- [Steam] [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785)
47+
3248
#### TM:PE V[11.6.6.3](https://github.com/CitiesSkylinesMods/TMPE/compare/11.6.5.3...11.6.6.3) STABLE, 11/08/2022
3349

3450
- [Meta] TM:PE 11.6.6.3 branch released as STABLE - huge thanks to our beta testers!

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<a href="https://github.com/CitiesSkylinesMods/TMPE/wiki/Report-a-Bug">Report a Bug</a><br />
1010
</p>
1111
<p align="center">
12-
<a href="https://store.steampowered.com/app/255710/Cities_Skylines/"><img src="https://img.shields.io/static/v1?label=cities:%20skylines&message=v1.14.1-f2&color=01ABF8&logo=unity" /></a>
12+
<a href="https://store.steampowered.com/app/255710/Cities_Skylines/"><img src="https://img.shields.io/static/v1?label=cities:%20skylines&message=v1.15.0-f5&color=01ABF8&logo=unity" /></a>
1313
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252"><img src="https://img.shields.io/github/v/release/CitiesSkylinesMods/TMPE?label=stable&color=7cc17b&logo=steam&logoColor=F5F5F5" /></a>
1414
<a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785"><img src="https://img.shields.io/github/v/release/CitiesSkylinesMods/TMPE?include_prereleases&label=test&color=f7b73c&logo=steam&logoColor=F5F5F5" /></a>
1515
<a href="https://github.com/CitiesSkylinesMods/TMPE/releases/latest"><img src="https://img.shields.io/github/v/release/CitiesSkylinesMods/TMPE?label=origin&color=F56C2D&logo=origin&logoColor=F56C2D" /></a>

TLM/CSUtil.CameraControl

TLM/OptionsFramework

TLM/SharedAssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
// Minor Version
2121
// Build Number
2222
// Revision
23-
[assembly: AssemblyVersion("11.6.6.*")]
23+
[assembly: AssemblyVersion("11.7.0.*")]

TLM/TLM/Custom/PathFinding/CustomPathFind.cs

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public class CustomPathFind : PathFind {
6060
private readonly TrafficMeasurementManager trafficMeasurementManager =
6161
TrafficMeasurementManager.Instance;
6262
#endif
63+
//Cached value (vanilla uses property to access it)
64+
private VehicleInfo.VehicleCategory vehicleCategory_;
6365

6466
private GlobalConfig globalConf_;
6567

@@ -256,6 +258,7 @@ private void PathFindImplementation(uint unit, ref PathUnit data) {
256258

257259
laneTypes_ = (NetInfo.LaneType)pathUnits_.m_buffer[unit].m_laneTypes;
258260
vehicleTypes_ = (VehicleInfo.VehicleType)pathUnits_.m_buffer[unit].m_vehicleTypes;
261+
vehicleCategory_ = (VehicleInfo.VehicleCategory)pathUnits_.m_buffer[unit].m_vehicleCategories;
259262
maxLength_ = pathUnits_.m_buffer[unit].m_length;
260263
pathFindIndex_ = pathFindIndex_ + 1 & 0x7FFF;
261264
pathRandomizer_ = new Randomizer(unit);
@@ -1031,6 +1034,7 @@ ref nextSegmentId.ToSegment(),
10311034
} else if (prevIsPedestrianLane) {
10321035
// we are going to a pedestrian lane
10331036
if (!prevIsElevated) {
1037+
bool isPedZoneRoad = prevSegmentInfo.IsPedestrianZoneOrPublicTransportRoad();
10341038
if (nextNode.Info.m_class.m_service != ItemClass.Service.Beautification) {
10351039
bool canCrossStreet =
10361040
(nextNode.m_flags &
@@ -1047,6 +1051,7 @@ ref nextSegmentId.ToSegment(),
10471051
nextNodeId,
10481052
NetInfo.LaneType.Pedestrian,
10491053
VehicleInfo.VehicleType.None,
1054+
VehicleInfo.VehicleCategory.None,
10501055
prevLaneIndex,
10511056
isOnCenterPlatform,
10521057
out int leftLaneIndex,
@@ -1068,6 +1073,7 @@ ref nextSegmentId.ToSegment(),
10681073
nextNodeId,
10691074
NetInfo.LaneType.Pedestrian,
10701075
VehicleInfo.VehicleType.None,
1076+
VehicleInfo.VehicleCategory.None,
10711077
-1,
10721078
isOnCenterPlatform,
10731079
out _,
@@ -1106,6 +1112,7 @@ ref nextSegmentId.ToSegment(),
11061112
nextNodeId,
11071113
NetInfo.LaneType.Pedestrian,
11081114
VehicleInfo.VehicleType.None,
1115+
VehicleInfo.VehicleCategory.None,
11091116
-1,
11101117
isOnCenterPlatform,
11111118
out int someLeftLaneIndex,
@@ -1138,8 +1145,8 @@ ref nextSegmentId.ToSegment(),
11381145
}
11391146

11401147
if (leftLaneId != 0 &&
1141-
(nextLeftSegmentId != prevSegmentId || canCrossStreet ||
1142-
isOnCenterPlatform)) {
1148+
(nextLeftSegmentId != prevSegmentId || canCrossStreet || isOnCenterPlatform) &&
1149+
(!isPedZoneRoad || !netManager.m_segments.m_buffer[nextLeftSegmentId].Info.IsPedestrianZoneOrPublicTransportRoad())) {
11431150
if (isLogEnabled) {
11441151
DebugLog(
11451152
unitId,
@@ -1174,8 +1181,8 @@ ref leftLaneId.ToLane(),
11741181
}
11751182

11761183
if (rightLaneId != 0 && rightLaneId != leftLaneId &&
1177-
(nextRightSegmentId != prevSegmentId || canCrossStreet ||
1178-
isOnCenterPlatform)) {
1184+
(nextRightSegmentId != prevSegmentId || canCrossStreet || isOnCenterPlatform) &&
1185+
(!isPedZoneRoad || !netManager.m_segments.m_buffer[nextRightSegmentId].Info.IsPedestrianZoneOrPublicTransportRoad())) {
11791186
if (isLogEnabled) {
11801187
DebugLog(
11811188
unitId,
@@ -1217,6 +1224,7 @@ ref rightLaneId.ToLane(),
12171224
item.Position.m_lane,
12181225
NetInfo.LaneType.Vehicle,
12191226
VehicleInfo.VehicleType.Bicycle,
1227+
VehicleInfo.VehicleCategory.All,
12201228
out int nextLaneIndex,
12211229
out uint nextLaneId)) {
12221230
if (isLogEnabled) {
@@ -1251,6 +1259,35 @@ ref nextLaneId.ToLane(),
12511259
connectOffset,
12521260
connectOffset);
12531261
}
1262+
1263+
if (isPedZoneRoad) {
1264+
bool isPrevSegmentPedZoneRoad = prevSegmentInfo.IsPedestrianZoneOrPublicTransportRoad();
1265+
for (int i = 0; i < 8; i++)
1266+
{
1267+
ushort nextPedZoneSegmentId = nextNode.GetSegment(i);
1268+
if (nextPedZoneSegmentId != 0 && nextPedZoneSegmentId != prevSegmentId && isPrevSegmentPedZoneRoad) {
1269+
ProcessItemCosts(
1270+
#if DEBUG
1271+
isLogEnabled,
1272+
unitId,
1273+
#endif
1274+
item,
1275+
ref prevSegment,
1276+
ref prevLane,
1277+
prevMaxSpeed,
1278+
prevLaneSpeed,
1279+
nextNodeId,
1280+
ref nextNode,
1281+
false,
1282+
nextPedZoneSegmentId,
1283+
ref nextPedZoneSegmentId.ToSegment(),
1284+
ref prevRelSimilarLaneIndex,
1285+
connectOffset,
1286+
false,
1287+
true);
1288+
}
1289+
}
1290+
}
12541291
} else {
12551292
if (isLogEnabled) {
12561293
DebugLog(
@@ -1374,6 +1411,7 @@ ref nextSegmentId.ToSegment(),
13741411
prevLaneIndex,
13751412
nextLaneType,
13761413
nextVehicleType,
1414+
vehicleCategory_,
13771415
out int sameSegLaneIndex,
13781416
out uint sameSegLaneId))
13791417
{
@@ -1660,6 +1698,8 @@ ref nextSegmentId.ToSegment(),
16601698
}
16611699
}
16621700

1701+
VehicleInfo.VehicleCategory currentVehicleCategories = VehicleInfo.VehicleCategory.None;
1702+
16631703
if (allowBicycle || !prevIsRouted) {
16641704
// pedestrian to bicycle lane switch or no routing information available:
16651705
// if pedestrian lanes should be explored (allowBicycle == true): do this here
@@ -1733,6 +1773,7 @@ ref nextSegmentId.ToSegment(),
17331773
#endif
17341774
}
17351775

1776+
currentVehicleCategories |= (netManager.m_segments.m_buffer[nextSegmentId].Info.m_vehicleCategories & VehicleInfo.VehicleCategory.RoadTransport);
17361777
nextSegmentId = nextSegmentId.ToSegment().GetRightSegment(nextNodeId);
17371778
}
17381779
#if ROUTING
@@ -1874,6 +1915,14 @@ ref nextSegmentId.ToSegment(),
18741915
}
18751916
}
18761917
#endif
1918+
VehicleInfo.VehicleCategory segmentVehicleCategories = netManager.m_segments.m_buffer[item.Position.m_segment].Info.m_vehicleCategories & VehicleInfo.VehicleCategory.RoadTransport;
1919+
if (!prevIsRouted && (currentVehicleCategories & segmentVehicleCategories) != segmentVehicleCategories) {
1920+
DebugLog(
1921+
unitId,
1922+
item,
1923+
$"ProcessItemMain: Different segment vehicle categories. Force explore U-turn. Previous value: {exploreUturn}");
1924+
exploreUturn = true;
1925+
}
18771926

18781927
if (exploreUturn
18791928
&& (vehicleTypes_ & (VehicleInfo.VehicleType.Tram | VehicleInfo.VehicleType.Trolleybus)) == VehicleInfo.VehicleType.None)
@@ -1922,6 +1971,7 @@ ref nextSegmentId.ToSegment(),
19221971
item.Position.m_lane,
19231972
NetInfo.LaneType.Pedestrian,
19241973
vehicleTypes_,
1974+
vehicleCategory_,
19251975
out int nextLaneIndex,
19261976
out uint nextLaneId)) {
19271977
if (isLogEnabled) {
@@ -2141,7 +2191,7 @@ private void ProcessItemPublicTransport(
21412191
}
21422192

21432193
NetInfo.Lane nextLaneInfo = nextSegmentInfo.m_lanes[nextLaneIndex];
2144-
if (!nextLaneInfo.CheckType(laneTypes_, vehicleTypes_)) {
2194+
if (!nextLaneInfo.CheckType(laneTypes_, vehicleTypes_, vehicleCategory_)) {
21452195
return;
21462196
}
21472197

@@ -2460,11 +2510,13 @@ private bool ProcessItemCosts(
24602510
// float prevLaneSpeed = 1f; // stock code commented
24612511
NetInfo.LaneType prevLaneType = NetInfo.LaneType.None;
24622512
VehicleInfo.VehicleType prevVehicleType = VehicleInfo.VehicleType.None;
2513+
VehicleInfo.VehicleCategory prevVehicleCategory = VehicleInfo.VehicleCategory.None;
24632514

24642515
if (item.Position.m_lane < prevSegmentInfo.m_lanes.Length) {
24652516
NetInfo.Lane prevLaneInfo = prevSegmentInfo.m_lanes[item.Position.m_lane];
24662517
prevLaneType = prevLaneInfo.m_laneType;
24672518
prevVehicleType = prevLaneInfo.m_vehicleType;
2519+
prevVehicleCategory = prevLaneInfo.vehicleCategory;
24682520
// prevMaxSpeed = prevLaneInfo.m_speedLimit; // stock code commented
24692521
// prevLaneSpeed = CalculateLaneSpeed(prevMaxSpeed, connectOffset,
24702522
// item.Position.m_offset, ref prevSegment, prevLaneInfo); // stock code commented
@@ -2697,11 +2749,12 @@ private bool ProcessItemCosts(
26972749
}
26982750
#endif
26992751

2752+
var currentVehicleCategory = vehicleCategory_;
27002753
// NON-STOCK CODE END
27012754
for (; nextLaneIndex <= maxNextLaneIndex && nextLaneId != 0; nextLaneIndex++) {
27022755
NetInfo.Lane nextLaneInfo = nextSegmentInfo.m_lanes[nextLaneIndex];
27032756
if ((nextLaneInfo.m_finalDirection & nextFinalDir) != NetInfo.Direction.None) {
2704-
if (nextLaneInfo.CheckType(allowedLaneTypes, allowedVehicleTypes) &&
2757+
if (nextLaneInfo.CheckType(allowedLaneTypes, allowedVehicleTypes, currentVehicleCategory) &&
27052758
(nextSegmentId != item.Position.m_segment ||
27062759
nextLaneIndex != item.Position.m_lane)) {
27072760
if (acuteTurningAngle &&
@@ -3015,8 +3068,9 @@ private bool ProcessItemCosts(
30153068
#endif
30163069

30173070
if ((nextLaneInfo.m_laneType & prevLaneType) != NetInfo.LaneType.None &&
3018-
(nextLaneInfo.m_vehicleType & vehicleTypes_) !=
3019-
VehicleInfo.VehicleType.None) {
3071+
(nextLaneInfo.m_vehicleType & vehicleTypes_) != VehicleInfo.VehicleType.None &&
3072+
(nextLaneInfo.vehicleCategory & vehicleCategory_) != VehicleInfo.VehicleCategory.None) {
3073+
30203074
#if ADVANCEDAI && ROUTING
30213075
if (!enableAdvancedAI) {
30223076
#endif
@@ -3052,6 +3106,12 @@ private bool ProcessItemCosts(
30523106
}
30533107
}
30543108

3109+
if ((nextLaneInfo.vehicleCategory & VehicleInfo.VehicleCategory.PublicTransportRoad) != 0 &&
3110+
(nextLaneInfo.vehicleCategory & ~(VehicleInfo.VehicleCategory.Bus | VehicleInfo.VehicleCategory.Trolleybus | VehicleInfo.VehicleCategory.Taxi)) == 0)
3111+
{
3112+
nextItem.ComparisonValue /= 100f;
3113+
}
3114+
30553115
if (isLogEnabled) {
30563116
DebugLog(
30573117
unitId,
@@ -3096,8 +3156,8 @@ private bool ProcessItemCosts(
30963156
}
30973157

30983158
if ((nextLaneInfo.m_laneType & prevLaneType) != NetInfo.LaneType.None &&
3099-
(nextLaneInfo.m_vehicleType & prevVehicleType) !=
3100-
VehicleInfo.VehicleType.None) {
3159+
(nextLaneInfo.m_vehicleType & prevVehicleType) != VehicleInfo.VehicleType.None &&
3160+
(nextLaneInfo.vehicleCategory & prevVehicleCategory) != VehicleInfo.VehicleCategory.None) {
31013161
newLaneIndexFromInner++;
31023162
}
31033163
}
@@ -3309,7 +3369,7 @@ private void ProcessItemPedBicycle(
33093369
if ((nextLaneInfo.m_laneType & prevLaneType) == NetInfo.LaneType.None) {
33103370
nextItem.MethodDistance = 0f;
33113371
} else {
3312-
if (item.MethodDistance == 0f) { // TODO fixme: Float comparison to 0
3372+
if (FloatUtil.IsZero(item.MethodDistance)) {
33133373
comparisonValue += 100f / (0.25f * maxLength_);
33143374
}
33153375

TLM/TLM/Custom/PathFinding/CustomPathManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ public bool CustomCreatePath(out uint unit,
311311
m_pathUnits.m_buffer[unit].m_position11 = args.vehiclePosition;
312312
m_pathUnits.m_buffer[unit].m_laneTypes = (byte)args.laneTypes;
313313
m_pathUnits.m_buffer[unit].m_vehicleTypes = (uint)args.vehicleTypes;
314+
m_pathUnits.m_buffer[unit].m_vehicleCategories = (long)args.vehicleCategories;
314315
m_pathUnits.m_buffer[unit].m_length = args.maxLength;
315316
m_pathUnits.m_buffer[unit].m_positionCount = 20;
316317

@@ -370,6 +371,7 @@ public bool CreateTransportLinePath(
370371
PathUnit.Position endPosA,
371372
PathUnit.Position endPosB,
372373
VehicleInfo.VehicleType vehicleType,
374+
VehicleInfo.VehicleCategory vehicleCategory,
373375
bool skipQueue) {
374376

375377
PathCreationArgs args = new PathCreationArgs {
@@ -384,6 +386,7 @@ public bool CreateTransportLinePath(
384386
endPosB = endPosB,
385387
vehiclePosition = default,
386388
vehicleTypes = vehicleType,
389+
vehicleCategories = vehicleCategory,
387390
isHeavyVehicle = false,
388391
hasCombustionEngine = false,
389392
ignoreBlocked = true,

TLM/TLM/Custom/PathFinding/PathfinderUpdates.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static class PathfinderUpdates {
2525
/// vehicle despawning.
2626
/// </summary>
2727
[SuppressMessage("Usage", "RAS0002:Readonly field for a non-readonly struct", Justification = "Not performance critical.")]
28-
private static readonly byte LatestPathfinderEdition = 1;
28+
internal static readonly byte LatestPathfinderEdition = 1;
2929

3030
/// <summary>
3131
/// Checks savegame pathfinder edition and, if necessary, despawns

0 commit comments

Comments
 (0)