diff --git a/Engine/source/core/strings/stringFunctions.h b/Engine/source/core/strings/stringFunctions.h index 92602fd21..32396701a 100644 --- a/Engine/source/core/strings/stringFunctions.h +++ b/Engine/source/core/strings/stringFunctions.h @@ -59,6 +59,11 @@ inline S32 dStrcmp(const char *str1, const char *str2) return strcmp(str1, str2); } +inline bool dStrIsEmpty(const char *src) +{ + return src == 0 || !dStrcmp(src, ""); +} + inline S32 dStrncmp(const char *str1, const char *str2, dsize_t len) { return strncmp(str1, str2, len); diff --git a/Engine/source/gui/worldEditor/terrainEditor.cpp b/Engine/source/gui/worldEditor/terrainEditor.cpp index 2936f3964..bb5dcf5d8 100644 --- a/Engine/source/gui/worldEditor/terrainEditor.cpp +++ b/Engine/source/gui/worldEditor/terrainEditor.cpp @@ -2761,9 +2761,9 @@ DefineConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, (const char * if(tEditor == NULL) return 0; Point3F pos; - if(ptOrX != "" && Y == "" && Z == "") + if(!dStrIsEmpty(ptOrX) && dStrIsEmpty(Y) && dStrIsEmpty(Z)) dSscanf(ptOrX, "%f %f %f", &pos.x, &pos.y, &pos.z); - else if(ptOrX != "" && Y != "" && Z != "") + else if(!dStrIsEmpty(ptOrX) && !dStrIsEmpty(Y) && !dStrIsEmpty(Z)) { pos.x = dAtof(ptOrX); pos.y = dAtof(Y);