Skip to content

Commit a79c5ea

Browse files
committed
Merge remote-tracking branch 'upstream/master' into override-team-delays
2 parents 0e19a7e + 622dbda commit a79c5ea

File tree

8 files changed

+432
-141
lines changed

8 files changed

+432
-141
lines changed

src/TSMapEditor/Config/Scripts/Activate Assign Mission Cursor Action.cs

Lines changed: 385 additions & 0 deletions
Large diffs are not rendered by default.

src/TSMapEditor/Config/Scripts/Area Guard Mission Assignment Cursor Action.cs

Lines changed: 0 additions & 124 deletions
This file was deleted.

src/TSMapEditor/TSMapEditor.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<ApplicationIcon>editoricon.ico</ApplicationIcon>
2727
</PropertyGroup>
2828
<ItemGroup>
29+
<Compile Remove="Config\Scripts\Activate Assign Mission Cursor Action.cs" />
2930
<Compile Remove="Config\Scripts\Apply Animated Water.cs" />
30-
<Compile Remove="Config\Scripts\Area Guard Mission Assignment Cursor Action.cs" />
3131
<Compile Remove="Config\Scripts\Disable All Debug Triggers.cs" />
3232
<Compile Remove="Config\Scripts\Make Civilian Vehicles Sleep.cs" />
3333
<Compile Remove="Config\Scripts\Remove All Terrain Objects.cs" />
@@ -505,10 +505,10 @@
505505
<Folder Include="Content\ToolIcons\" />
506506
</ItemGroup>
507507
<ItemGroup>
508-
<None Include="Config\Scripts\Apply Animated Water.cs">
508+
<None Include="Config\Scripts\Activate Assign Mission Cursor Action.cs">
509509
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
510510
</None>
511-
<None Include="Config\Scripts\Area Guard Mission Assignment Cursor Action.cs">
511+
<None Include="Config\Scripts\Apply Animated Water.cs">
512512
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
513513
</None>
514514
<None Include="Config\Scripts\Count Credits On Map.cs">

src/TSMapEditor/UI/Controls/INItializableWindow.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public override void Initialize()
7575
}
7676

7777
Parser.Instance.SetPrimaryControl(this);
78-
ReadINIForControl(this);
78+
if (!ReadINIForControl(this))
79+
throw new INIConfigException("No section '" + Name + "' found when parsing config file for INItializableWindow of the type!");
80+
7981
ReadLateAttributesForControl(this);
8082

8183
base.Initialize();

src/TSMapEditor/UI/CursorActions/ManageBaseNodesCursorAction.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public override void OnKeyPressed(KeyPressEventArgs e, Point2D cellCoords)
7272
ShiftBaseNodeEarlier(cellCoords);
7373
e.Handled = true;
7474
}
75+
else if (e.PressedKey == Microsoft.Xna.Framework.Input.Keys.M)
76+
{
77+
e.Handled = true;
78+
}
7579
}
7680

7781
public override void LeftDown(Point2D cellCoords)

src/TSMapEditor/UI/CursorActions/PlaceWaypointCursorAction.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ public PlaceWaypointCursorAction(ICursorActionTarget cursorActionTarget) : base(
1919

2020
public override void LeftClick(Point2D cellCoords)
2121
{
22-
PlaceWaypointWindow.Open(cellCoords);
22+
if (Keyboard.IsShiftHeldDown())
23+
{
24+
int availableWaypointNumber = PlaceWaypointWindow.GetAvailableWaypointNumber();
25+
PlaceWaypointWindow.PlaceWaypoint(availableWaypointNumber, cellCoords);
26+
}
27+
else
28+
{
29+
PlaceWaypointWindow.Open(cellCoords);
30+
}
2331
}
2432

2533
public override void DrawPreview(Point2D cellCoords, Point2D cameraTopLeftPoint)

src/TSMapEditor/UI/Windows/HousesWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ private void BtnCloneHouse_LeftClick(object sender, InputEventArgs e)
250250

251251
HouseType clonedHouseType = (HouseType)editedHouse.HouseType.Clone();
252252
clonedHouseType.ININame = editedHouse.HouseType.ININame + cloneININame;
253-
clonedHouseType.Index = map.HouseTypes.Count;
253+
clonedHouseType.Index = map.HouseTypes.Count + (Constants.IsRA2YR ? map.Rules.RulesHouseTypes.Count : 0);
254254
map.HouseTypes.Add(clonedHouseType);
255255

256256
House clonedHouse = (House)editedHouse.Clone();

src/TSMapEditor/UI/Windows/PlaceWaypointWindow.cs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,51 +57,67 @@ private void BtnPlace_LeftClick(object sender, EventArgs e)
5757
return;
5858
}
5959

60-
if (tbWaypointNumber.Value < 0 || tbWaypointNumber.Value >= Constants.MaxWaypoint)
60+
int waypointNumber = tbWaypointNumber.Value;
61+
62+
PlaceWaypoint(waypointNumber, cellCoords);
63+
Hide();
64+
}
65+
66+
public void PlaceWaypoint(int waypointNumber, Point2D cellCoords)
67+
{
68+
if (waypointNumber < 0 || waypointNumber >= Constants.MaxWaypoint)
6169
return;
6270

63-
if (map.Waypoints.Exists(w => w.Identifier == tbWaypointNumber.Value))
71+
if (map.Waypoints.Exists(w => w.Identifier == waypointNumber))
6472
{
6573
EditorMessageBox.Show(WindowManager,
6674
Translate(this, "WaypointExists.Title", "Waypoint already exists"),
67-
string.Format(Translate(this, "WaypointExists.Description",
68-
"A waypoint with the given number {0} already exists on the map!"), tbWaypointNumber.Value),
75+
string.Format(Translate(this, "WaypointExists.Description",
76+
"A waypoint with the given number {0} already exists on the map!"), waypointNumber),
6977
MessageBoxButtons.OK);
7078

7179
return;
7280
}
7381

7482
string waypointColor = ddWaypointColor.SelectedItem != null ? ddWaypointColor.SelectedItem.Text : null;
7583

76-
mutationManager.PerformMutation(new PlaceWaypointMutation(mutationTarget, cellCoords, tbWaypointNumber.Value, waypointColor));
77-
78-
Hide();
84+
mutationManager.PerformMutation(new PlaceWaypointMutation(mutationTarget, cellCoords, waypointNumber, waypointColor));
7985
}
8086

8187
public void Open(Point2D cellCoords)
8288
{
8389
this.cellCoords = cellCoords;
8490

91+
int availableWaypointNumber = GetAvailableWaypointNumber();
92+
if (availableWaypointNumber < 0)
93+
return;
94+
95+
tbWaypointNumber.Value = availableWaypointNumber;
96+
97+
Show();
98+
}
99+
100+
public int GetAvailableWaypointNumber()
101+
{
85102
if (map.Waypoints.Count == Constants.MaxWaypoint)
86103
{
87104
EditorMessageBox.Show(WindowManager,
88105
Translate(this, "MaxWaypoints.Title", "Maximum waypoints reached"),
89106
Translate(this, "MaxWaypoints.Description", "All valid waypoints on the map are already in use!"),
90107
MessageBoxButtons.OK);
91108

92-
return;
109+
return -1;
93110
}
94111

95112
for (int i = 0; i < Constants.MaxWaypoint; i++)
96113
{
97114
if (!map.Waypoints.Exists(w => w.Identifier == i) && (Constants.IsRA2YR || i != Constants.TS_WAYPT_SPECIAL))
98115
{
99-
tbWaypointNumber.Value = i;
100-
break;
116+
return i;
101117
}
102118
}
103119

104-
Show();
120+
return -1;
105121
}
106122
}
107123
}

0 commit comments

Comments
 (0)