summaryrefslogtreecommitdiff
path: root/src/helpers/MiscFunctions.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2022-09-28 19:28:13 +0100
committerGitHub <noreply@github.com>2022-09-28 19:28:13 +0100
commit31cb4c49d9f977d4cb0876cf1124bf9e86a60669 (patch)
tree2bd8c4f182167b587fa243f37dd3760fabdc9ec7 /src/helpers/MiscFunctions.cpp
parentec5ffe8839c9c993fed4c23d72077969615dd298 (diff)
parent11ee78f88bb811a8998b2dc7499c003289a24b1f (diff)
Merge pull request #743 from Dickby/use_double_literals
Use double literals, don't cast integer or float literals to double.
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
-rw-r--r--src/helpers/MiscFunctions.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index b2f3a086..17e7a1a1 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -286,7 +286,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
if (PWORKSPACE)
result = PWORKSPACE->m_iID;
}
-
+
outName = std::to_string(result);
}
}
@@ -295,8 +295,8 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
}
float vecToRectDistanceSquared(const Vector2D& vec, const Vector2D& p1, const Vector2D& p2) {
- const float DX = std::max((double)0, std::max(p1.x - vec.x, vec.x - p2.x));
- const float DY = std::max((double)0, std::max(p1.y - vec.y, vec.y - p2.y));
+ const float DX = std::max({0.0, p1.x - vec.x, vec.x - p2.x});
+ const float DY = std::max({0.0, p1.y - vec.y, vec.y - p2.y});
return DX * DX + DY * DY;
}