Fix clamping of BDSP work value NumericUpDowns

https://projectpokemon.org/home/forums/topic/59826-work-constants-can-be-out-of-range-of-the-gui-fields-bdsp/

ty BlackShark !
This commit is contained in:
Kurt 2021-11-26 09:20:22 -08:00
parent b50791530c
commit 2bc9ff9073
2 changed files with 21 additions and 26 deletions

View File

@ -54,8 +54,8 @@ private void InitializeComponent()
this.GB_System = new System.Windows.Forms.TabPage();
this.TLP_System = new System.Windows.Forms.TableLayoutPanel();
this.GB_Work = new System.Windows.Forms.TabPage();
this.GB_Research = new System.Windows.Forms.TabPage();
this.TLP_Work = new System.Windows.Forms.TableLayoutPanel();
this.GB_Research = new System.Windows.Forms.TabPage();
this.GB_FlagStatus.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_System)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Work)).BeginInit();
@ -167,10 +167,15 @@ private void InitializeComponent()
//
this.NUD_Work.Location = new System.Drawing.Point(159, 70);
this.NUD_Work.Maximum = new decimal(new int[] {
499,
2147483647,
0,
0,
0});
this.NUD_Work.Minimum = new decimal(new int[] {
-2147483648,
0,
0,
-2147483648});
this.NUD_Work.Name = "NUD_Work";
this.NUD_Work.Size = new System.Drawing.Size(84, 20);
this.NUD_Work.TabIndex = 38;
@ -381,18 +386,6 @@ private void InitializeComponent()
this.GB_Work.Text = "Work Values";
this.GB_Work.UseVisualStyleBackColor = true;
//
// GB_Research
//
this.GB_Research.Controls.Add(this.GB_FlagStatus);
this.GB_Research.Controls.Add(this.GB_Researcher);
this.GB_Research.Location = new System.Drawing.Point(4, 22);
this.GB_Research.Name = "GB_Research";
this.GB_Research.Padding = new System.Windows.Forms.Padding(3);
this.GB_Research.Size = new System.Drawing.Size(422, 283);
this.GB_Research.TabIndex = 2;
this.GB_Research.Text = "Research";
this.GB_Research.UseVisualStyleBackColor = true;
//
// TLP_Work
//
this.TLP_Work.AutoScroll = true;
@ -409,6 +402,18 @@ private void InitializeComponent()
this.TLP_Work.Size = new System.Drawing.Size(416, 277);
this.TLP_Work.TabIndex = 2;
//
// GB_Research
//
this.GB_Research.Controls.Add(this.GB_FlagStatus);
this.GB_Research.Controls.Add(this.GB_Researcher);
this.GB_Research.Location = new System.Drawing.Point(4, 22);
this.GB_Research.Name = "GB_Research";
this.GB_Research.Padding = new System.Windows.Forms.Padding(3);
this.GB_Research.Size = new System.Drawing.Size(422, 283);
this.GB_Research.TabIndex = 2;
this.GB_Research.Text = "Research";
this.GB_Research.UseVisualStyleBackColor = true;
//
// SAV_FlagWork8b
//
this.AllowDrop = true;

View File

@ -45,16 +45,6 @@ public SAV_FlagWork8b(SAV8BS sav)
editing = false;
ResumeLayout();
if (CB_CustomWork.Items.Count > 0)
{
CB_CustomWork.SelectedIndex = 0;
}
else
{
L_CustomWork.Visible = CB_CustomWork.Visible = NUD_Work.Visible = false;
TC_Features.TabPages.Remove(GB_Work);
}
NUD_Flag.Maximum = obj.CountFlag - 1;
NUD_Flag.Text = "0";
CHK_CustomFlag.Checked = obj.GetFlag(0);
@ -159,8 +149,8 @@ private void LoadWork(EventLabelCollectionSystem editor)
var lbl = new Label { Text = entry.Name, Margin = Padding.Empty, AutoSize = true };
var mtb = new NumericUpDown
{
Maximum = ushort.MaxValue,
Minimum = ushort.MinValue,
Maximum = int.MaxValue,
Minimum = int.MinValue,
Margin = Padding.Empty,
Width = 50,
};