Skip to content

Commit 5bd7a9b

Browse files
committed
added failsafes for gui items
1 parent 86ba4d0 commit 5bd7a9b

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

WinTerrEdit/entry.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,20 @@ public void loadData(string path)
432432
}
433433
}
434434

435-
nudHealthCur.Value = playerHealth[0];
436-
nudHealthMax.Value = playerHealth[1];
435+
int phc = playerHealth[0];
436+
int phm = playerHealth[1];
437+
438+
if( phc > nudHealthCur.Maximum)
439+
{
440+
nudHealthCur.Maximum = phc;
441+
}
442+
if (phm > nudHealthMax.Maximum)
443+
{
444+
nudHealthMax.Maximum = phm;
445+
}
446+
447+
nudHealthCur.Value = phc;
448+
nudHealthMax.Value = phm;
437449

438450
//health data has been set and shown in UI
439451
stage = 9;
@@ -454,6 +466,18 @@ public void loadData(string path)
454466
}
455467
}
456468

469+
int pmc = playerMana[0];
470+
int pmm = playerMana[1];
471+
472+
if (pmc > nudManaCur.Maximum)
473+
{
474+
nudManaCur.Maximum = pmc;
475+
}
476+
if (pmm > nudManaMax.Maximum)
477+
{
478+
nudManaMax.Maximum = pmm;
479+
}
480+
457481
nudManaCur.Value = playerMana[0];
458482
nudManaMax.Value = playerMana[1];
459483

@@ -462,7 +486,7 @@ public void loadData(string path)
462486

463487
int hs = decrypted[nameEndOffset + 9];
464488

465-
if(hs > 133)
489+
if(hs > nudHair.Maximum)
466490
{
467491
nudHair.Maximum = hs;
468492
}

0 commit comments

Comments
 (0)