Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
v13.5.0r10000
Browse files Browse the repository at this point in the history
Downgrade to C#7.x
  • Loading branch information
klyte45 committed Mar 17, 2021
1 parent 94aab9a commit 6d7459a
Show file tree
Hide file tree
Showing 19 changed files with 285 additions and 220 deletions.
8 changes: 4 additions & 4 deletions CommonsWindow/List/Components/UVMLineListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,13 @@ public void ChangeLineVisibility(bool r)
{
if (r)
{
TransportLine[] expr_2A_cp_0 = Singleton<TransportManager>.instance.m_lines.m_buffer;
ref TransportLine[] expr_2A_cp_0 = ref Singleton<TransportManager>.instance.m_lines.m_buffer;
ushort expr_2A_cp_1 = m_lineID;
expr_2A_cp_0[expr_2A_cp_1].m_flags = (expr_2A_cp_0[expr_2A_cp_1].m_flags & ~TransportLine.Flags.Hidden);
}
else
{
TransportLine[] expr_5C_cp_0 = Singleton<TransportManager>.instance.m_lines.m_buffer;
ref TransportLine[] expr_5C_cp_0 = ref Singleton<TransportManager>.instance.m_lines.m_buffer;
ushort expr_5C_cp_1 = m_lineID;
expr_5C_cp_0[expr_5C_cp_1].m_flags = (expr_5C_cp_0[expr_5C_cp_1].m_flags | TransportLine.Flags.Hidden);
}
Expand All @@ -447,7 +447,7 @@ private void OnMouseEnter(UIComponent comp, UIMouseEventParameter param)
{
if ((Singleton<TransportManager>.instance.m_lines.m_buffer[m_lineID].m_flags & TransportLine.Flags.Created) != TransportLine.Flags.None)
{
TransportLine[] expr_40_cp_0 = Singleton<TransportManager>.instance.m_lines.m_buffer;
ref TransportLine[] expr_40_cp_0 = ref Singleton<TransportManager>.instance.m_lines.m_buffer;
ushort expr_40_cp_1 = m_lineID;
expr_40_cp_0[expr_40_cp_1].m_flags = (expr_40_cp_0[expr_40_cp_1].m_flags | TransportLine.Flags.Highlighted);
}
Expand All @@ -467,7 +467,7 @@ private void OnMouseLeave(UIComponent comp, UIMouseEventParameter param)
{
if ((Singleton<TransportManager>.instance.m_lines.m_buffer[m_lineID].m_flags & TransportLine.Flags.Created) != TransportLine.Flags.None)
{
TransportLine[] expr_40_cp_0 = Singleton<TransportManager>.instance.m_lines.m_buffer;
ref TransportLine[] expr_40_cp_0 = ref Singleton<TransportManager>.instance.m_lines.m_buffer;
ushort expr_40_cp_1 = m_lineID;
expr_40_cp_0[expr_40_cp_1].m_flags = (expr_40_cp_0[expr_40_cp_1].m_flags & ~TransportLine.Flags.Highlighted);
}
Expand Down
28 changes: 14 additions & 14 deletions Extensors/GameServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ public static TLMConfigWarehouse.ConfigIndex ToConfigIndex(ItemClass.Service s,
case ItemClass.Service.FireDepartment:
return TLMConfigWarehouse.ConfigIndex.FIREDEPARTMENT_SERVICE_CONFIG;
case ItemClass.Service.PublicTransport:
return ss switch
switch (ss)
{
ItemClass.SubService.PublicTransportBus => TLMConfigWarehouse.ConfigIndex.BUS_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportCableCar => TLMConfigWarehouse.ConfigIndex.CABLE_CAR_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportMetro => TLMConfigWarehouse.ConfigIndex.METRO_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportMonorail => TLMConfigWarehouse.ConfigIndex.MONORAIL_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportPlane => TLMConfigWarehouse.ConfigIndex.PLANE_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportShip => TLMConfigWarehouse.ConfigIndex.SHIP_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportTaxi => TLMConfigWarehouse.ConfigIndex.TAXI_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportTours => TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportTrain => TLMConfigWarehouse.ConfigIndex.TRAIN_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportTram => TLMConfigWarehouse.ConfigIndex.TRAM_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
ItemClass.SubService.PublicTransportTrolleybus => TLMConfigWarehouse.ConfigIndex.TROLLEY_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
_ => TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG,
};
case ItemClass.SubService.PublicTransportBus: return TLMConfigWarehouse.ConfigIndex.BUS_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportCableCar: return TLMConfigWarehouse.ConfigIndex.CABLE_CAR_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportMetro: return TLMConfigWarehouse.ConfigIndex.METRO_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportMonorail: return TLMConfigWarehouse.ConfigIndex.MONORAIL_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportPlane: return TLMConfigWarehouse.ConfigIndex.PLANE_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportShip: return TLMConfigWarehouse.ConfigIndex.SHIP_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportTaxi: return TLMConfigWarehouse.ConfigIndex.TAXI_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportTours: return TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportTrain: return TLMConfigWarehouse.ConfigIndex.TRAIN_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportTram: return TLMConfigWarehouse.ConfigIndex.TRAM_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
case ItemClass.SubService.PublicTransportTrolleybus: return TLMConfigWarehouse.ConfigIndex.TROLLEY_CONFIG | TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
default: return TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_SERVICE_CONFIG;
}
case ItemClass.Service.Disaster:
return TLMConfigWarehouse.ConfigIndex.DISASTER_SERVICE_CONFIG;
case ItemClass.Service.PlayerIndustry:
Expand Down
106 changes: 54 additions & 52 deletions Extensors/TransportLineStorageBasicData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,40 @@ public IDataExtensor Deserialize(Type type, byte[] rawData)
maxVehicles = 16384;
}

using var s = new MemoryStream(data);
long version = ReadLong(s);
foreach (Enum e in LoadOrder)
using (var s = new MemoryStream(data))
{
if (version >= GetMinVersion(e))
long version = ReadLong(s);
foreach (Enum e in LoadOrder)
{
var isVehicleData = IsVehicleEnum(e);
TLMTransportLineStatusesManager.instance.DoWithArray(e, (ref long[][] arrayRef) =>
if (version >= GetMinVersion(e))
{
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);

for (int i = 0; i < (isVehicleData ? maxVehicles : arrayRef.Length); i++)
var isVehicleData = IsVehicleEnum(e);
TLMTransportLineStatusesManager.instance.DoWithArray(e, (ref long[][] arrayRef) =>
{
arrayRef[i][idx] = DeserializeFunction(s);
}
}, (ref int[][] arrayRef) =>
{
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);

for (int i = 0; i < (isVehicleData ? maxVehicles : arrayRef.Length); i++)
for (int i = 0; i < (isVehicleData ? maxVehicles : arrayRef.Length); i++)
{
arrayRef[i][idx] = DeserializeFunction(s);
}
}, (ref int[][] arrayRef) =>
{
arrayRef[i][idx] = (int)DeserializeFunction(s);
}
}, (ref ushort[][] arrayRef) =>
{
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);

for (int i = 0; i < (isVehicleData ? maxVehicles : arrayRef.Length); i++)
for (int i = 0; i < (isVehicleData ? maxVehicles : arrayRef.Length); i++)
{
arrayRef[i][idx] = (int)DeserializeFunction(s);
}
}, (ref ushort[][] arrayRef) =>
{
arrayRef[i][idx] = (ushort)DeserializeFunction(s);
}
});
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);

for (int i = 0; i < (isVehicleData ? maxVehicles : arrayRef.Length); i++)
{
arrayRef[i][idx] = (ushort)DeserializeFunction(s);
}
});
}
}
}
return this;
Expand All @@ -86,41 +88,41 @@ private bool IsVehicleEnum(Enum e)

public byte[] Serialize()
{
using var s = new MemoryStream();

WriteLong(s, CURRENT_VERSION);


foreach (Enum e in LoadOrder)
using (var s = new MemoryStream())
{
TLMTransportLineStatusesManager.instance.DoWithArray(e, (ref long[][] arrayRef) =>

WriteLong(s, CURRENT_VERSION);
foreach (Enum e in LoadOrder)
{
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
for (int i = 0; i < arrayRef.Length; i++)
TLMTransportLineStatusesManager.instance.DoWithArray(e, (ref long[][] arrayRef) =>
{
SerializeFunction(s, arrayRef[i][idx]);
}
LogUtils.DoWarnLog($"idxs= {arrayRef.Length};byte[] size: {s.Length} ({e.GetType()} {e})");
}, (ref int[][] arrayRef) =>
{
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
for (int i = 0; i < arrayRef.Length; i++)
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
for (int i = 0; i < arrayRef.Length; i++)
{
SerializeFunction(s, arrayRef[i][idx]);
}
LogUtils.DoWarnLog($"idxs= {arrayRef.Length};byte[] size: {s.Length} ({e.GetType()} {e})");
}, (ref int[][] arrayRef) =>
{
SerializeFunction(s, arrayRef[i][idx]);
}
LogUtils.DoWarnLog($"idxs= {arrayRef.Length};byte[] size: {s.Length} ({e.GetType()} {e})");
}, (ref ushort[][] arrayRef) =>
{
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
for (int i = 0; i < arrayRef.Length; i++)
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
for (int i = 0; i < arrayRef.Length; i++)
{
SerializeFunction(s, arrayRef[i][idx]);
}
LogUtils.DoWarnLog($"idxs= {arrayRef.Length};byte[] size: {s.Length} ({e.GetType()} {e})");
}, (ref ushort[][] arrayRef) =>
{
SerializeFunction(s, arrayRef[i][idx]);
}
LogUtils.DoWarnLog($"idxs= {arrayRef.Length}; byte[] size: {s.Length} ({e.GetType()} {e})");
});
int idx = TLMTransportLineStatusesManager.instance.GetIdxFor(e);
for (int i = 0; i < arrayRef.Length; i++)
{
SerializeFunction(s, arrayRef[i][idx]);
}
LogUtils.DoWarnLog($"idxs= {arrayRef.Length}; byte[] size: {s.Length} ({e.GetType()} {e})");
});

}
return (s.ToArray());
}
return (s.ToArray());
}
protected static void WriteLong(Stream s, long value)
{
Expand Down
16 changes: 8 additions & 8 deletions Extensors/TransportSystemDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ public bool IsPrefixable()

public string GetTransportTypeIcon()
{
return TransportType switch
switch (TransportType)
{
TransportInfo.TransportType.EvacuationBus => "SubBarFireDepartmentDisaster",
TransportInfo.TransportType.Pedestrian => "SubBarPublicTransportWalkingTours",
TransportInfo.TransportType.TouristBus => "SubBarPublicTransportTours",
TransportInfo.TransportType.HotAirBalloon => "IconBalloonTours",
TransportInfo.TransportType.Post => "SubBarPublicTransportPost",
TransportInfo.TransportType.CableCar => PublicTransportWorldInfoPanel.GetVehicleTypeIcon(TransportInfo.TransportType.EvacuationBus),
case TransportInfo.TransportType.EvacuationBus: return "SubBarFireDepartmentDisaster";
case TransportInfo.TransportType.Pedestrian: return "SubBarPublicTransportWalkingTours";
case TransportInfo.TransportType.TouristBus: return "SubBarPublicTransportTours";
case TransportInfo.TransportType.HotAirBalloon: return "IconBalloonTours";
case TransportInfo.TransportType.Post: return "SubBarPublicTransportPost";
case TransportInfo.TransportType.CableCar: return PublicTransportWorldInfoPanel.GetVehicleTypeIcon(TransportInfo.TransportType.EvacuationBus);
//case TransportInfo.TransportType.Ship:
//case TransportInfo.TransportType.Airplane:
//case TransportInfo.TransportType.Bus:
Expand All @@ -195,7 +195,7 @@ public string GetTransportTypeIcon()
//case TransportInfo.TransportType.Taxi:
//case TransportInfo.TransportType.Tram:
//case TransportInfo.TransportType.Monorail:
_ => PublicTransportWorldInfoPanel.GetVehicleTypeIcon(TransportType),
default: return PublicTransportWorldInfoPanel.GetVehicleTypeIcon(TransportType);
};
}

Expand Down
2 changes: 1 addition & 1 deletion Interfaces/ExtensionInterfaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface ITicketPriceExtension : ISafeGettable<ITicketPriceStorage>, ILi

public interface ITicketPriceStorage
{
public TimeableList<TicketPriceEntryXml> TicketPriceEntries { get; set; }
TimeableList<TicketPriceEntryXml> TicketPriceEntries { get; set; }
}

public interface IAssetSelectorExtension : ISafeGettable<IAssetSelectorStorage>, ILineNumberToIndexable
Expand Down
12 changes: 6 additions & 6 deletions Interfaces/ITLMTransportTypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ public interface ITLMTransportTypeExtension :
ISafeGettable<TLMPrefixConfiguration>
{
#region Use Color For Model
public bool IsUsingColorForModel(uint prefix);
bool IsUsingColorForModel(uint prefix);

public void SetUsingColorForModel(uint prefix, bool value);
void SetUsingColorForModel(uint prefix, bool value);
#endregion

#region Custom Palette
public string GetCustomPalette(uint prefix);
string GetCustomPalette(uint prefix);

public void SetCustomPalette(uint prefix, string paletteName);
void SetCustomPalette(uint prefix, string paletteName);

#endregion

#region Custom Format
public LineIconSpriteNames GetCustomFormat(uint prefix);
LineIconSpriteNames GetCustomFormat(uint prefix);

public void SetCustomFormat(uint prefix, LineIconSpriteNames icon);
void SetCustomFormat(uint prefix, LineIconSpriteNames icon);

#endregion

Expand Down
6 changes: 3 additions & 3 deletions LegacyWarehouse/ConfigWarehouseBaseLegacy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ internal class TLMConfigWarehouseLegacy : ConfigWarehouseBaseLegacy<TLMConfigWar

public override int getDefaultIntValueForProperty(ConfigIndex i)
{
return i switch
switch (i)
{
_ => 0,
};
default: return 0;
}
}

}
Expand Down
Loading

0 comments on commit 6d7459a

Please sign in to comment.