Skip to content

Commit

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

TM:PE 11.7.0.0 - compatibility patch 1.15.x
  • Loading branch information
krzychu124 committed Sep 14, 2022
2 parents 24651dd + 2c08b08 commit 30ed1e8
Show file tree
Hide file tree
Showing 69 changed files with 1,132 additions and 381 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ This changelog includes all versions and major variants of the mod going all the

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

- [New] Compatibility patch for game update 1.15.0-f5
- [Fixed] Message about the reason of disabled options not showing correctly, updated translation
- [Updated] Lane connection code cleanup #1615 (kianzarrin)
- [Updated] Translations
- [Steam] [TM:PE v11 STABLE](https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252)

#### TM:PE V11.7.0.0 TEST, 14/09/2022

- [New] Compatibility patch for game update 1.15.0-f5
- [Fixed] Message about the reason of disabled options not showing correctly, updated translation
- [Updated] Lane connection code cleanup #1615 (kianzarrin)
- [Updated] Translations
- [Steam] [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785)

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

- [Meta] TM:PE 11.6.6.3 branch released as STABLE - huge thanks to our beta testers!
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
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.14.1-f2&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.15.0-f5&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/CSUtil.CameraControl
2 changes: 1 addition & 1 deletion TLM/OptionsFramework
2 changes: 1 addition & 1 deletion TLM/SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("11.6.6.*")]
[assembly: AssemblyVersion("11.7.0.*")]
82 changes: 71 additions & 11 deletions TLM/TLM/Custom/PathFinding/CustomPathFind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public class CustomPathFind : PathFind {
private readonly TrafficMeasurementManager trafficMeasurementManager =
TrafficMeasurementManager.Instance;
#endif
//Cached value (vanilla uses property to access it)
private VehicleInfo.VehicleCategory vehicleCategory_;

private GlobalConfig globalConf_;

Expand Down Expand Up @@ -256,6 +258,7 @@ private struct BufferItem {

laneTypes_ = (NetInfo.LaneType)pathUnits_.m_buffer[unit].m_laneTypes;
vehicleTypes_ = (VehicleInfo.VehicleType)pathUnits_.m_buffer[unit].m_vehicleTypes;
vehicleCategory_ = (VehicleInfo.VehicleCategory)pathUnits_.m_buffer[unit].m_vehicleCategories;
maxLength_ = pathUnits_.m_buffer[unit].m_length;
pathFindIndex_ = pathFindIndex_ + 1 & 0x7FFF;
pathRandomizer_ = new Randomizer(unit);
Expand Down Expand Up @@ -1031,6 +1034,7 @@ private struct BufferItem {
} else if (prevIsPedestrianLane) {
// we are going to a pedestrian lane
if (!prevIsElevated) {
bool isPedZoneRoad = prevSegmentInfo.IsPedestrianZoneOrPublicTransportRoad();
if (nextNode.Info.m_class.m_service != ItemClass.Service.Beautification) {
bool canCrossStreet =
(nextNode.m_flags &
Expand All @@ -1047,6 +1051,7 @@ private struct BufferItem {
nextNodeId,
NetInfo.LaneType.Pedestrian,
VehicleInfo.VehicleType.None,
VehicleInfo.VehicleCategory.None,
prevLaneIndex,
isOnCenterPlatform,
out int leftLaneIndex,
Expand All @@ -1068,6 +1073,7 @@ private struct BufferItem {
nextNodeId,
NetInfo.LaneType.Pedestrian,
VehicleInfo.VehicleType.None,
VehicleInfo.VehicleCategory.None,
-1,
isOnCenterPlatform,
out _,
Expand Down Expand Up @@ -1106,6 +1112,7 @@ private struct BufferItem {
nextNodeId,
NetInfo.LaneType.Pedestrian,
VehicleInfo.VehicleType.None,
VehicleInfo.VehicleCategory.None,
-1,
isOnCenterPlatform,
out int someLeftLaneIndex,
Expand Down Expand Up @@ -1138,8 +1145,8 @@ private struct BufferItem {
}

if (leftLaneId != 0 &&
(nextLeftSegmentId != prevSegmentId || canCrossStreet ||
isOnCenterPlatform)) {
(nextLeftSegmentId != prevSegmentId || canCrossStreet || isOnCenterPlatform) &&
(!isPedZoneRoad || !netManager.m_segments.m_buffer[nextLeftSegmentId].Info.IsPedestrianZoneOrPublicTransportRoad())) {
if (isLogEnabled) {
DebugLog(
unitId,
Expand Down Expand Up @@ -1174,8 +1181,8 @@ private struct BufferItem {
}

if (rightLaneId != 0 && rightLaneId != leftLaneId &&
(nextRightSegmentId != prevSegmentId || canCrossStreet ||
isOnCenterPlatform)) {
(nextRightSegmentId != prevSegmentId || canCrossStreet || isOnCenterPlatform) &&
(!isPedZoneRoad || !netManager.m_segments.m_buffer[nextRightSegmentId].Info.IsPedestrianZoneOrPublicTransportRoad())) {
if (isLogEnabled) {
DebugLog(
unitId,
Expand Down Expand Up @@ -1217,6 +1224,7 @@ private struct BufferItem {
item.Position.m_lane,
NetInfo.LaneType.Vehicle,
VehicleInfo.VehicleType.Bicycle,
VehicleInfo.VehicleCategory.All,
out int nextLaneIndex,
out uint nextLaneId)) {
if (isLogEnabled) {
Expand Down Expand Up @@ -1251,6 +1259,35 @@ private struct BufferItem {
connectOffset,
connectOffset);
}

if (isPedZoneRoad) {
bool isPrevSegmentPedZoneRoad = prevSegmentInfo.IsPedestrianZoneOrPublicTransportRoad();
for (int i = 0; i < 8; i++)
{
ushort nextPedZoneSegmentId = nextNode.GetSegment(i);
if (nextPedZoneSegmentId != 0 && nextPedZoneSegmentId != prevSegmentId && isPrevSegmentPedZoneRoad) {
ProcessItemCosts(
#if DEBUG
isLogEnabled,
unitId,
#endif
item,
ref prevSegment,
ref prevLane,
prevMaxSpeed,
prevLaneSpeed,
nextNodeId,
ref nextNode,
false,
nextPedZoneSegmentId,
ref nextPedZoneSegmentId.ToSegment(),
ref prevRelSimilarLaneIndex,
connectOffset,
false,
true);
}
}
}
} else {
if (isLogEnabled) {
DebugLog(
Expand Down Expand Up @@ -1374,6 +1411,7 @@ private struct BufferItem {
prevLaneIndex,
nextLaneType,
nextVehicleType,
vehicleCategory_,
out int sameSegLaneIndex,
out uint sameSegLaneId))
{
Expand Down Expand Up @@ -1660,6 +1698,8 @@ private struct BufferItem {
}
}

VehicleInfo.VehicleCategory currentVehicleCategories = VehicleInfo.VehicleCategory.None;

if (allowBicycle || !prevIsRouted) {
// pedestrian to bicycle lane switch or no routing information available:
// if pedestrian lanes should be explored (allowBicycle == true): do this here
Expand Down Expand Up @@ -1733,6 +1773,7 @@ private struct BufferItem {
#endif
}

currentVehicleCategories |= (netManager.m_segments.m_buffer[nextSegmentId].Info.m_vehicleCategories & VehicleInfo.VehicleCategory.RoadTransport);
nextSegmentId = nextSegmentId.ToSegment().GetRightSegment(nextNodeId);
}
#if ROUTING
Expand Down Expand Up @@ -1874,6 +1915,14 @@ private struct BufferItem {
}
}
#endif
VehicleInfo.VehicleCategory segmentVehicleCategories = netManager.m_segments.m_buffer[item.Position.m_segment].Info.m_vehicleCategories & VehicleInfo.VehicleCategory.RoadTransport;
if (!prevIsRouted && (currentVehicleCategories & segmentVehicleCategories) != segmentVehicleCategories) {
DebugLog(
unitId,
item,
$"ProcessItemMain: Different segment vehicle categories. Force explore U-turn. Previous value: {exploreUturn}");
exploreUturn = true;
}

if (exploreUturn
&& (vehicleTypes_ & (VehicleInfo.VehicleType.Tram | VehicleInfo.VehicleType.Trolleybus)) == VehicleInfo.VehicleType.None)
Expand Down Expand Up @@ -1922,6 +1971,7 @@ private struct BufferItem {
item.Position.m_lane,
NetInfo.LaneType.Pedestrian,
vehicleTypes_,
vehicleCategory_,
out int nextLaneIndex,
out uint nextLaneId)) {
if (isLogEnabled) {
Expand Down Expand Up @@ -2141,7 +2191,7 @@ private struct BufferItem {
}

NetInfo.Lane nextLaneInfo = nextSegmentInfo.m_lanes[nextLaneIndex];
if (!nextLaneInfo.CheckType(laneTypes_, vehicleTypes_)) {
if (!nextLaneInfo.CheckType(laneTypes_, vehicleTypes_, vehicleCategory_)) {
return;
}

Expand Down Expand Up @@ -2460,11 +2510,13 @@ private struct BufferItem {
// float prevLaneSpeed = 1f; // stock code commented
NetInfo.LaneType prevLaneType = NetInfo.LaneType.None;
VehicleInfo.VehicleType prevVehicleType = VehicleInfo.VehicleType.None;
VehicleInfo.VehicleCategory prevVehicleCategory = VehicleInfo.VehicleCategory.None;

if (item.Position.m_lane < prevSegmentInfo.m_lanes.Length) {
NetInfo.Lane prevLaneInfo = prevSegmentInfo.m_lanes[item.Position.m_lane];
prevLaneType = prevLaneInfo.m_laneType;
prevVehicleType = prevLaneInfo.m_vehicleType;
prevVehicleCategory = prevLaneInfo.vehicleCategory;
// prevMaxSpeed = prevLaneInfo.m_speedLimit; // stock code commented
// prevLaneSpeed = CalculateLaneSpeed(prevMaxSpeed, connectOffset,
// item.Position.m_offset, ref prevSegment, prevLaneInfo); // stock code commented
Expand Down Expand Up @@ -2697,11 +2749,12 @@ private struct BufferItem {
}
#endif

var currentVehicleCategory = vehicleCategory_;
// NON-STOCK CODE END
for (; nextLaneIndex <= maxNextLaneIndex && nextLaneId != 0; nextLaneIndex++) {
NetInfo.Lane nextLaneInfo = nextSegmentInfo.m_lanes[nextLaneIndex];
if ((nextLaneInfo.m_finalDirection & nextFinalDir) != NetInfo.Direction.None) {
if (nextLaneInfo.CheckType(allowedLaneTypes, allowedVehicleTypes) &&
if (nextLaneInfo.CheckType(allowedLaneTypes, allowedVehicleTypes, currentVehicleCategory) &&
(nextSegmentId != item.Position.m_segment ||
nextLaneIndex != item.Position.m_lane)) {
if (acuteTurningAngle &&
Expand Down Expand Up @@ -3015,8 +3068,9 @@ private struct BufferItem {
#endif

if ((nextLaneInfo.m_laneType & prevLaneType) != NetInfo.LaneType.None &&
(nextLaneInfo.m_vehicleType & vehicleTypes_) !=
VehicleInfo.VehicleType.None) {
(nextLaneInfo.m_vehicleType & vehicleTypes_) != VehicleInfo.VehicleType.None &&
(nextLaneInfo.vehicleCategory & vehicleCategory_) != VehicleInfo.VehicleCategory.None) {

#if ADVANCEDAI && ROUTING
if (!enableAdvancedAI) {
#endif
Expand Down Expand Up @@ -3052,6 +3106,12 @@ private struct BufferItem {
}
}

if ((nextLaneInfo.vehicleCategory & VehicleInfo.VehicleCategory.PublicTransportRoad) != 0 &&
(nextLaneInfo.vehicleCategory & ~(VehicleInfo.VehicleCategory.Bus | VehicleInfo.VehicleCategory.Trolleybus | VehicleInfo.VehicleCategory.Taxi)) == 0)
{
nextItem.ComparisonValue /= 100f;
}

if (isLogEnabled) {
DebugLog(
unitId,
Expand Down Expand Up @@ -3096,8 +3156,8 @@ private struct BufferItem {
}

if ((nextLaneInfo.m_laneType & prevLaneType) != NetInfo.LaneType.None &&
(nextLaneInfo.m_vehicleType & prevVehicleType) !=
VehicleInfo.VehicleType.None) {
(nextLaneInfo.m_vehicleType & prevVehicleType) != VehicleInfo.VehicleType.None &&
(nextLaneInfo.vehicleCategory & prevVehicleCategory) != VehicleInfo.VehicleCategory.None) {
newLaneIndexFromInner++;
}
}
Expand Down Expand Up @@ -3309,7 +3369,7 @@ private struct BufferItem {
if ((nextLaneInfo.m_laneType & prevLaneType) == NetInfo.LaneType.None) {
nextItem.MethodDistance = 0f;
} else {
if (item.MethodDistance == 0f) { // TODO fixme: Float comparison to 0
if (FloatUtil.IsZero(item.MethodDistance)) {
comparisonValue += 100f / (0.25f * maxLength_);
}

Expand Down
3 changes: 3 additions & 0 deletions TLM/TLM/Custom/PathFinding/CustomPathManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ public class CustomPathManager : PathManager {
m_pathUnits.m_buffer[unit].m_position11 = args.vehiclePosition;
m_pathUnits.m_buffer[unit].m_laneTypes = (byte)args.laneTypes;
m_pathUnits.m_buffer[unit].m_vehicleTypes = (uint)args.vehicleTypes;
m_pathUnits.m_buffer[unit].m_vehicleCategories = (long)args.vehicleCategories;
m_pathUnits.m_buffer[unit].m_length = args.maxLength;
m_pathUnits.m_buffer[unit].m_positionCount = 20;

Expand Down Expand Up @@ -370,6 +371,7 @@ public class CustomPathManager : PathManager {
PathUnit.Position endPosA,
PathUnit.Position endPosB,
VehicleInfo.VehicleType vehicleType,
VehicleInfo.VehicleCategory vehicleCategory,
bool skipQueue) {

PathCreationArgs args = new PathCreationArgs {
Expand All @@ -384,6 +386,7 @@ public class CustomPathManager : PathManager {
endPosB = endPosB,
vehiclePosition = default,
vehicleTypes = vehicleType,
vehicleCategories = vehicleCategory,
isHeavyVehicle = false,
hasCombustionEngine = false,
ignoreBlocked = true,
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/Custom/PathFinding/PathfinderUpdates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class PathfinderUpdates {
/// vehicle despawning.
/// </summary>
[SuppressMessage("Usage", "RAS0002:Readonly field for a non-readonly struct", Justification = "Not performance critical.")]
private static readonly byte LatestPathfinderEdition = 1;
internal static readonly byte LatestPathfinderEdition = 1;

/// <summary>
/// Checks savegame pathfinder edition and, if necessary, despawns
Expand Down

0 comments on commit 30ed1e8

Please sign in to comment.