Skip to content

Commit bd2717c

Browse files
authored
Merge pull request #1749 from CitiesSkylinesMods/whats-new-11_8_0_0
Compatibility patch for 1.17.1-f2
2 parents 842373f + a9fa3dd commit bd2717c

File tree

13 files changed

+81
-30
lines changed

13 files changed

+81
-30
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ 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.8.0.0](https://github.com/CitiesSkylinesMods/TMPE/compare/11.7.5.0...11.8.0.0) STABLE, 12/06/2022
33+
34+
- [Meta] Compatibility patch for the game update 1.17.1-f2
35+
- [Steam] [TM:PE v11 STABLE](https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252)
36+
37+
#### TM:PE V11.8.0.0 TEST, 12/06/2022
38+
39+
- [Meta] Compatibility patch for the game update 1.17.1-f2
40+
- [Steam] [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785)
41+
3242
#### TM:PE V[11.7.5.0](https://github.com/CitiesSkylinesMods/TMPE/compare/11.7.4.0...11.7.5.0) STABLE, 24/05/2022
3343

3444
- [Meta] Minor fixes and improvements

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.17.0-f3&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.17.1-f2&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/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.7.5.*")]
23+
[assembly: AssemblyVersion("11.8.0.*")]

TLM/TLM/Custom/PathFinding/CustomPathFind.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,12 @@ private void ProcessItemMain(
996996
prevLaneIndex,
997997
item.LaneId,
998998
prevLaneInfo);
999+
1000+
if (!(prevMaxSpeed > 0f)) {
1001+
prevMaxSpeed = 1f;
1002+
}
9991003
#else
1000-
prevMaxSpeed = prevLaneInfo.m_speedLimit;
1004+
prevMaxSpeed = !(prevLaneInfo.m_speedLimit > 0f) ? 1f : prevLaneInfo.m_speedLimit;
10011005
#endif
10021006
prevLaneSpeed = CalculateLaneSpeed(
10031007
prevMaxSpeed,
@@ -2284,9 +2288,13 @@ private void ProcessItemPublicTransport(
22842288
nextLaneId,
22852289
nextLaneInfo);
22862290

2291+
if (!(nextMaxSpeed > 0f)) {
2292+
nextMaxSpeed = 1f; // prevent divide by zero which result in NaN value
2293+
}
2294+
22872295
// NON-STOCK CODE END
22882296
#else
2289-
var nextMaxSpeed = nextLaneInfo.m_speedLimit;
2297+
var nextMaxSpeed = !(nextLaneInfo.m_speedLimit > 0f) ? 1f : nextLaneInfo.m_speedLimit;
22902298
#endif
22912299
float newDistance = distance;
22922300
if (!stablePath_ && (nextLaneInfo.m_vehicleType & VehicleInfo.VehicleType.Plane) != VehicleInfo.VehicleType.None)
@@ -2704,10 +2712,6 @@ private bool ProcessItemCosts(
27042712
}
27052713
}
27062714

2707-
if (ignoreBlocked_) {
2708-
currentVehicleCategory = VehicleInfo.VehicleCategory.All;
2709-
}
2710-
27112715
if (!enablePedestrian) {
27122716
allowedLaneTypes &= ~NetInfo.LaneType.Pedestrian;
27132717
}
@@ -2835,8 +2839,12 @@ private bool ProcessItemCosts(
28352839
nextLaneId,
28362840
nextLaneInfo);
28372841
// NON-STOCK CODE END
2842+
2843+
if (!(nextMaxSpeed > 0f)) {
2844+
nextMaxSpeed = 1f;
2845+
}
28382846
#else
2839-
nextMaxSpeed = nextLaneInfo.m_speedLimit;
2847+
nextMaxSpeed = !(nextLaneInfo.m_speedLimit > 0f) ? 1f : nextLaneInfo.m_speedLimit;
28402848
#endif
28412849

28422850
float transitionCostOverMeanMaxSpeed =
@@ -3441,6 +3449,10 @@ private void ProcessItemPedBicycle(
34413449
// NON-STOCK CODE START
34423450
float nextMaxSpeed = speedLimitManager.GetGameSpeedLimit(nextSegmentId, (byte)nextLaneIndex, nextLaneId, nextLaneInfo);
34433451

3452+
if (!(nextMaxSpeed > 0f)) {
3453+
nextMaxSpeed = 1f;
3454+
}
3455+
34443456
// NON-STOCK CODE END
34453457
#else
34463458
var nextMaxSpeed = nextLaneInfo.m_speedLimit;
@@ -4041,6 +4053,9 @@ private void AddBufferItem(
40414053
laneTarget_[item.LaneId] = target;
40424054
}
40434055

4056+
/// <summary>
4057+
/// Calculated Lane speed based on lane direction and ensures value > 0f
4058+
/// </summary>
40444059
private float CalculateLaneSpeed(float maxSpeed,
40454060
byte startOffset,
40464061
byte endOffset,
@@ -4051,18 +4066,18 @@ private float CalculateLaneSpeed(float maxSpeed,
40514066
: NetInfo.InvertDirection(laneInfo.m_finalDirection);
40524067

40534068
if ((direction & NetInfo.Direction.Avoid) == NetInfo.Direction.None) {
4054-
return maxSpeed;
4069+
return !(maxSpeed > 0f) ? 1f : maxSpeed;
40554070
}
40564071

40574072
if (endOffset > startOffset && direction == NetInfo.Direction.AvoidForward) {
4058-
return maxSpeed * 0.1f;
4073+
return !(maxSpeed > 0f) ? 0.1f : maxSpeed * 0.1f;
40594074
}
40604075

40614076
if (endOffset < startOffset && direction == NetInfo.Direction.AvoidBackward) {
4062-
return maxSpeed * 0.1f;
4077+
return !(maxSpeed > 0f) ? 0.1f : maxSpeed * 0.1f;
40634078
}
40644079

4065-
return maxSpeed * 0.2f;
4080+
return !(maxSpeed > 0f) ? 0.2f : maxSpeed * 0.2f;
40664081
}
40674082

40684083
private void GetLaneDirection(

TLM/TLM/Manager/Impl/AdvancedParkingManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,6 +1953,7 @@ public bool FindParkingSpaceForCitizen(Vector3 endPos,
19531953
false,
19541954
GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance,
19551955
false,
1956+
true,
19561957
out endPathPos)) {
19571958
calculateEndPos = false;
19581959
}

TLM/TLM/Manager/Impl/ExtCitizenInstanceManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ bool citizenDebug
930930
false,
931931
parkingAiConf.MaxBuildingToPedestrianLaneDistance,
932932
false,
933+
false,
933934
out parkedVehiclePathPos);
934935
}
935936

@@ -981,6 +982,7 @@ bool citizenDebug
981982
false,
982983
parkingAiConf.MaxBuildingToPedestrianLaneDistance,
983984
false,
985+
false,
984986
out startPosA);
985987
} else {
986988
foundStartPos = FindPathPosition(
@@ -1157,6 +1159,7 @@ public bool FindPathPosition(ushort instanceID,
11571159
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
11581160
: 32f,
11591161
false,
1162+
true,
11601163
out PathUnit.Position posA,
11611164
out PathUnit.Position posB,
11621165
out float distA,
@@ -1177,6 +1180,7 @@ public bool FindPathPosition(ushort instanceID,
11771180
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
11781181
: 32f,
11791182
false,
1183+
true,
11801184
out posA,
11811185
out posB,
11821186
out distA,
@@ -1198,6 +1202,7 @@ public bool FindPathPosition(ushort instanceID,
11981202
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
11991203
: 32f,
12001204
false,
1205+
true,
12011206
out posA,
12021207
out posB,
12031208
out distA,

TLM/TLM/Manager/Impl/ExtPathManager.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public bool FindCitizenPathPosition(Vector3 pos,
5959
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
6060
: 32f,
6161
excludeLaneWidth: false,
62+
checkPedestrianStreet: false,
6263
pathPosA: out PathUnit.Position posA,
6364
pathPosB: out _,
6465
distanceSqrA: out float distA,
@@ -80,6 +81,7 @@ public bool FindCitizenPathPosition(Vector3 pos,
8081
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
8182
: 32f,
8283
false,
84+
checkPedestrianStreet: true,
8385
out posA,
8486
out _,
8587
out distA,
@@ -102,6 +104,7 @@ public bool FindCitizenPathPosition(Vector3 pos,
102104
.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
103105
: 32f,
104106
false,
107+
checkPedestrianStreet: true,
105108
out posA,
106109
out _,
107110
out distA,
@@ -122,6 +125,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
122125
bool requireConnect,
123126
float maxDistance,
124127
bool excludeLaneWidth,
128+
bool checkPedestrianStreet,
125129
out PathUnit.Position pathPos) {
126130
return FindPathPositionWithSpiralLoop(
127131
position,
@@ -135,6 +139,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
135139
requireConnect,
136140
maxDistance,
137141
excludeLaneWidth,
142+
checkPedestrianStreet,
138143
out pathPos);
139144
}
140145

@@ -149,6 +154,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
149154
bool requireConnect,
150155
float maxDistance,
151156
bool excludeLaneWidth,
157+
bool checkPedestrianStreet,
152158
out PathUnit.Position pathPos) {
153159
return FindPathPositionWithSpiralLoop(
154160
position,
@@ -163,6 +169,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
163169
requireConnect,
164170
maxDistance,
165171
excludeLaneWidth,
172+
checkPedestrianStreet,
166173
out pathPos);
167174
}
168175

@@ -177,6 +184,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
177184
bool requireConnect,
178185
float maxDistance,
179186
bool excludeLaneWidth,
187+
bool checkPedestrianStreet,
180188
out PathUnit.Position pathPos) {
181189
return FindPathPositionWithSpiralLoop(
182190
position,
@@ -192,6 +200,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
192200
requireConnect,
193201
maxDistance,
194202
excludeLaneWidth,
203+
checkPedestrianStreet,
195204
out pathPos,
196205
out PathUnit.Position _,
197206
out float _,
@@ -210,6 +219,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
210219
bool requireConnect,
211220
float maxDistance,
212221
bool excludeLaneWidth,
222+
bool checkPedestrianStreet,
213223
out PathUnit.Position pathPos
214224
) {
215225
return FindPathPositionWithSpiralLoop(
@@ -226,6 +236,7 @@ out PathUnit.Position pathPos
226236
requireConnect,
227237
maxDistance,
228238
excludeLaneWidth,
239+
checkPedestrianStreet,
229240
out pathPos,
230241
out PathUnit.Position _,
231242
out float _,
@@ -242,6 +253,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
242253
bool requireConnect,
243254
float maxDistance,
244255
bool excludeLaneWidth,
256+
bool checkPedestrianStreet,
245257
out PathUnit.Position pathPosA,
246258
out PathUnit.Position pathPosB,
247259
out float distanceSqrA,
@@ -258,6 +270,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
258270
requireConnect,
259271
maxDistance,
260272
excludeLaneWidth,
273+
checkPedestrianStreet,
261274
out pathPosA,
262275
out pathPosB,
263276
out distanceSqrA,
@@ -275,6 +288,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
275288
bool requireConnect,
276289
float maxDistance,
277290
bool excludeLaneWidth,
291+
bool checkPedestrianStreet,
278292
out PathUnit.Position pathPosA,
279293
out PathUnit.Position pathPosB,
280294
out float distanceSqrA,
@@ -293,6 +307,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
293307
requireConnect,
294308
maxDistance,
295309
excludeLaneWidth,
310+
checkPedestrianStreet,
296311
out pathPosA,
297312
out pathPosB,
298313
out distanceSqrA,
@@ -310,6 +325,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
310325
bool requireConnect,
311326
float maxDistance,
312327
bool excludeLaneWidth,
328+
bool checkPedestrianStreet,
313329
out PathUnit.Position pathPosA,
314330
out PathUnit.Position pathPosB,
315331
out float distanceSqrA,
@@ -328,6 +344,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
328344
requireConnect,
329345
maxDistance,
330346
excludeLaneWidth,
347+
checkPedestrianStreet,
331348
out pathPosA,
332349
out pathPosB,
333350
out distanceSqrA,
@@ -347,6 +364,7 @@ public bool FindPathPositionWithSpiralLoop(Vector3 position,
347364
bool requireConnect,
348365
float maxDistance,
349366
bool excludeLaneWidth,
367+
bool checkPedestrianStreet,
350368
out PathUnit.Position pathPosA,
351369
out PathUnit.Position pathPosB,
352370
out float distanceSqrA,
@@ -448,7 +466,7 @@ bool FindHelper(int i, int j) {
448466

449467
if (otherPassed) {
450468
// STOCK-CODE START
451-
if (segmentInfo.IsPedestrianZoneOrPublicTransportRoad())
469+
if (checkPedestrianStreet && segmentInfo.IsPedestrianZoneOrPublicTransportRoad())
452470
{
453471
vehicleCategory &= ~segmentInfo.m_vehicleCategories;
454472
if ((laneType & NetInfo.LaneType.Pedestrian) != 0)

TLM/TLM/Manager/Impl/VehicleBehaviorManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ bool citizenDebug
898898
false,
899899
32f,
900900
false,
901+
false,
901902
out startPosA,
902903
out startPosB,
903904
out sqrDistA,

TLM/TLM/Resources/whats_new.txt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
[Version] 11.7.5.0
2-
[Released] May 24th 2023
3-
[Link] tmpe-v11750-stable-24052023
1+
[Version] 11.8.0.0
2+
[Released] Jun 12th 2023
3+
[Link] tmpe-v11800-stable-12062023
44
[Stable]
5-
[Meta] Minor fixes and improvements
6-
[New] Finnish language support! Help us finish translation on Crowdin (link in the mod options)
7-
[Fixed] Silent error on load breaks Lane arrow availability detector #1736 #1747 (krzychu124)
8-
[Fixed] Parking AI bugfixing and reliability improvements. Manually clear parked cars (maintenance tab in the options) in case of issues with parking vehicles in the past #1746 (krzychu124)
9-
[Fixed] Fixed incorrect Citizen Influx value displayed in the City Statistics window #1737 (krzychu124)
10-
[Fixed] Optimized number of pathfinding threads #1744 (krzychu124)
11-
[Updated] Support for game update version 1.17 in the trigger for message about incompatibility with the game
12-
[Updated] Translation update for Romanian, French, Spanish, Arabic, Czech, Finnish, Italian, Polish, Slovak, Turkish, Ukrainian, English and Thai
5+
[Meta] Compatibility patch for 1.17.1-f2
136
[/Version]

TLM/TLM/State/GetSpeedLimitResult.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public GetSpeedLimitResult(SpeedValue? overrideValue, SpeedValue? defaultValue)
2121
}
2222

2323
public override string ToString() {
24-
string ov = this.OverrideValue.HasValue ? $"Speed: {this.OverrideValue};" : string.Empty;
25-
string dv = this.DefaultValue.HasValue ? $"Default: {this.DefaultValue}" : string.Empty;
24+
string ov = this.OverrideValue.HasValue ? $"Speed: {this.OverrideValue};" : "NULL";
25+
string dv = this.DefaultValue.HasValue ? $"Default: {this.DefaultValue}" : "NULL";
2626
return $"({ov} {dv})";
2727
}
2828
}

0 commit comments

Comments
 (0)