Skip to content

Commit

Permalink
Merge pull request #1465 from CitiesSkylinesMods/bugfix/configuration…
Browse files Browse the repository at this point in the history
…-version

Hotfix for 11.6.5.1 before release
  • Loading branch information
krzychu124 committed Mar 13, 2022
2 parents c08ef13 + ee7dbfa commit 1676cb7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This changelog includes all versions and major variants of the mod going all the
#### TM:PE V11.6.5.1 TEST, 13/03/2022

- [Meta] This update adds two new features, overhauls mod options code, and improves modding API.
- [New] `Disable Despawn` feature now has vehicle-type filters #1441 #1434 (Marconius6, lokpro, krzychu124)
- [New] `Disable Despawn` feature now has vehicle-type filters #1465 #1441 #1434 (Marconius6, lokpro, krzychu124)
- [New] Timed Traffic Lights now available in Map and Scenario editors #1425 #959 (aubergine18)
- [Mod] API: Mods can now use TMPE.API.dll alone, without referencing TrafficManager.dll #1448 (kianzarrin)
- [Mod] API: TM:PE Harmony ID changed from `de.viathinksoft.tmpe` to `me.tmpe` #1456 #897 (krzychu124)
Expand All @@ -53,9 +53,10 @@ This changelog includes all versions and major variants of the mod going all the
- [Updated] Improved mod option lifecycle for game/editors #1452 #1449 #1425 (aubergine18)
- [Updated] Extension for managed-type `vehicleId` to `ExtVehicleType` #1444 (aubergine18)
- [Updated] Simplify Harmony patching for Reversible Tram AI #1457 (kianzarrin)
- [Updated] Un-invert `Options.disableDespawning` data byte (aubergine18, kianzarrin)
- [Updated] Un-invert `Options.disableDespawning` data byte #1465 #1463 (aubergine18, kianzarrin, krzychu124)
- [Updated] `MayPublishSegmentChanges()` moved to `TMPELifecycle`; API unaffected #1432 (aubergine18)
- [Updated] `Buses may ignore lane arrows` enabled by default when starting new city #1455 (aubergine18)
- [Updated] Missing translations show trimmed locale key in `TEST` builds too #1465 (krzychu124)
- [Removed] Obsolete gamebridge stuff from build script #1436 (aubergine18)
- [Removed] "Apply AI changes right away" option; changes always applied immediately now #1432 (aubergine18, kvakvs)
- [Steam] [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#### TM:PE V11.6.5.1 TEST, 13/03/2022

- [Meta] This update adds two new features, overhauls mod options code, and improves modding API.
- [New] `Disable Despawn` feature now has vehicle-type filters #1441 #1434 (Marconius6, lokpro, krzychu124)
- [New] `Disable Despawn` feature now has vehicle-type filters #1465 #1441 #1434 (Marconius6, lokpro, krzychu124)
- [New] Timed Traffic Lights now available in Map and Scenario editors #1425 #959 (aubergine18)
- [Mod] API: Mods can now use TMPE.API.dll alone, without referencing TrafficManager.dll #1448 (kianzarrin)
- [Mod] API: TM:PE Harmony ID changed from `de.viathinksoft.tmpe` to `me.tmpe` #1456 #897 (krzychu124)
Expand All @@ -65,9 +65,10 @@
- [Updated] Improved mod option lifecycle for game/editors #1452 #1449 #1425 (aubergine18)
- [Updated] Extension for managed-type `vehicleId` to `ExtVehicleType` #1444 (aubergine18)
- [Updated] Simplify Harmony patching for Reversible Tram AI #1457 (kianzarrin)
- [Updated] Un-invert `Options.disableDespawning` data byte (aubergine18, kianzarrin)
- [Updated] Un-invert `Options.disableDespawning` data byte #1465 #1463 (aubergine18, kianzarrin, krzychu124)
- [Updated] `MayPublishSegmentChanges()` moved to `TMPELifecycle`; API unaffected #1432 (aubergine18)
- [Updated] `Buses may ignore lane arrows` enabled by default when starting new city #1455 (aubergine18)
- [Updated] Missing translations show trimmed locale key in `TEST` builds too #1465 (krzychu124)
- [Removed] Obsolete gamebridge stuff from build script #1436 (aubergine18)
- [Removed] "Apply AI changes right away" option; changes always applied immediately now #1432 (aubergine18, kvakvs)
- [Steam] [TM:PE v11 TEST](https://steamcommunity.com/sharedfiles/filedetails/?id=2489276785)
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/Lifecycle/SerializableDataExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace TrafficManager.Lifecycle {
public class SerializableDataExtension
: SerializableDataExtensionBase
{
public static int Version => _configuration.Version;
public static int Version => _configuration?.Version ?? Configuration.CURRENT_VERSION;

private const string DATA_ID = "TrafficManager_v1.0";
private const string VERSION_INFO_DATA_ID = "TrafficManager_VersionInfo_v1.0";
Expand Down
5 changes: 3 additions & 2 deletions TLM/TLM/Resources/whats_new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[Released] March 13th 2022
[Link] tmpe-v11651-test-13032022
[Meta] This update adds two new features, overhauls mod options code, and improves modding API.
[New] `Disable Despawn` feature now has vehicle-type filters #1441 #1434 (Marconius6, lokpro, krzychu124)
[New] `Disable Despawn` feature now has vehicle-type filters #1465 #1441 #1434 (Marconius6, lokpro, krzychu124)
[New] Timed Traffic Lights now available in Map and Scenario editors #1425 #959 (aubergine18)
[Mod] API: Mods can now use TMPE.API.dll alone, without referencing TrafficManager.dll #1448 (kianzarrin)
[Mod] API: TM:PE Harmony ID changed from `de.viathinksoft.tmpe` to `me.tmpe` #1456 #897 (krzychu124)
Expand All @@ -23,9 +23,10 @@
[Updated] Improved mod option lifecycle for game/editors #1452 #1449 #1425 (aubergine18)
[Updated] Extension for managed-type `vehicleId` to `ExtVehicleType` #1444 (aubergine18)
[Updated] Simplify Harmony patching for Reversible Tram AI #1457 (kianzarrin)
[Updated] Un-invert `Options.disableDespawning` data byte (aubergine18, kianzarrin)
[Updated] Un-invert `Options.disableDespawning` data byte #1465 #1463 (aubergine18, kianzarrin, krzychu124)
[Updated] `MayPublishSegmentChanges()` moved to `TMPELifecycle`; API unaffected #1432 (aubergine18)
[Updated] `Buses may ignore lane arrows` enabled by default when starting new city #1455 (aubergine18)
[Updated] Missing translations show trimmed locale key in `TEST` builds too #1465 (krzychu124)
[Removed] Obsolete gamebridge stuff from build script #1436 (aubergine18)
[Removed] "Apply AI changes right away" option; changes always applied immediately now #1432 (aubergine18, kvakvs)
[/Version]
Expand Down
29 changes: 15 additions & 14 deletions TLM/TLM/UI/Localization/LookupTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,24 @@ public class LookupTable {
}
#endif

// Try find translation in the current language first
if (AllLanguages[lang].TryGetValue(key, out string ret))
{
// Current language
if (AllLanguages[lang].TryGetValue(key, out string ret)) {
return ret;
}

// If not found, try also get translation in the default English
// Untranslated keys are prefixed with ¶ in TEST & DEBUG builds;
// in STABLE builds prefix (upto and including `:`) is trimmed.
return AllLanguages[Translation.DEFAULT_LANGUAGE_CODE]
.TryGetValue(key, out string ret2)
? ret2
: (VersionUtil.BRANCH != "STABLE")
? "" + key
: key.IndexOf(":") > 0
? key.Substring(key.IndexOf(":") + 1)
: key;
// Default language
if (AllLanguages[Translation.DEFAULT_LANGUAGE_CODE].TryGetValue(key, out string ret2)) {
return ret2;
}

#if DEBUG
// Prefixed locale key
return "" + key;
#else
// Trimmed locale key
int pos = key.IndexOf(":");
return pos > 0 ? key.Substring(pos + 1) : key;
#endif
}

public bool HasString(string key) {
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/UI/MainMenu/DespawnButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class DespawnButton : BaseMenuButton {
/// </summary>
/// <param name="p"></param>
protected override void OnMouseDown(UIMouseEventParameter p) {
if ((p.buttons & UIMouseButton.Right) != 0) {
if ((p.buttons & UIMouseButton.Right) != 0 && Options.disableDespawning) {
p.Use();
UIInput.MouseUsed();
AllowDespawn.AllowDespawningPanel.OpenModal();
Expand Down

0 comments on commit 1676cb7

Please sign in to comment.