Console: move DOSBox IP shift from game pages into game defaults

The per-page "DOSBox IPs (+100)" checkbox becomes a single machine-level
setting per game, edited in Settings > Change <game> Defaults (a "DOSBox
Build" row below Autotranslocate Delay) and persisted in the game's
defaults file (RPDefaults.rpd / BTDefaults.btd) as a top-level
DosBoxAddressShift element.

The game pages no longer carry the checkbox; each RPGame/BTGame reads the
stored default once at construction into a readonly field and applies it
when enabling a pod (MungaGame.DosBoxAddressShift) and when building the
mission egg (MissionAddress). Since it is read at construction, an
already-open game page keeps its shift until reopened -- consistent with
how every other game default behaves.

Verified against vPOD: enabling the DOSBox default drives a freshly
opened game page's pod connection to 127.0.0.101 and the egg to
pilot=127.0.0.101 with no per-page control; unchecking round-trips to
False in the defaults file. All 103 diff tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-10 15:33:44 -05:00
co-authored by Claude Fable 5
parent a5f25c8bb8
commit 80ee1d26ea
6 changed files with 97 additions and 61 deletions
+5 -26
View File
@@ -182,7 +182,7 @@ internal class BTGame : DockContent
private Timer tmrAutoTranslocate;
private CheckBox mDosBoxShift;
private readonly bool mDosBoxAddressShift = BTDefaults.DosBoxAddressShift;
private string GameStatusText
{
@@ -398,15 +398,7 @@ internal class BTGame : DockContent
private string MissionAddress(Pod pod)
{
return (mDosBoxShift.Checked ? DosBox.ShiftAddress(pod.IPAddress) : pod.IPAddress).ToString();
}
private void mDosBoxShift_CheckedChanged(object sender, EventArgs e)
{
foreach (DataGridViewRow item in (IEnumerable)mPilotsDataGrid.Rows)
{
((Pod)item.Tag).MungaGame.DosBoxAddressShift = mDosBoxShift.Checked;
}
return (mDosBoxAddressShift ? DosBox.ShiftAddress(pod.IPAddress) : pod.IPAddress).ToString();
}
private void NetworkScan(object sender, EventArgs e)
@@ -862,7 +854,6 @@ internal class BTGame : DockContent
private void SwitchControlsMode(bool editMode)
{
mDosBoxShift.Enabled = editMode;
mMap.Enabled = editMode;
mWeather.Enabled = editMode;
mTimeOfDay.Enabled = editMode;
@@ -1093,7 +1084,7 @@ internal class BTGame : DockContent
{
if (flag.Value)
{
((Pod)dataGridViewRow.Tag).MungaGame.DosBoxAddressShift = mDosBoxShift.Checked;
((Pod)dataGridViewRow.Tag).MungaGame.DosBoxAddressShift = mDosBoxAddressShift;
((Pod)dataGridViewRow.Tag).MungaGame.MakeRequested(this);
}
else
@@ -1316,7 +1307,6 @@ internal class BTGame : DockContent
this.mRandomWeather = new System.Windows.Forms.Button();
this.mRandomTimeOfDay = new System.Windows.Forms.Button();
this.mMissionLengthTextBox = new System.Windows.Forms.TextBox();
this.mDosBoxShift = new System.Windows.Forms.CheckBox();
this.mPilotsGroupBox = new System.Windows.Forms.GroupBox();
this.mPilotsDataGrid = new System.Windows.Forms.DataGridView();
this.mEnabledColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -1351,7 +1341,7 @@ internal class BTGame : DockContent
this.mMissionPropertiesGroupBox.Text = "Mission Properties";
this.mMissionPropertiesTable.AutoSize = true;
this.mMissionPropertiesTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.mMissionPropertiesTable.ColumnCount = 9;
this.mMissionPropertiesTable.ColumnCount = 8;
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
@@ -1360,8 +1350,7 @@ internal class BTGame : DockContent
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 0f));
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.mMissionPropertiesTable.Controls.Add(this.mIssuesLabel, 8, 0);
this.mMissionPropertiesTable.Controls.Add(this.mIssuesLabel, 7, 0);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextLabel, 3, 1);
this.mMissionPropertiesTable.Controls.Add(this.mMap, 1, 0);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthDisplayLabel, 5, 1);
@@ -1379,7 +1368,6 @@ internal class BTGame : DockContent
this.mMissionPropertiesTable.Controls.Add(this.mRandomWeather, 2, 1);
this.mMissionPropertiesTable.Controls.Add(this.mRandomTimeOfDay, 2, 2);
this.mMissionPropertiesTable.Controls.Add(this.mMissionLengthTextBox, 4, 1);
this.mMissionPropertiesTable.Controls.Add(this.mDosBoxShift, 7, 2);
this.mMissionPropertiesTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.mMissionPropertiesTable.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddColumns;
this.mMissionPropertiesTable.Location = new System.Drawing.Point(5, 18);
@@ -1542,15 +1530,6 @@ internal class BTGame : DockContent
this.mMissionLengthTextBox.Size = new System.Drawing.Size(100, 20);
this.mMissionLengthTextBox.TabIndex = 12;
this.mMissionLengthTextBox.TextChanged += new System.EventHandler(mMissionLengthTextBox_TextChanged);
this.mDosBoxShift.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.mDosBoxShift.AutoSize = true;
this.mDosBoxShift.Location = new System.Drawing.Point(642, 64);
this.mDosBoxShift.Name = "mDosBoxShift";
this.mDosBoxShift.Size = new System.Drawing.Size(122, 17);
this.mDosBoxShift.TabIndex = 13;
this.mDosBoxShift.Text = "DOSBox IPs (+100)";
this.mDosBoxShift.UseVisualStyleBackColor = true;
this.mDosBoxShift.CheckedChanged += new System.EventHandler(mDosBoxShift_CheckedChanged);
this.mPilotsGroupBox.Controls.Add(this.mPilotsDataGrid);
this.mPilotsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.mPilotsGroupBox.Location = new System.Drawing.Point(8, 113);