Skip to content

Commit

Permalink
Merge pull request #1735 from CitiesSkylinesMods/game-update/compatib…
Browse files Browse the repository at this point in the history
…ility_fix_1_16_1

What's new 11.7.4.0
  • Loading branch information
krzychu124 committed Mar 22, 2023
2 parents be0f6e3 + 18ba0b3 commit 8f104c6
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 47 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Expand Up @@ -29,6 +29,30 @@ This changelog includes all versions and major variants of the mod going all the

> Date format: dd/mm/yyyy
#### TM:PE V[11.7.4.0](https://github.com/CitiesSkylinesMods/TMPE/compare/11.7.3.0...11.7.3.1) STABLE, 22/03/2022

- [Meta] Compatibility patch for the game update 1.16.1-f2
- [New] Prevent the user from setting invalid Lane Arrows, update arrows if lane connections exist #368, #1724 (krzychu124)
- [Fixed] Mouse wheel scroll is changing values if dropdown popup is closed #1733 (krzychu124)
- [Fixed] Building Color change performance improvements #1725 (krzychu124)
- [Fixed] Reduced memory pressure/garbage generation in simulation critical paths #1731 (krzychu124)
- [Updated] Translation update for Arabic, Czech, English, French, Indonesian Italian, Korean, Polish, Portuguese, Romanian, Spanish, Thai, Turkish and Ukrainian
- [Updated] Minor improvements in storing mod default values #1702 (kianzarrin)
- [Mod] Improved compatibility with More Path Units
- [Steam] [TM:PE v11 STABLE](https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252)

#### TM:PE V11.7.4.0 TEST, 22/03/2022

- [Meta] Compatibility patch for the game update 1.16.1-f2
- [New] Prevent the user from setting invalid Lane Arrows, update arrows if lane connections exist #368, #1724 (krzychu124)
- [Fixed] Mouse wheel scroll is changing values if dropdown popup is closed #1733 (krzychu124)
- [Fixed] Building Color change performance improvements #1725 (krzychu124)
- [Fixed] Reduced memory pressure/garbage generation in simulation critical paths #1731 (krzychu124)
- [Updated] Translation update for Arabic, Czech, English, French, Indonesian Italian, Korean, Polish, Portuguese, Romanian, Spanish, Thai, Turkish and Ukrainian
- [Updated] Minor improvements in storing mod default values #1702 (kianzarrin)
- [Mod] Improved compatibility with More Path Units
- [Steam] [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785)

#### TM:PE V[11.7.3.1](https://github.com/CitiesSkylinesMods/TMPE/compare/11.7.3.0...11.7.3.1) STABLE, 23/12/2022

- [Fixed] Partial detection of Bank vans as service vehicles (krzychu124)
Expand Down
3 changes: 2 additions & 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.16.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.16.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 All @@ -30,6 +30,7 @@

## Releases


- [TM:PE v11 STABLE](https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252) (fully tested releases)
- [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785) (latest beta test releases)
- [Download Binaries](https://github.com/CitiesSkylinesMods/TMPE/releases) (for non-Steam users)
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.3.*")]
[assembly: AssemblyVersion("11.7.4.*")]
76 changes: 42 additions & 34 deletions TLM/TLM/Custom/PathFinding/CustomPathFind.cs
Expand Up @@ -1293,11 +1293,14 @@ private struct BufferItem {
queueItem_.pathType == ExtPathType.DrivingOnly)
// NON-STOCK CODE END
) {
bool isPrevSegmentPedZoneRoad = prevSegmentInfo.IsPedestrianZoneOrPublicTransportRoad();
for (int i = 0; i < 8; i++)
{
ushort nextPedZoneSegmentId = nextNode.GetSegment(i);
if (nextPedZoneSegmentId != 0 && nextPedZoneSegmentId != prevSegmentId && isPrevSegmentPedZoneRoad) {
if (nextPedZoneSegmentId != 0 && nextPedZoneSegmentId != prevSegmentId)
{
ref NetSegment nextPedZoneSegment = ref nextPedZoneSegmentId.ToSegment();
if (nextPedZoneSegment.Info.IsPedestrianZoneOrPublicTransportRoad())
{
ProcessItemCosts(
#if DEBUG
isLogEnabled,
Expand All @@ -1312,14 +1315,15 @@ private struct BufferItem {
ref nextNode,
false,
nextPedZoneSegmentId,
ref nextPedZoneSegmentId.ToSegment(),
ref nextPedZoneSegment,
ref prevRelSimilarLaneIndex,
connectOffset,
false,
true);
}
}
}
}
} else {
if (isLogEnabled) {
DebugLog(
Expand Down Expand Up @@ -2290,10 +2294,9 @@ private struct BufferItem {
Randomizer randomizer = new Randomizer(pathFindIndex_ ^ nextLaneId);
newDistance *= randomizer.Int32(10000U) * (1f / 1000f);
}
nextItem.ComparisonValue = comparisonValue +
(newDistance /
float currentComparisonValue = (newDistance /
((prevMaxSpeed + nextMaxSpeed) * 0.5f * maxLength_));
nextItem.Duration = duration + (distance / ((prevMaxSpeed + nextMaxSpeed) * 0.5f));
float currentDuration = (distance / ((prevMaxSpeed + nextMaxSpeed) * 0.5f));

nextItem.Direction =
(nextSegment.m_flags & NetSegment.Flags.Invert) != NetSegment.Flags.None
Expand Down Expand Up @@ -2331,9 +2334,8 @@ private struct BufferItem {
float nextOffset = Mathf.Abs(nextItem.Position.m_offset - startOffsetA_) *
BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR;

nextItem.ComparisonValue +=
nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
nextItem.Duration += nextOffset * nextSegment.m_averageLength / nextSpeed;
currentComparisonValue += nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
currentDuration += nextOffset * nextSegment.m_averageLength / nextSpeed;
}

if (nextLaneId == startLaneB_) {
Expand Down Expand Up @@ -2367,11 +2369,12 @@ private struct BufferItem {
float nextOffset = Mathf.Abs(nextItem.Position.m_offset - startOffsetB_) *
BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR;

nextItem.ComparisonValue +=
nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
nextItem.Duration += nextOffset * nextSegment.m_averageLength / nextSpeed;
currentComparisonValue += nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
currentDuration += nextOffset * nextSegment.m_averageLength / nextSpeed;
}

nextItem.ComparisonValue = comparisonValue + currentComparisonValue;
nextItem.Duration = duration + currentDuration;
nextItem.LaneId = nextLaneId;
nextItem.LanesUsed = item.LanesUsed | nextLaneInfo.m_laneType;
nextItem.VehiclesUsed = item.VehiclesUsed | nextLaneInfo.m_vehicleType;
Expand Down Expand Up @@ -2692,6 +2695,7 @@ private struct BufferItem {

NetInfo.LaneType allowedLaneTypes = laneTypes_;
VehicleInfo.VehicleType allowedVehicleTypes = vehicleTypes_;
VehicleInfo.VehicleCategory currentVehicleCategory = vehicleCategory_;
if (!enableVehicle) {
allowedVehicleTypes &= VehicleInfo.VehicleType.Bicycle;
if (allowedVehicleTypes == VehicleInfo.VehicleType.None) {
Expand All @@ -2700,6 +2704,10 @@ private struct BufferItem {
}
}

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

if (!enablePedestrian) {
allowedLaneTypes &= ~NetInfo.LaneType.Pedestrian;
}
Expand Down Expand Up @@ -2782,7 +2790,6 @@ private struct BufferItem {
}
#endif

var currentVehicleCategory = vehicleCategory_;
// NON-STOCK CODE END
for (; nextLaneIndex <= maxNextLaneIndex && nextLaneId != 0; nextLaneIndex++) {
NetInfo.Lane nextLaneInfo = nextSegmentInfo.m_lanes[nextLaneIndex];
Expand Down Expand Up @@ -2934,8 +2941,8 @@ private struct BufferItem {
}

// NON-STOCK CODE END
nextItem.ComparisonValue = comparisonValue + transitionCostOverMeanMaxSpeed;
nextItem.Duration = duration + transitionCost / ((prevMaxSpeed + nextMaxSpeed) * 0.5f);
float currentComparisonValue = transitionCostOverMeanMaxSpeed;
float currentDuration = transitionCost / ((prevMaxSpeed + nextMaxSpeed) * 0.5f);
nextItem.Direction = nextDir;

if (nextLaneId == startLaneA_) {
Expand Down Expand Up @@ -2972,10 +2979,10 @@ private struct BufferItem {
float nextOffset = Mathf.Abs(nextItem.Position.m_offset - startOffsetA_) *
BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR;

nextItem.ComparisonValue +=
currentComparisonValue +=
nextOffset * nextSegment.m_averageLength /
(nextLaneSpeed * maxLength_);
nextItem.Duration +=
currentDuration +=
nextOffset * nextSegment.m_averageLength / nextLaneSpeed;
}

Expand Down Expand Up @@ -3013,10 +3020,10 @@ private struct BufferItem {
float nextOffset = Mathf.Abs(nextItem.Position.m_offset - startOffsetB_) *
BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR;

nextItem.ComparisonValue +=
currentComparisonValue +=
nextOffset * nextSegment.m_averageLength /
(nextLaneSpeed * maxLength_);
nextItem.Duration +=
currentDuration +=
nextOffset * nextSegment.m_averageLength / nextLaneSpeed;
}

Expand All @@ -3026,7 +3033,7 @@ private struct BufferItem {
(nextLaneInfo.m_laneType &
(NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle)) !=
NetInfo.LaneType.None) {
nextItem.ComparisonValue += 0.1f;
currentComparisonValue += 0.1f;
blocked = true;
if ((allowedVehicleTypes & VehicleInfo.VehicleType.Plane) != 0)
{
Expand Down Expand Up @@ -3063,7 +3070,7 @@ private struct BufferItem {
}
}

nextItem.ComparisonValue += adjustedBaseLength;
currentComparisonValue += adjustedBaseLength;

if (isLogEnabled) {
DebugLog(
Expand All @@ -3084,7 +3091,7 @@ private struct BufferItem {
// apply lane distance factor
float adjustedBaseLength = baseLength;
adjustedBaseLength *= 1 + laneDist;
nextItem.ComparisonValue += adjustedBaseLength;
currentComparisonValue += adjustedBaseLength;

if (isLogEnabled) {
DebugLog(
Expand All @@ -3111,7 +3118,7 @@ private struct BufferItem {
int lastTarget = nextLane.m_lastTarget;
if (laneIndexFromInner < firstTarget ||
laneIndexFromInner >= lastTarget) {
nextItem.ComparisonValue +=
currentComparisonValue +=
Mathf.Max(1f, (transitionCost * 3f) - 3f) /
((prevMaxSpeed + nextMaxSpeed) * 0.5f * maxLength_);
}
Expand All @@ -3134,7 +3141,7 @@ private struct BufferItem {

if (!transportVehicle_ && nextLaneInfo.m_laneType ==
NetInfo.LaneType.TransportVehicle) {
nextItem.ComparisonValue +=
currentComparisonValue +=
20f / ((prevMaxSpeed + nextMaxSpeed) * 0.5f * maxLength_);
}
}
Expand All @@ -3151,9 +3158,11 @@ private struct BufferItem {

if ((nextLaneInfo.vehicleCategory & VehicleInfo.VehicleCategory.PublicTransportRoad) != 0 &&
(nextLaneInfo.vehicleCategory & ~(VehicleInfo.VehicleCategory.Bus | VehicleInfo.VehicleCategory.Trolleybus | VehicleInfo.VehicleCategory.Taxi)) == 0) {
nextItem.ComparisonValue -= baseLength * 0.25f;
currentComparisonValue -= baseLength * 0.25f;
}

nextItem.ComparisonValue = comparisonValue + currentComparisonValue;
nextItem.Duration = duration + currentDuration;
AddBufferItem(
#if DEBUG
isLogEnabled,
Expand Down Expand Up @@ -3437,10 +3446,9 @@ private struct BufferItem {
var nextMaxSpeed = nextLaneInfo.m_speedLimit;
#endif

nextItem.ComparisonValue = comparisonValue +
distance /
float currentComparisonValue = distance /
((prevMaxSpeed + nextMaxSpeed) * 0.25f * maxLength_);
nextItem.Duration = duration + (distance / ((prevMaxSpeed + nextMaxSpeed) * 0.5f));
float currentDuration = (distance / ((prevMaxSpeed + nextMaxSpeed) * 0.5f));

nextItem.Direction =
(nextSegment.m_flags & NetSegment.Flags.Invert) != NetSegment.Flags.None
Expand Down Expand Up @@ -3477,9 +3485,8 @@ private struct BufferItem {
float nextOffset = Mathf.Abs(nextItem.Position.m_offset - startOffsetA_) *
BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR;

nextItem.ComparisonValue +=
nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
nextItem.Duration += nextOffset * nextSegment.m_averageLength / nextSpeed;
currentComparisonValue += nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
currentDuration += nextOffset * nextSegment.m_averageLength / nextSpeed;
}

if (nextLaneId == startLaneB_) {
Expand Down Expand Up @@ -3511,11 +3518,12 @@ private struct BufferItem {
float nextOffset = Mathf.Abs(nextItem.Position.m_offset - startOffsetB_) *
BYTE_TO_FLOAT_OFFSET_CONVERSION_FACTOR;

nextItem.ComparisonValue +=
nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
nextItem.Duration += nextOffset * nextSegment.m_averageLength / nextSpeed;
currentComparisonValue += nextOffset * nextSegment.m_averageLength / (nextSpeed * maxLength_);
currentDuration += nextOffset * nextSegment.m_averageLength / nextSpeed;
}

nextItem.ComparisonValue = comparisonValue + currentComparisonValue;
nextItem.Duration = duration + currentDuration;
nextItem.LaneId = nextLaneId;
nextItem.LanesUsed = item.LanesUsed | nextLaneInfo.m_laneType;
nextItem.VehiclesUsed = item.VehiclesUsed | nextLaneInfo.m_vehicleType;
Expand Down
1 change: 1 addition & 0 deletions TLM/TLM/Manager/Impl/AdvancedParkingManager.cs
Expand Up @@ -1952,6 +1952,7 @@ private ExtSoftPathState
false,
false,
GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance,
false,
out endPathPos)) {
calculateEndPos = false;
}
Expand Down
5 changes: 5 additions & 0 deletions TLM/TLM/Manager/Impl/ExtCitizenInstanceManager.cs
Expand Up @@ -927,6 +927,7 @@ bool citizenDebug
false,
false,
parkingAiConf.MaxBuildingToPedestrianLaneDistance,
false,
out parkedVehiclePathPos);
}

Expand Down Expand Up @@ -977,6 +978,7 @@ bool citizenDebug
allowUnderground,
false,
parkingAiConf.MaxBuildingToPedestrianLaneDistance,
false,
out startPosA);
} else {
foundStartPos = FindPathPosition(
Expand Down Expand Up @@ -1152,6 +1154,7 @@ bool citizenDebug
SavedGameOptions.Instance.parkingAI
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
out PathUnit.Position posA,
out PathUnit.Position posB,
out float distA,
Expand All @@ -1171,6 +1174,7 @@ bool citizenDebug
SavedGameOptions.Instance.parkingAI
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
out posA,
out posB,
out distA,
Expand All @@ -1191,6 +1195,7 @@ bool citizenDebug
SavedGameOptions.Instance.parkingAI
? GlobalConfig.Instance.ParkingAI.MaxBuildingToPedestrianLaneDistance
: 32f,
false,
out posA,
out posB,
out distA,
Expand Down

0 comments on commit 8f104c6

Please sign in to comment.