Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename OptionsVehicleRestrictionsTab -> PoliciesTab #1371

Merged
merged 3 commits into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TLM/TLM/Manager/Impl/JunctionRestrictionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ public bool GetDefaultPedestrianCrossingAllowed(ushort segmentId, bool startNode
return true;
}

if (OptionsVehicleRestrictionsTab.NoDoubleCrossings &&
if (PoliciesTab.NoDoubleCrossings &&
node.m_flags.IsFlagSet(NetNode.Flags.Junction) &&
!node.m_flags.IsFlagSet(NetNode.Flags.Untouchable) &&
node.CountSegments() == 2) {
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/Manager/Impl/LaneArrowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private void ApplyFlags() {

public override void OnLevelLoading() {
base.OnLevelLoading();
if (OptionsVehicleRestrictionsTab.DedicatedTurningLanes) {
if (PoliciesTab.DedicatedTurningLanes) {
// update dedicated turning lanes after patch has been applied.
UpdateDedicatedTurningLanePolicy(false);
}
Expand Down
38 changes: 19 additions & 19 deletions TLM/TLM/Manager/Impl/OptionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,42 +79,42 @@ public bool LoadData(byte[] data) {
OptionsGeneralTab.SetSimulationAccuracy(ConvertToSimulationAccuracy(LoadByte(data, idx: 0)));
// skip Options.setLaneChangingRandomization(options[1]);
OptionsGameplayTab.SetRecklessDrivers(LoadByte(data, idx: 2));
OptionsVehicleRestrictionsTab.SetRelaxedBusses(LoadBool(data, idx: 3));
PoliciesTab.SetRelaxedBusses(LoadBool(data, idx: 3));
OptionsOverlaysTab.SetNodesOverlay(LoadBool(data, idx: 4));
OptionsVehicleRestrictionsTab.SetMayEnterBlockedJunctions(LoadBool(data, idx: 5));
PoliciesTab.SetMayEnterBlockedJunctions(LoadBool(data, idx: 5));
OptionsGameplayTab.SetAdvancedAi(LoadBool(data, idx: 6));
OptionsVehicleRestrictionsTab.SetHighwayRules(LoadBool(data, idx: 7));
PoliciesTab.SetHighwayRules(LoadBool(data, idx: 7));
OptionsOverlaysTab.SetPrioritySignsOverlay(LoadBool(data, idx: 8));
OptionsOverlaysTab.SetTimedLightsOverlay(LoadBool(data, idx: 9));
OptionsOverlaysTab.SetSpeedLimitsOverlay(LoadBool(data, idx: 10));
OptionsOverlaysTab.SetVehicleRestrictionsOverlay(LoadBool(data, idx: 11));
OptionsGameplayTab.SetStrongerRoadConditionEffects(LoadBool(data, idx: 12));
OptionsVehicleRestrictionsTab.SetAllowUTurns(LoadBool(data, idx: 13));
OptionsVehicleRestrictionsTab.SetAllowLaneChangesWhileGoingStraight(LoadBool(data, idx: 14));
PoliciesTab.SetAllowUTurns(LoadBool(data, idx: 13));
PoliciesTab.SetAllowLaneChangesWhileGoingStraight(LoadBool(data, idx: 14));
OptionsGameplayTab.SetDisableDespawning(!LoadBool(data, idx: 15)); // inverted
// skip Options.setDynamicPathRecalculation(data[16] == (byte)1);
OptionsOverlaysTab.SetConnectedLanesOverlay(LoadBool(data, idx: 17));
OptionsVehicleRestrictionsTab.SetPrioritySignsEnabled(LoadBool(data, idx: 18));
OptionsVehicleRestrictionsTab.SetTimedLightsEnabled(LoadBool(data, idx: 19));
PoliciesTab.SetPrioritySignsEnabled(LoadBool(data, idx: 18));
PoliciesTab.SetTimedLightsEnabled(LoadBool(data, idx: 19));
OptionsMaintenanceTab.SetCustomSpeedLimitsEnabled(LoadBool(data, idx: 20));
OptionsMaintenanceTab.SetVehicleRestrictionsEnabled(LoadBool(data, idx: 21));
OptionsMaintenanceTab.SetLaneConnectorEnabled(LoadBool(data, idx: 22));
OptionsOverlaysTab.SetJunctionRestrictionsOverlay(LoadBool(data, idx: 23));
OptionsMaintenanceTab.SetJunctionRestrictionsEnabled(LoadBool(data, idx: 24));
OptionsGameplayTab.SetProhibitPocketCars(LoadBool(data, idx: 25));
OptionsVehicleRestrictionsTab.SetPreferOuterLane(LoadBool(data, idx: 26));
PoliciesTab.SetPreferOuterLane(LoadBool(data, idx: 26));
OptionsGameplayTab.SetIndividualDrivingStyle(LoadBool(data, idx: 27));
OptionsVehicleRestrictionsTab.SetEvacBussesMayIgnoreRules(LoadBool(data, idx: 28));
PoliciesTab.SetEvacBussesMayIgnoreRules(LoadBool(data, idx: 28));
OptionsGeneralTab.SetInstantEffects(LoadBool(data, idx: 29));
OptionsMaintenanceTab.SetParkingRestrictionsEnabled(LoadBool(data, idx: 30));
OptionsOverlaysTab.SetParkingRestrictionsOverlay(LoadBool(data, idx: 31));
OptionsVehicleRestrictionsTab.SetBanRegularTrafficOnBusLanes(LoadBool(data, idx: 32));
PoliciesTab.SetBanRegularTrafficOnBusLanes(LoadBool(data, idx: 32));
OptionsMaintenanceTab.SetShowPathFindStats(LoadBool(data, idx: 33));
OptionsGameplayTab.SetDLSPercentage(LoadByte(data, idx: 34));

if (data.Length > 35) {
try {
OptionsVehicleRestrictionsTab.SetVehicleRestrictionsAggression(
PoliciesTab.SetVehicleRestrictionsAggression(
(VehicleRestrictionsAggression)data[35]);
}
catch (Exception e) {
Expand All @@ -123,12 +123,12 @@ public bool LoadData(byte[] data) {
}
}

OptionsVehicleRestrictionsTab.SetTrafficLightPriorityRules(LoadBool(data, idx: 36));
PoliciesTab.SetTrafficLightPriorityRules(LoadBool(data, idx: 36));
OptionsGameplayTab.SetRealisticPublicTransport(LoadBool(data, idx: 37));
OptionsMaintenanceTab.SetTurnOnRedEnabled(LoadBool(data, idx: 38));
OptionsVehicleRestrictionsTab.SetAllowNearTurnOnRed(LoadBool(data, idx: 39));
OptionsVehicleRestrictionsTab.SetAllowFarTurnOnRed(LoadBool(data, idx: 40));
OptionsVehicleRestrictionsTab.SetAddTrafficLightsIfApplicable(LoadBool(data, idx: 41));
PoliciesTab.SetAllowNearTurnOnRed(LoadBool(data, idx: 39));
PoliciesTab.SetAllowFarTurnOnRed(LoadBool(data, idx: 40));
PoliciesTab.SetAddTrafficLightsIfApplicable(LoadBool(data, idx: 41));

ToCheckbox(data, idx: 42, OptionsMassEditTab.RoundAboutQuickFix_StayInLaneMainR, true);
ToCheckbox(data, idx: 43, OptionsMassEditTab.RoundAboutQuickFix_StayInLaneNearRabout, true);
Expand All @@ -147,8 +147,8 @@ public bool LoadData(byte[] data) {
ToCheckbox(data, idx: 54, OptionsMassEditTab.RoundAboutQuickFix_ParkingBanMainR, true);
ToCheckbox(data, idx: 55, OptionsMassEditTab.RoundAboutQuickFix_ParkingBanYieldR);

ToCheckbox(data, idx: 56, OptionsVehicleRestrictionsTab.NoDoubleCrossings);
ToCheckbox(data, idx: 57, OptionsVehicleRestrictionsTab.DedicatedTurningLanes);
ToCheckbox(data, idx: 56, PoliciesTab.NoDoubleCrossings);
ToCheckbox(data, idx: 57, PoliciesTab.DedicatedTurningLanes);

Options.SavegamePathfinderEdition = LoadByte(data, idx: 58, defaultVal: 0);
return true;
Expand Down Expand Up @@ -225,8 +225,8 @@ public byte[] SaveData(ref bool success) {
save[54] = OptionsMassEditTab.RoundAboutQuickFix_ParkingBanMainR.Save();
save[55] = OptionsMassEditTab.RoundAboutQuickFix_ParkingBanYieldR.Save();

save[56] = OptionsVehicleRestrictionsTab.NoDoubleCrossings.Save();
save[57] = OptionsVehicleRestrictionsTab.DedicatedTurningLanes.Save();
save[56] = PoliciesTab.NoDoubleCrossings.Save();
save[57] = PoliciesTab.DedicatedTurningLanes.Save();

save[58] = (byte)Options.SavegamePathfinderEdition;

Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/Patch/_RoadBaseAI/UpdateLanesPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class UpdateLanesPatch {
/// </summary>
[UsedImplicitly]
static void Postfix(ushort segmentID) {
if (OptionsVehicleRestrictionsTab.DedicatedTurningLanes) {
if (PoliciesTab.DedicatedTurningLanes) {
BuiltIn(segmentID);
}

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 @@ -160,7 +160,7 @@ public static void MakeSettings(UIHelper helper) {
ExtUITabstrip tabStrip = ExtUITabstrip.Create(helper);
OptionsGeneralTab.MakeSettings_General(tabStrip);
OptionsGameplayTab.MakeSettings_Gameplay(tabStrip);
OptionsVehicleRestrictionsTab.MakeSettings_VehicleRestrictions(tabStrip);
PoliciesTab.MakeSettings_VehicleRestrictions(tabStrip);
OptionsOverlaysTab.MakeSettings_Overlays(tabStrip);
OptionsMaintenanceTab.MakeSettings_Maintenance(tabStrip);
OptionsKeybindsTab.MakeSettings_Keybinds(tabStrip);
Expand Down
14 changes: 7 additions & 7 deletions TLM/TLM/State/OptionsTabs/OptionsMaintenanceTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private static void OnPrioritySignsEnabledChanged(bool val) {

if (!val) {
OptionsOverlaysTab.SetPrioritySignsOverlay(false);
OptionsVehicleRestrictionsTab.SetTrafficLightPriorityRules(false);
PoliciesTab.SetTrafficLightPriorityRules(false);
}
}

Expand All @@ -209,7 +209,7 @@ private static void OnTimedLightsEnabledChanged(bool val) {

if (!val) {
OptionsOverlaysTab.SetTimedLightsOverlay(false);
OptionsVehicleRestrictionsTab.SetTrafficLightPriorityRules(false);
PoliciesTab.SetTrafficLightPriorityRules(false);
}
}

Expand Down Expand Up @@ -261,9 +261,9 @@ private static void OnJunctionRestrictionsEnabledChanged(bool val) {
Options.RebuildMenu();

if (!val) {
OptionsVehicleRestrictionsTab.SetAllowUTurns(false);
OptionsVehicleRestrictionsTab.SetAllowEnterBlockedJunctions(false);
OptionsVehicleRestrictionsTab.SetAllowLaneChangesWhileGoingStraight(false);
PoliciesTab.SetAllowUTurns(false);
PoliciesTab.SetAllowEnterBlockedJunctions(false);
PoliciesTab.SetAllowLaneChangesWhileGoingStraight(false);
SetTurnOnRedEnabled(false);
OptionsOverlaysTab.SetJunctionRestrictionsOverlay(false);
}
Expand Down Expand Up @@ -358,8 +358,8 @@ public static void SetTurnOnRedEnabled(bool newValue) {
}

if (!newValue) {
OptionsVehicleRestrictionsTab.SetAllowNearTurnOnRed(false);
OptionsVehicleRestrictionsTab.SetAllowFarTurnOnRed(false);
PoliciesTab.SetAllowNearTurnOnRed(false);
PoliciesTab.SetAllowFarTurnOnRed(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace TrafficManager.State {
using TrafficManager.UI;
using static TrafficManager.Util.Shortcuts;

public static class OptionsVehicleRestrictionsTab {
public static class PoliciesTab {
private static UICheckBox _relaxedBussesToggle;
private static UICheckBox _allRelaxedToggle;
private static UICheckBox _allowEnterBlockedJunctionsToggle;
Expand Down
2 changes: 1 addition & 1 deletion TLM/TLM/TLM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<Compile Include="State\OptionsTabs\OptionsMaintenanceTab.cs" />
<Compile Include="State\OptionsTabs\OptionsMassEditTab.cs" />
<Compile Include="State\OptionsTabs\OptionsOverlaysTab.cs" />
<Compile Include="State\OptionsTabs\OptionsVehicleRestrictionsTab.cs" />
<Compile Include="State\OptionsTabs\PoliciesTab.cs" />
<Compile Include="TrafficLight\Impl\CustomSegmentLights.cs" />
<Compile Include="Manager\Impl\LaneConnectionManager.cs" />
<Compile Include="Manager\Impl\ExtVehicleManager.cs" />
Expand Down