Limiting too long location names in navigation terminals & end shift button

This commit is contained in:
Regalis
2016-10-26 19:48:39 +03:00
parent 980f8e0d33
commit 282611d0cc
4 changed files with 15 additions and 16 deletions
+1 -3
View File
@@ -343,8 +343,6 @@ namespace Barotrauma
{
if (maxWidth <= 0 || string.IsNullOrWhiteSpace(str)) return "";
StringBuilder sb = new StringBuilder();
float currWidth = font.MeasureString("...").X;
for (int i = 0; i < str.Length; i++ )
{
@@ -352,7 +350,7 @@ namespace Barotrauma
if (currWidth > maxWidth)
{
return str.Substring(0, i + 1) + "...";
return str.Substring(0, Math.Max(i - 2, 1)) + "...";
}
}