Skip to content

Commit 91ce41f

Browse files
committed
Revert "Implement basic straight wire routing capability"
This reverts commit 3527ad6.
1 parent 3527ad6 commit 91ce41f

File tree

7 files changed

+6
-68
lines changed

7 files changed

+6
-68
lines changed

Assets/Scripts/Description/Types/ProjectDescription.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public struct ProjectDescription
2121
public bool Prefs_SimPaused;
2222
public int Prefs_SimTargetStepsPerSecond;
2323
public int Prefs_SimStepsPerClockTick;
24-
public int Prefs_WireRouting;
25-
26-
2724

2825
// List of all player-created chips (in order of creation -- oldest first)
2926
public string[] AllCustomChipNames;

Assets/Scripts/Game/Elements/WireInstance.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -207,26 +207,11 @@ public void SetWirePoint(Vector2 p, int i)
207207
public void SetWirePointWithSnapping(Vector2 p, int i, Vector2 straightLineRefPoint)
208208
{
209209
if (Project.ActiveProject.ShouldSnapToGrid) p = GridHelper.SnapToGrid(p, true, true);
210-
if (Project.ActiveProject.ForceStraightWires && !Project.ActiveProject.ShouldRouteWires) p = GridHelper.ForceStraightLine(straightLineRefPoint, p);
211-
if (Project.ActiveProject.ForceStraightWires && Project.ActiveProject.ShouldRouteWires && WirePoints.Count > 3)
212-
{
213-
// If routing wires, we need to route the wire to the new point
214-
Vector2[] points = GridHelper.RouteWire(GetWirePoint(WirePoints.Count - 3), p);
215-
p = points[1];
216-
SetWirePoint((points[0]), WirePoints.Count - 2);
217-
}
218-
else if (Project.ActiveProject.ShouldRouteWires && WirePoints.Count > 2)
219-
{
220-
Vector2[] points = GridHelper.RouteWire(GetWirePoint(WirePoints.Count - 3), p);
221-
p = points[1];
222-
SetWirePoint((points[0]), WirePoints.Count - 2);
223-
}
210+
if (Project.ActiveProject.ForceStraightWires) p = GridHelper.ForceStraightLine(straightLineRefPoint, p);
224211

225212
SetWirePoint(p, i);
226213
}
227214

228-
229-
230215
public void SetLastWirePoint(Vector2 p)
231216
{
232217
SetWirePointWithSnapping(p, WirePoints.Count - 1, GetWirePoint(WirePoints.Count - 2));

Assets/Scripts/Game/Helpers/GridHelper.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,5 @@ public static Vector2 ForceStraightLine(Vector2 prev, Vector2 curr)
5252

5353
return prev + offset;
5454
}
55-
56-
public static Vector2[] RouteWire(Vector2 prev, Vector2 curr)
57-
{
58-
Vector2[] points = new Vector2[2];
59-
Vector2 offset = curr - prev;
60-
61-
if (Mathf.Abs(offset.x) > Mathf.Abs(offset.y))
62-
{
63-
// Horizontal mode: move horizontally, then 45-degree diagonal to curr
64-
float diagLen = Mathf.Min(Mathf.Abs(offset.x), Mathf.Abs(offset.y));
65-
float signX = Mathf.Sign(offset.x);
66-
float signY = Mathf.Sign(offset.y);
67-
Vector2 bend = new Vector2(curr.x - diagLen * signX, prev.y);
68-
points[0] = bend;
69-
points[1] = curr;
70-
}
71-
else
72-
{
73-
// Vertical mode: move vertically, then 45-degree diagonal to curr
74-
float diagLen = Mathf.Min(Mathf.Abs(offset.x), Mathf.Abs(offset.y));
75-
float signX = Mathf.Sign(offset.x);
76-
float signY = Mathf.Sign(offset.y);
77-
Vector2 bend = new Vector2(prev.x, curr.y - diagLen * signY);
78-
points[0] = bend;
79-
points[1] = curr;
80-
}
81-
return points;
82-
}
8355
}
8456
}

Assets/Scripts/Game/Interaction/ChipInteractionController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ void HandleLeftMouseDown()
465465
else if (CanAddWirePoint())
466466
{
467467
WireToPlace.AddWirePoint(InputHelper.MousePosWorld);
468-
if(Project.ActiveProject.ShouldRouteWires) WireToPlace.AddWirePoint(InputHelper.MousePosWorld);
469468
}
470469
}
471470
// Place subchip / devpin

Assets/Scripts/Game/Project/Project.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,6 @@ public void ToggleGridDisplay()
480480

481481
public bool ShouldSnapToGrid => KeyboardShortcuts.SnapModeHeld || (description.Prefs_Snapping == 1 && ShowGrid) || description.Prefs_Snapping == 2;
482482
public bool ForceStraightWires => KeyboardShortcuts.StraightLineModeHeld || (description.Prefs_StraightWires == 1 && ShowGrid) || description.Prefs_StraightWires == 2;
483-
public bool ShouldRouteWires => description.Prefs_WireRouting == 1 || description.Prefs_WireRouting == 2;
484-
485-
486483

487484
public void NotifyExit()
488485
{

Assets/Scripts/Graphics/UI/Menus/PreferencesMenu.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ public static class PreferencesMenu
4545
"Always"
4646
};
4747

48-
static readonly string[] WireRoutingOptions =
49-
{
50-
"Off",
51-
"90°",
52-
"45°"
53-
};
54-
5548
static readonly string[] SimulationStatusOptions =
5649
{
5750
"Active",
@@ -67,7 +60,6 @@ public static class PreferencesMenu
6760
static readonly UIHandle ID_GridDisplay = new("PREFS_GridDisplay");
6861
static readonly UIHandle ID_Snapping = new("PREFS_Snapping");
6962
static readonly UIHandle ID_StraightWires = new("PREFS_StraightWires");
70-
static readonly UIHandle ID_WireRouting = new("PREFS_WireRouting");
7163
static readonly UIHandle ID_SimStatus = new("PREFS_SimStatus");
7264
static readonly UIHandle ID_SimFrequencyField = new("PREFS_SimTickTarget");
7365
static readonly UIHandle ID_ClockSpeedInput = new("PREFS_ClockSpeed");
@@ -110,7 +102,6 @@ public static void DrawMenu(Project project)
110102
DrawHeader("EDITING:");
111103
int snappingMode = DrawNextWheel("Snap to grid", SnappingOptions, ID_Snapping);
112104
int straightWireMode = DrawNextWheel("Straight wires", StraightWireOptions, ID_StraightWires);
113-
int wireRoutingMode = DrawNextWheel("Wire routing", WireRoutingOptions, ID_WireRouting);
114105

115106
DrawHeader("SIMULATION:");
116107
bool pauseSim = MenuHelper.LabeledOptionsWheel(simStatusLabel, labelCol, labelPosCurr, entrySize, ID_SimStatus, SimulationStatusOptions, settingFieldSize.x, true) == 1;
@@ -145,7 +136,6 @@ public static void DrawMenu(Project project)
145136
project.description.Prefs_ChipPinNamesDisplayMode = chipPinNamesMode;
146137
project.description.Prefs_GridDisplayMode = gridDisplayMode;
147138
project.description.Prefs_Snapping = snappingMode;
148-
project.description.Prefs_WireRouting = wireRoutingMode;
149139
project.description.Prefs_StraightWires = straightWireMode;
150140
project.description.Prefs_SimTargetStepsPerSecond = targetSimTicksPerSecond;
151141
project.description.Prefs_SimStepsPerClockTick = clockSpeed;
@@ -216,7 +206,6 @@ static void UpdateUIFromDescription()
216206
UI.GetWheelSelectorState(ID_GridDisplay).index = projDesc.Prefs_GridDisplayMode;
217207
UI.GetWheelSelectorState(ID_Snapping).index = projDesc.Prefs_Snapping;
218208
UI.GetWheelSelectorState(ID_StraightWires).index = projDesc.Prefs_StraightWires;
219-
UI.GetWheelSelectorState(ID_WireRouting).index = projDesc.Prefs_WireRouting;
220209
UI.GetWheelSelectorState(ID_SimStatus).index = projDesc.Prefs_SimPaused ? 1 : 0;
221210
// -- Input fields
222211
UI.GetInputFieldState(ID_SimFrequencyField).SetText(projDesc.Prefs_SimTargetStepsPerSecond + "", false);

TestData/Projects/MainTest/ProjectDescription.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
22
"ProjectName": "MainTest",
3-
"DLSVersion_LastSaved": "2.1.6",
3+
"DLSVersion_LastSaved": "2.1.5",
44
"DLSVersion_EarliestCompatible": "2.0.0",
5-
"CreationTime": "2025-03-14T19:23:30.404+02:00",
6-
"LastSaveTime": "2025-05-23T21:01:50.361+02:00",
5+
"CreationTime": "2025-03-14T18:23:30.404+01:00",
6+
"LastSaveTime": "2025-05-04T09:15:41.061+02:00",
77
"Prefs_MainPinNamesDisplayMode": 2,
88
"Prefs_ChipPinNamesDisplayMode": 1,
99
"Prefs_GridDisplayMode": 1,
10-
"Prefs_Snapping": 2,
11-
"Prefs_StraightWires": 2,
10+
"Prefs_Snapping": 0,
11+
"Prefs_StraightWires": 0,
1212
"Prefs_SimPaused": false,
1313
"Prefs_SimTargetStepsPerSecond": 150,
1414
"Prefs_SimStepsPerClockTick": 6,
15-
"Prefs_WireRouting": 1,
1615
"AllCustomChipNames":[
1716
"AND",
1817
"D-LATCH",

0 commit comments

Comments
 (0)