Skip to content

Commit

Permalink
changed options defautls.
Browse files Browse the repository at this point in the history
fixed option serialization.
  • Loading branch information
kianzarrin committed Apr 30, 2020
1 parent 3bf8c9f commit 7b98e0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
17 changes: 13 additions & 4 deletions TLM/TLM/Manager/Impl/OptionsManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TrafficManager.Manager.Impl {
namespace TrafficManager.Manager.Impl {
using CSUtil.Commons;
using System;
using TrafficManager.API.Manager;
Expand All @@ -8,8 +8,7 @@

public class OptionsManager
: AbstractCustomManager,
IOptionsManager
{
IOptionsManager {
// TODO I contain ugly code
public static OptionsManager Instance = new OptionsManager();

Expand Down Expand Up @@ -216,7 +215,7 @@ public bool LoadData(byte[] data) {
OptionsVehicleRestrictionsTab.SetAddTrafficLightsIfApplicable(data[41] == 1);
}

int LoadBool (int idx, ILegacySerializableOption opt) {
int LoadBool(int idx, ILegacySerializableOption opt) {
if (data.Length > idx) {
opt.Load(data[idx]);
}
Expand All @@ -236,6 +235,11 @@ int LoadBool (int idx, ILegacySerializableOption opt) {
index = LoadBool(index, OptionsMassEditTab.PriorityRoad_EnterBlockedYeild);
index = LoadBool(index, OptionsMassEditTab.PriorityRoad_StopAtEntry);

index = LoadBool(index, OptionsMassEditTab.RoundAboutQuickFix_KeepClearYieldR);
index = LoadBool(index, OptionsMassEditTab.RoundAboutQuickFix_RealisticSpeedLimits);
index = LoadBool(index, OptionsMassEditTab.RoundAboutQuickFix_ParkingBanMainR);
index = LoadBool(index, OptionsMassEditTab.RoundAboutQuickFix_ParkingBanYieldR);

return true;
}

Expand Down Expand Up @@ -295,6 +299,11 @@ public byte[] SaveData(ref bool success) {
(byte)(OptionsMassEditTab.PriorityRoad_AllowLeftTurns.Save()),
(byte)(OptionsMassEditTab.PriorityRoad_EnterBlockedYeild.Save()),
(byte)(OptionsMassEditTab.PriorityRoad_StopAtEntry.Save()),

(byte)(OptionsMassEditTab.RoundAboutQuickFix_KeepClearYieldR.Save()),
(byte)(OptionsMassEditTab.RoundAboutQuickFix_RealisticSpeedLimits.Save()),
(byte)(OptionsMassEditTab.RoundAboutQuickFix_ParkingBanMainR.Save()),
(byte)(OptionsMassEditTab.RoundAboutQuickFix_ParkingBanYieldR.Save()),
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/State/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class Options : MonoBehaviour {
public static bool RoundAboutQuickFix_KeepClearYieldR = true;
public static bool RoundAboutQuickFix_RealisticSpeedLimits = false;
public static bool RoundAboutQuickFix_ParkingBanMainR = true;
public static bool RoundAboutQuickFix_ParkingBanYieldR = true;
public static bool RoundAboutQuickFix_ParkingBanYieldR = false;
public static bool PriorityRoad_CrossMainR = false;
public static bool PriorityRoad_AllowLeftTurns = false;
public static bool PriorityRoad_EnterBlockedYeild = false;
Expand Down
6 changes: 3 additions & 3 deletions TLM/TLM/State/OptionsTabs/OptionsMassEditTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public static class OptionsMassEditTab {

public static CheckboxOption RoundAboutQuickFix_KeepClearYieldR =
new CheckboxOption("RoundAboutQuickFix_KeepClearYieldR") {
Label = "Roundabout.Option:Keep Clear of roundabout.",
Tooltip = "Roundabout.Tooltip:Enter blocked roundabout",
Label = "Roundabout.Option:Keep clear of roundabout for yield road",
Tooltip = "Roundabout.Tooltip:Keep clear of roundabout for yield road",
};

public static CheckboxOption RoundAboutQuickFix_RealisticSpeedLimits =
Expand All @@ -56,7 +56,7 @@ public static class OptionsMassEditTab {

public static CheckboxOption RoundAboutQuickFix_ParkingBanYieldR =
new CheckboxOption("RoundAboutQuickFix_ParkingBanYieldR") {
Label = "Roundabout.Option:Put parking ban on connecting segments",
Label = "Roundabout.Option:Put parking ban on roundabout branches",
};

#endregion
Expand Down

0 comments on commit 7b98e0f

Please sign in to comment.