Adding a textblock with whitespace as the text doesn't blow up GUIListBoxes anymore, missing key bindings don't crash the game
This commit is contained in:
@@ -157,7 +157,7 @@ namespace Barotrauma
|
||||
|
||||
SetTextPos();
|
||||
|
||||
if (rect.Height == 0 && !string.IsNullOrWhiteSpace(Text))
|
||||
if (rect.Height == 0 && !string.IsNullOrEmpty(Text))
|
||||
{
|
||||
this.rect.Height = (int)Font.MeasureString(wrappedText).Y;
|
||||
}
|
||||
|
||||
@@ -203,6 +203,16 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||
{
|
||||
if (keyMapping[(int)inputType]==null)
|
||||
{
|
||||
DebugConsole.ThrowError("Key binding for the input type ''" + inputType + " not set!");
|
||||
keyMapping[(int)inputType] = new KeyOrMouse(Keys.D1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UnsavedSettings = false;
|
||||
}
|
||||
|
||||
@@ -384,11 +394,6 @@ namespace Barotrauma
|
||||
new GUITextBlock(new Rectangle(x, y, 100, 20), inputNames[i]+": ", GUI.Style, settingsFrame);
|
||||
var keyBox = new GUITextBox(new Rectangle(x + 100, y, 120, 15), GUI.Style, settingsFrame);
|
||||
|
||||
if (keyMapping[i]==null)
|
||||
{
|
||||
keyMapping[i] = new KeyOrMouse(Keys.D1);
|
||||
}
|
||||
|
||||
keyBox.Text = keyMapping[i].ToString();
|
||||
keyBox.UserData = i;
|
||||
keyBox.OnSelected += KeyBoxSelected;
|
||||
|
||||
Reference in New Issue
Block a user