Skip to content

Commit

Permalink
Merge pull request #266 from CitiesSkylinesMultiplayer/fix-airport-up…
Browse files Browse the repository at this point in the history
…date

Fix compilation/patching issues from the airport update
  • Loading branch information
DominicMaas authored Jan 28, 2022
2 parents c779a04 + 48d9972 commit de4f2f0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public class TransportLineChangeVehicleCommand : CommandBase
/// The prefab info index of the new vehicle.
/// </summary>
[ProtoMember(2)]
public uint Vehicle;
public uint? Vehicle;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ protected override void Handle(TransportLineChangeVehicleCommand command)

// Use ref because otherwise the TransportLine struct(!) would be copied
ref TransportLine line = ref TransportManager.instance.m_lines.m_buffer[command.LineId];
VehicleInfo vehicle = PrefabCollection<VehicleInfo>.GetPrefab(command.Vehicle);

VehicleInfo vehicle = null;
if (command.Vehicle.HasValue) {
vehicle = PrefabCollection<VehicleInfo>.GetPrefab(command.Vehicle.Value);
}

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

Expand Down
6 changes: 3 additions & 3 deletions src/Helpers/DLCHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ public static class DLCHelper
SteamHelper.DLC_BitMask.RadioStation2 |
SteamHelper.DLC_BitMask.RadioStation3 |
SteamHelper.DLC_BitMask.RadioStation4 |
SteamHelper.DLC_BitMask.RadioStation5 |
SteamHelper.DLC_BitMask.RadioStation6 |
SteamHelper.DLC_BitMask.RadioStation7;
SteamHelper.DLC_BitMask.RadioStation5;
// Only need to check 1 - 5 as others are
// in BitMask2 which we ignore completely.

private static SteamHelper.DLC_BitMask RemoveRadioStations(SteamHelper.DLC_BitMask bitmask)
{
Expand Down
26 changes: 2 additions & 24 deletions src/Injections/TransportHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -763,25 +763,13 @@ public static void Prefix(bool day, bool night)
[HarmonyPatch("ReplaceVehicles")]
public class ReplaceVehicles
{
public static VehicleInfo randomGen = null;

public static void Prefix()
{
randomGen = null;
}

public static void Postfix(ushort lineID, VehicleInfo info)
{
if (IgnoreHelper.IsIgnored())
return;

if (info == null)
{
if (randomGen == null)
return;

info = randomGen;
}
// TODO: When info is null, random vehicle gets generated on spawn
// To be in sync, we need to sync the randomization!

Command.SendToAll(new TransportLineChangeVehicleCommand()
{
Expand All @@ -790,14 +778,4 @@ public static void Postfix(ushort lineID, VehicleInfo info)
});
}
}

[HarmonyPatch(typeof(TransportLine))]
[HarmonyPatch("GetRandomVehicleInfo")]
public class GetRandomVehicleInfo
{
public static void Postfix(VehicleInfo __result)
{
ReplaceVehicles.randomGen = __result;
}
}
}
15 changes: 4 additions & 11 deletions src/Panels/MessagePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,11 @@ public void DisplayReleaseNotes()
Version version = Assembly.GetAssembly(typeof(CSM)).GetName().Version;

string message = $"Version {version.Major}.{version.Minor}\n" +
$"Last Update: April 4, 2021\n\n" +
"- UI Changes:\n" +
" - The Chirper is now used as the chat\n" +
" (The old chat can still be enabled in the settings)\n" +
" - The multiplayer menu can now be found\n" +
" in the pause menu\n" +
" - Added this release notes panel\n\n" +
$"Last Update: January 28th, 2022\n\n" +
"- Fixes:\n" +
" - Tried to fix issue with not being able to change\n" +
" the speed or pause state (Please tell us on Discord\n" +
" if the problems are now solved for you!).\n";

" - Support Airports Update. Note\n" +
" that not all new features are" +
" supported for now!\n";
SetMessage(message);

Show(true);
Expand Down

0 comments on commit de4f2f0

Please sign in to comment.