From e64655d878b42809aa0acb635ce6c724c9508772 Mon Sep 17 00:00:00 2001 From: Zero Fanker Date: Sun, 23 Jun 2024 12:00:50 -0400 Subject: [PATCH] slightly optimized 'TruncSpace' helper function . --- MissionEditor/functions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MissionEditor/functions.cpp b/MissionEditor/functions.cpp index 3caeca3..080a5de 100644 --- a/MissionEditor/functions.cpp +++ b/MissionEditor/functions.cpp @@ -508,8 +508,9 @@ void TruncSpace(CString& str) { str.TrimLeft(); str.TrimRight(); - if (str.Find(" ") >= 0) { - str.Delete(str.Find(" "), str.GetLength() - str.Find(" ")); + auto const spacePos = str.Find(" "); + if (spacePos >= 0) { + str.Delete(spacePos, str.GetLength() - spacePos); } }