Skip to content

Commit de4f2f0

Browse files
authored
Merge pull request #266 from CitiesSkylinesMultiplayer/fix-airport-update
Fix compilation/patching issues from the airport update
2 parents c779a04 + 48d9972 commit de4f2f0

File tree

5 files changed

+15
-40
lines changed

5 files changed

+15
-40
lines changed

src/Commands/Data/TransportLines/TransportLineChangeVehicleCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public class TransportLineChangeVehicleCommand : CommandBase
2020
/// The prefab info index of the new vehicle.
2121
/// </summary>
2222
[ProtoMember(2)]
23-
public uint Vehicle;
23+
public uint? Vehicle;
2424
}
2525
}

src/Commands/Handler/TransportLines/TransportLineChangeVehicleHandler.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ protected override void Handle(TransportLineChangeVehicleCommand command)
1111

1212
// Use ref because otherwise the TransportLine struct(!) would be copied
1313
ref TransportLine line = ref TransportManager.instance.m_lines.m_buffer[command.LineId];
14-
VehicleInfo vehicle = PrefabCollection<VehicleInfo>.GetPrefab(command.Vehicle);
14+
15+
VehicleInfo vehicle = null;
16+
if (command.Vehicle.HasValue) {
17+
vehicle = PrefabCollection<VehicleInfo>.GetPrefab(command.Vehicle.Value);
18+
}
1519

1620
ReflectionHelper.Call(line, "ReplaceVehicles", command.LineId, vehicle);
1721

src/Helpers/DLCHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ public static class DLCHelper
66
SteamHelper.DLC_BitMask.RadioStation2 |
77
SteamHelper.DLC_BitMask.RadioStation3 |
88
SteamHelper.DLC_BitMask.RadioStation4 |
9-
SteamHelper.DLC_BitMask.RadioStation5 |
10-
SteamHelper.DLC_BitMask.RadioStation6 |
11-
SteamHelper.DLC_BitMask.RadioStation7;
9+
SteamHelper.DLC_BitMask.RadioStation5;
10+
// Only need to check 1 - 5 as others are
11+
// in BitMask2 which we ignore completely.
1212

1313
private static SteamHelper.DLC_BitMask RemoveRadioStations(SteamHelper.DLC_BitMask bitmask)
1414
{

src/Injections/TransportHandler.cs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -763,25 +763,13 @@ public static void Prefix(bool day, bool night)
763763
[HarmonyPatch("ReplaceVehicles")]
764764
public class ReplaceVehicles
765765
{
766-
public static VehicleInfo randomGen = null;
767-
768-
public static void Prefix()
769-
{
770-
randomGen = null;
771-
}
772-
773766
public static void Postfix(ushort lineID, VehicleInfo info)
774767
{
775768
if (IgnoreHelper.IsIgnored())
776769
return;
777770

778-
if (info == null)
779-
{
780-
if (randomGen == null)
781-
return;
782-
783-
info = randomGen;
784-
}
771+
// TODO: When info is null, random vehicle gets generated on spawn
772+
// To be in sync, we need to sync the randomization!
785773

786774
Command.SendToAll(new TransportLineChangeVehicleCommand()
787775
{
@@ -790,14 +778,4 @@ public static void Postfix(ushort lineID, VehicleInfo info)
790778
});
791779
}
792780
}
793-
794-
[HarmonyPatch(typeof(TransportLine))]
795-
[HarmonyPatch("GetRandomVehicleInfo")]
796-
public class GetRandomVehicleInfo
797-
{
798-
public static void Postfix(VehicleInfo __result)
799-
{
800-
ReplaceVehicles.randomGen = __result;
801-
}
802-
}
803781
}

src/Panels/MessagePanel.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,11 @@ public void DisplayReleaseNotes()
129129
Version version = Assembly.GetAssembly(typeof(CSM)).GetName().Version;
130130

131131
string message = $"Version {version.Major}.{version.Minor}\n" +
132-
$"Last Update: April 4, 2021\n\n" +
133-
"- UI Changes:\n" +
134-
" - The Chirper is now used as the chat\n" +
135-
" (The old chat can still be enabled in the settings)\n" +
136-
" - The multiplayer menu can now be found\n" +
137-
" in the pause menu\n" +
138-
" - Added this release notes panel\n\n" +
132+
$"Last Update: January 28th, 2022\n\n" +
139133
"- Fixes:\n" +
140-
" - Tried to fix issue with not being able to change\n" +
141-
" the speed or pause state (Please tell us on Discord\n" +
142-
" if the problems are now solved for you!).\n";
143-
134+
" - Support Airports Update. Note\n" +
135+
" that not all new features are" +
136+
" supported for now!\n";
144137
SetMessage(message);
145138

146139
Show(true);

0 commit comments

Comments
 (0)