Skip to content

Commit

Permalink
Merge pull request #1749 from CitiesSkylinesMods/whats-new-11_8_0_0
Browse files Browse the repository at this point in the history
Compatibility patch for 1.17.1-f2
  • Loading branch information
krzychu124 committed Jun 12, 2023
2 parents 842373f + a9fa3dd commit bd2717c
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 30 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Expand Up @@ -29,6 +29,16 @@ This changelog includes all versions and major variants of the mod going all the

> Date format: dd/mm/yyyy
#### 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

- [Meta] Compatibility patch for the game update 1.17.1-f2
- [Steam] [TM:PE v11 STABLE](https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252)

#### TM:PE V11.8.0.0 TEST, 12/06/2022

- [Meta] Compatibility patch for the game update 1.17.1-f2
- [Steam] [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785)

#### 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

- [Meta] Minor fixes and improvements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -9,7 +9,7 @@
<a href="https://github.com/CitiesSkylinesMods/TMPE/wiki/Report-a-Bug">Report a Bug</a><br />
</p>
<p align="center">
<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>
<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>
<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>
<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>
<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>
Expand Down
2 changes: 1 addition & 1 deletion TLM/SharedAssemblyInfo.cs
Expand Up @@ -20,4 +20,4 @@
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("11.7.5.*")]
[assembly: AssemblyVersion("11.8.0.*")]
37 changes: 26 additions & 11 deletions TLM/TLM/Custom/PathFinding/CustomPathFind.cs
Expand Up @@ -996,8 +996,12 @@ private struct BufferItem {
prevLaneIndex,
item.LaneId,
prevLaneInfo);

if (!(prevMaxSpeed > 0f)) {
prevMaxSpeed = 1f;
}
#else
prevMaxSpeed = prevLaneInfo.m_speedLimit;
prevMaxSpeed = !(prevLaneInfo.m_speedLimit > 0f) ? 1f : prevLaneInfo.m_speedLimit;
#endif
prevLaneSpeed = CalculateLaneSpeed(
prevMaxSpeed,
Expand Down Expand Up @@ -2284,9 +2288,13 @@ private struct BufferItem {
nextLaneId,
nextLaneInfo);

if (!(nextMaxSpeed > 0f)) {
nextMaxSpeed = 1f; // prevent divide by zero which result in NaN value
}

// NON-STOCK CODE END
#else
var nextMaxSpeed = nextLaneInfo.m_speedLimit;
var nextMaxSpeed = !(nextLaneInfo.m_speedLimit > 0f) ? 1f : nextLaneInfo.m_speedLimit;
#endif
float newDistance = distance;
if (!stablePath_ && (nextLaneInfo.m_vehicleType & VehicleInfo.VehicleType.Plane) != VehicleInfo.VehicleType.None)
Expand Down Expand Up @@ -2704,10 +2712,6 @@ private struct BufferItem {
}
}

if (ignoreBlocked_) {
currentVehicleCategory = VehicleInfo.VehicleCategory.All;
}

if (!enablePedestrian) {
allowedLaneTypes &= ~NetInfo.LaneType.Pedestrian;
}
Expand Down Expand Up @@ -2835,8 +2839,12 @@ private struct BufferItem {
nextLaneId,
nextLaneInfo);
// NON-STOCK CODE END

if (!(nextMaxSpeed > 0f)) {
nextMaxSpeed = 1f;
}
#else
nextMaxSpeed = nextLaneInfo.m_speedLimit;
nextMaxSpeed = !(nextLaneInfo.m_speedLimit > 0f) ? 1f : nextLaneInfo.m_speedLimit;
#endif

float transitionCostOverMeanMaxSpeed =
Expand Down Expand Up @@ -3441,6 +3449,10 @@ private struct BufferItem {
// NON-STOCK CODE START
float nextMaxSpeed = speedLimitManager.GetGameSpeedLimit(nextSegmentId, (byte)nextLaneIndex, nextLaneId, nextLaneInfo);

if (!(nextMaxSpeed > 0f)) {
nextMaxSpeed = 1f;
}

// NON-STOCK CODE END
#else
var nextMaxSpeed = nextLaneInfo.m_speedLimit;
Expand Down Expand Up @@ -4041,6 +4053,9 @@ private struct BufferItem {
laneTarget_[item.LaneId] = target;
}

/// <summary>
/// Calculated Lane speed based on lane direction and ensures value > 0f
/// </summary>
private float CalculateLaneSpeed(float maxSpeed,
byte startOffset,
byte endOffset,
Expand All @@ -4051,18 +4066,18 @@ private struct BufferItem {
: NetInfo.InvertDirection(laneInfo.m_finalDirection);

if ((direction & NetInfo.Direction.Avoid) == NetInfo.Direction.None) {
return maxSpeed;
return !(maxSpeed > 0f) ? 1f : maxSpeed;
}

if (endOffset > startOffset && direction == NetInfo.Direction.AvoidForward) {
return maxSpeed * 0.1f;
return !(maxSpeed > 0f) ? 0.1f : maxSpeed * 0.1f;
}

if (endOffset < startOffset && direction == NetInfo.Direction.AvoidBackward) {
return maxSpeed * 0.1f;
return !(maxSpeed > 0f) ? 0.1f : maxSpeed * 0.1f;
}

return maxSpeed * 0.2f;
return !(maxSpeed > 0f) ? 0.2f : maxSpeed * 0.2f;
}

private void GetLaneDirection(
Expand Down
1 change: 1 addition & 0 deletions TLM/TLM/Manager/Impl/AdvancedParkingManager.cs
Expand Up @@ -1953,6 +1953,7 @@ private ExtSoftPathState
false,
GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance,
false,
true,
out endPathPos)) {
calculateEndPos = false;
}
Expand Down
5 changes: 5 additions & 0 deletions TLM/TLM/Manager/Impl/ExtCitizenInstanceManager.cs
Expand Up @@ -930,6 +930,7 @@ bool citizenDebug
false,
parkingAiConf.MaxBuildingToPedestrianLaneDistance,
false,
false,
out parkedVehiclePathPos);
}

Expand Down Expand Up @@ -981,6 +982,7 @@ bool citizenDebug
false,
parkingAiConf.MaxBuildingToPedestrianLaneDistance,
false,
false,
out startPosA);
} else {
foundStartPos = FindPathPosition(
Expand Down Expand Up @@ -1157,6 +1159,7 @@ bool citizenDebug
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
true,
out PathUnit.Position posA,
out PathUnit.Position posB,
out float distA,
Expand All @@ -1177,6 +1180,7 @@ bool citizenDebug
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
true,
out posA,
out posB,
out distA,
Expand All @@ -1198,6 +1202,7 @@ bool citizenDebug
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
true,
out posA,
out posB,
out distA,
Expand Down
20 changes: 19 additions & 1 deletion TLM/TLM/Manager/Impl/ExtPathManager.cs
Expand Up @@ -59,6 +59,7 @@ public class ExtPathManager
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
excludeLaneWidth: false,
checkPedestrianStreet: false,
pathPosA: out PathUnit.Position posA,
pathPosB: out _,
distanceSqrA: out float distA,
Expand All @@ -80,6 +81,7 @@ public class ExtPathManager
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
checkPedestrianStreet: true,
out posA,
out _,
out distA,
Expand All @@ -102,6 +104,7 @@ public class ExtPathManager
.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
checkPedestrianStreet: true,
out posA,
out _,
out distA,
Expand All @@ -122,6 +125,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPos) {
return FindPathPositionWithSpiralLoop(
position,
Expand All @@ -135,6 +139,7 @@ public class ExtPathManager
requireConnect,
maxDistance,
excludeLaneWidth,
checkPedestrianStreet,
out pathPos);
}

Expand All @@ -149,6 +154,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPos) {
return FindPathPositionWithSpiralLoop(
position,
Expand All @@ -163,6 +169,7 @@ public class ExtPathManager
requireConnect,
maxDistance,
excludeLaneWidth,
checkPedestrianStreet,
out pathPos);
}

Expand All @@ -177,6 +184,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPos) {
return FindPathPositionWithSpiralLoop(
position,
Expand All @@ -192,6 +200,7 @@ public class ExtPathManager
requireConnect,
maxDistance,
excludeLaneWidth,
checkPedestrianStreet,
out pathPos,
out PathUnit.Position _,
out float _,
Expand All @@ -210,6 +219,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPos
) {
return FindPathPositionWithSpiralLoop(
Expand All @@ -226,6 +236,7 @@ public class ExtPathManager
requireConnect,
maxDistance,
excludeLaneWidth,
checkPedestrianStreet,
out pathPos,
out PathUnit.Position _,
out float _,
Expand All @@ -242,6 +253,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPosA,
out PathUnit.Position pathPosB,
out float distanceSqrA,
Expand All @@ -258,6 +270,7 @@ public class ExtPathManager
requireConnect,
maxDistance,
excludeLaneWidth,
checkPedestrianStreet,
out pathPosA,
out pathPosB,
out distanceSqrA,
Expand All @@ -275,6 +288,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPosA,
out PathUnit.Position pathPosB,
out float distanceSqrA,
Expand All @@ -293,6 +307,7 @@ public class ExtPathManager
requireConnect,
maxDistance,
excludeLaneWidth,
checkPedestrianStreet,
out pathPosA,
out pathPosB,
out distanceSqrA,
Expand All @@ -310,6 +325,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPosA,
out PathUnit.Position pathPosB,
out float distanceSqrA,
Expand All @@ -328,6 +344,7 @@ public class ExtPathManager
requireConnect,
maxDistance,
excludeLaneWidth,
checkPedestrianStreet,
out pathPosA,
out pathPosB,
out distanceSqrA,
Expand All @@ -347,6 +364,7 @@ public class ExtPathManager
bool requireConnect,
float maxDistance,
bool excludeLaneWidth,
bool checkPedestrianStreet,
out PathUnit.Position pathPosA,
out PathUnit.Position pathPosB,
out float distanceSqrA,
Expand Down Expand Up @@ -448,7 +466,7 @@ public class ExtPathManager

if (otherPassed) {
// STOCK-CODE START
if (segmentInfo.IsPedestrianZoneOrPublicTransportRoad())
if (checkPedestrianStreet && segmentInfo.IsPedestrianZoneOrPublicTransportRoad())
{
vehicleCategory &= ~segmentInfo.m_vehicleCategories;
if ((laneType & NetInfo.LaneType.Pedestrian) != 0)
Expand Down
1 change: 1 addition & 0 deletions TLM/TLM/Manager/Impl/VehicleBehaviorManager.cs
Expand Up @@ -898,6 +898,7 @@ bool citizenDebug
false,
32f,
false,
false,
out startPosA,
out startPosB,
out sqrDistA,
Expand Down
15 changes: 4 additions & 11 deletions TLM/TLM/Resources/whats_new.txt
@@ -1,13 +1,6 @@
[Version] 11.7.5.0
[Released] May 24th 2023
[Link] tmpe-v11750-stable-24052023
[Version] 11.8.0.0
[Released] Jun 12th 2023
[Link] tmpe-v11800-stable-12062023
[Stable]
[Meta] Minor fixes and improvements
[New] Finnish language support! Help us finish translation on Crowdin (link in the mod options)
[Fixed] Silent error on load breaks Lane arrow availability detector #1736 #1747 (krzychu124)
[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)
[Fixed] Fixed incorrect Citizen Influx value displayed in the City Statistics window #1737 (krzychu124)
[Fixed] Optimized number of pathfinding threads #1744 (krzychu124)
[Updated] Support for game update version 1.17 in the trigger for message about incompatibility with the game
[Updated] Translation update for Romanian, French, Spanish, Arabic, Czech, Finnish, Italian, Polish, Slovak, Turkish, Ukrainian, English and Thai
[Meta] Compatibility patch for 1.17.1-f2
[/Version]
4 changes: 2 additions & 2 deletions TLM/TLM/State/GetSpeedLimitResult.cs
Expand Up @@ -21,8 +21,8 @@ public struct GetSpeedLimitResult {
}

public override string ToString() {
string ov = this.OverrideValue.HasValue ? $"Speed: {this.OverrideValue};" : string.Empty;
string dv = this.DefaultValue.HasValue ? $"Default: {this.DefaultValue}" : string.Empty;
string ov = this.OverrideValue.HasValue ? $"Speed: {this.OverrideValue};" : "NULL";
string dv = this.DefaultValue.HasValue ? $"Default: {this.DefaultValue}" : "NULL";
return $"({ov} {dv})";
}
}
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/UI/WhatsNew/WhatsNew.cs
Expand Up @@ -11,7 +11,7 @@ namespace TrafficManager.UI.WhatsNew {

public class WhatsNew {
// bump and update what's new changelogs when new features added
public static readonly Version CurrentVersion = new Version(11,7,5,0);
public static readonly Version CurrentVersion = new Version(11,8,0,0);

private const string WHATS_NEW_FILE = "whats_new.txt";
private const string RESOURCES_PREFIX = "TrafficManager.Resources.";
Expand Down
4 changes: 2 additions & 2 deletions TLM/TLM/Util/VersionUtil.cs
Expand Up @@ -35,10 +35,10 @@ public static class VersionUtil {
// we could alternatively use BuildConfig.APPLICATION_VERSION because const values are evaluated at compile time.
// but I have decided not to do this because I don't want this to happen automatically with a rebuild if
// CS updates. these values should be changed manually so as to force us to acknowledge that they have changed.
public const uint EXPECTED_GAME_VERSION_U = 205644560U;
public const uint EXPECTED_GAME_VERSION_U = 205775376U;

// see comments for EXPECTED_GAME_VERSION_U.
public static Version ExpectedGameVersion => new Version(1, 17, 0, 3);
public static Version ExpectedGameVersion => new Version(1, 17, 1, 2);

public static string ExpectedGameVersionString => BuildConfig.VersionToString(EXPECTED_GAME_VERSION_U, false);

Expand Down

0 comments on commit bd2717c

Please sign in to comment.