Skip to content

Commit a3424e8

Browse files
committed
Add waypoint placement window option for not suggesting multiplayer starting waypoints
1 parent 96859ee commit a3424e8

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

src/TSMapEditor/Config/Default/UI/Windows/PlaceWaypointWindow.ini

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[PlaceWaypointWindow]
2-
$Width=215
2+
$Width=280
33
$CC0=lblDescription:XNALabel
44
$CC1=tbWaypointNumber:EditorNumberTextBox
55
$CC2=lblWaypointColor:XNALabel
66
$CC3=ddWaypointColor:XNADropDown
7-
$CC4=btnPlace:EditorButton
7+
$CC4=chkDoNotSuggestMPStartingWaypoints:XNACheckBox
8+
$CC5=btnPlace:EditorButton
89
$Height=getBottom(btnPlace) + EMPTY_SPACE_BOTTOM
910
HasCloseButton=yes
1011

@@ -28,9 +29,14 @@ $X=getRight(lblWaypointColor) + HORIZONTAL_SPACING
2829
$Y=getY(lblWaypointColor) - 1
2930
$Width=getRight(tbWaypointNumber) - getX(ddWaypointColor)
3031

32+
[chkDoNotSuggestMPStartingWaypoints]
33+
$X=getX(lblDescription)
34+
$Y=getBottom(ddWaypointColor) + VERTICAL_SPACING
35+
$Text=translate(Do not suggest multiplayer starting waypoints)
36+
3137
[btnPlace]
3238
$Width=80
3339
$X=(getWidth(PlaceWaypointWindow) - getWidth(btnPlace)) / 2
34-
$Y=getBottom(ddWaypointColor) + EMPTY_SPACE_TOP
40+
$Y=getBottom(chkDoNotSuggestMPStartingWaypoints) + EMPTY_SPACE_TOP
3541
$Text=translate(Place)
3642

src/TSMapEditor/Config/Translations/en/Translation_en.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ UIManager.IssuesFound.Description=The map has been saved, but one or more issues
336336
UIManager.LoadMapFailure.Title=Failed to open map
337337
UIManager.MapSaved=Map saved.
338338
UIManager.MapAutoSaved=Map auto-saved.
339+
UIManager.NewMap=New map
339340
WindowController.NoTriggerAttached.Title=No trigger attached
340341
WindowController.NoTriggerAttached.Description=The specified Tag has no attached Trigger!
341342
ListExtensions.TaskForceParseError=Failed to load TaskForce {0}. It might be missing a section or be otherwise invalid.
@@ -360,6 +361,7 @@ TileInfoDisplay.Height=Height:\s
360361
TileInfoDisplay.HouseBaseNodesHeader=Base Node:\s
361362
TileInfoDisplay.HouseBaseNodesInfo={0} ({1}), Owner:
362363
TileInfoDisplay.NoToolSelected=No tool selected
364+
TileInfoDisplay.SelectedTool=Selected tool:\s
363365
TileInfoDisplay.TileSet=TileSet:\s
364366
TileInfoDisplay.TileNumber=Tile #:\s
365367
TileInfoDisplay.TerrainType=Terrain Type:\s
@@ -837,6 +839,7 @@ OpenMapWindow.NoFileSelected.Description=Please select the map file to open.
837839

838840
PlaceWaypointWindow.lblDescription.Text=Input waypoint number:
839841
PlaceWaypointWindow.lblWaypointColor.Text=Color:
842+
PlaceWaypointWindow.chkDoNotSuggestMPStartingWaypoints.Text=Do not suggest multiplayer starting waypoints
840843
PlaceWaypointWindow.btnPlace.Text=Place
841844
PlaceWaypointWindow.DescriptionText=Input waypoint number (0-{0}):
842845
PlaceWaypointWindow.None=None

src/TSMapEditor/Settings/UserSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public async Task SaveSettingsAsync()
110110
public BoolSetting QuickTriggerParameterSelection = new BoolSetting(General, nameof(QuickTriggerParameterSelection), true);
111111
public IntSetting AutoSaveInterval = new IntSetting(General, nameof(AutoSaveInterval), 300);
112112
public IntSetting SidebarWidth = new IntSetting(General, nameof(SidebarWidth), 250);
113+
public BoolSetting DoNotSuggestMPStartingWaypoints = new BoolSetting(General, nameof(DoNotSuggestMPStartingWaypoints), false);
113114

114115
public BoolSetting MultithreadedTextureLoading = new BoolSetting(General, nameof(MultithreadedTextureLoading), true);
115116
public BoolSetting LogFileLoading = new BoolSetting(General, nameof(LogFileLoading), false);

src/TSMapEditor/UI/Windows/PlaceWaypointWindow.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using TSMapEditor.Models;
77
using TSMapEditor.Mutations;
88
using TSMapEditor.Mutations.Classes;
9+
using TSMapEditor.Settings;
910
using TSMapEditor.UI.Controls;
1011

1112
namespace TSMapEditor.UI.Windows
@@ -26,6 +27,7 @@ public PlaceWaypointWindow(WindowManager windowManager, Map map, MutationManager
2627
private EditorNumberTextBox tbWaypointNumber;
2728
private XNALabel lblDescription;
2829
private XNADropDown ddWaypointColor;
30+
private XNACheckBox chkDoNotSuggestMPStartingWaypoints;
2931

3032
private Point2D cellCoords;
3133

@@ -41,12 +43,16 @@ public override void Initialize()
4143
lblDescription = FindChild<XNALabel>(nameof(lblDescription));
4244
lblDescription.Text = string.Format(Translate(this, "DescriptionText", "Input waypoint number (0-{0}):"), Constants.MaxWaypoint - 1);
4345

46+
chkDoNotSuggestMPStartingWaypoints = FindChild<XNACheckBox>(nameof(chkDoNotSuggestMPStartingWaypoints));
47+
4448
FindChild<EditorButton>("btnPlace").LeftClick += BtnPlace_LeftClick;
4549

4650
// Init color dropdown options
4751
ddWaypointColor = FindChild<XNADropDown>(nameof(ddWaypointColor));
4852
ddWaypointColor.AddItem(Translate(this, "None", "None"));
4953
UIHelpers.AddColorOptionsToDropDown(Waypoint.SupportedColors, ddWaypointColor);
54+
55+
chkDoNotSuggestMPStartingWaypoints.Checked = UserSettings.Instance.DoNotSuggestMPStartingWaypoints;
5056
}
5157

5258
private void BtnPlace_LeftClick(object sender, EventArgs e)
@@ -80,6 +86,12 @@ public bool PlaceWaypoint(int waypointNumber, Point2D cellCoords)
8086
return false;
8187
}
8288

89+
if (chkDoNotSuggestMPStartingWaypoints.Checked != UserSettings.Instance.DoNotSuggestMPStartingWaypoints)
90+
{
91+
UserSettings.Instance.DoNotSuggestMPStartingWaypoints.UserDefinedValue = chkDoNotSuggestMPStartingWaypoints.Checked;
92+
_ = UserSettings.Instance.SaveSettingsAsync();
93+
}
94+
8395
string waypointColor = ddWaypointColor.SelectedItem != null ? (string)ddWaypointColor.SelectedItem.Tag : null;
8496

8597
mutationManager.PerformMutation(new PlaceWaypointMutation(mutationTarget, cellCoords, waypointNumber, waypointColor));
@@ -114,7 +126,7 @@ public int GetAvailableWaypointNumber()
114126
return -1;
115127
}
116128

117-
for (int i = 0; i < Constants.MaxWaypoint; i++)
129+
for (int i = chkDoNotSuggestMPStartingWaypoints.Checked ? Constants.MultiplayerMaxPlayers : 0; i < Constants.MaxWaypoint; i++)
118130
{
119131
if (!map.Waypoints.Exists(w => w.Identifier == i) && (Constants.IsRA2YR || i != Constants.TS_WAYPT_SPECIAL))
120132
{

0 commit comments

Comments
 (0)