summaryrefslogtreecommitdiffstats
path: root/src/core/General.h
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-06-14 21:59:02 +0200
committerGitHub <noreply@github.com>2020-06-14 21:59:02 +0200
commitf64d3ad7de85bfd2f3e9aac4530f1e255b542295 (patch)
tree8d0c6b4e752fcfaf4d2d0237bed786c2de9e7e84 /src/core/General.h
parentMerge pull request #625 from aap/miami (diff)
parentPeds, mission switcher & fixes (diff)
downloadre3-f64d3ad7de85bfd2f3e9aac4530f1e255b542295.tar
re3-f64d3ad7de85bfd2f3e9aac4530f1e255b542295.tar.gz
re3-f64d3ad7de85bfd2f3e9aac4530f1e255b542295.tar.bz2
re3-f64d3ad7de85bfd2f3e9aac4530f1e255b542295.tar.lz
re3-f64d3ad7de85bfd2f3e9aac4530f1e255b542295.tar.xz
re3-f64d3ad7de85bfd2f3e9aac4530f1e255b542295.tar.zst
re3-f64d3ad7de85bfd2f3e9aac4530f1e255b542295.zip
Diffstat (limited to 'src/core/General.h')
-rw-r--r--src/core/General.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/General.h b/src/core/General.h
index 3188d82b..dbf169e9 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -134,6 +134,18 @@ public:
return *str2 != '\0';
}
+ static bool SolveQuadratic(float a, float b, float c, float &root1, float &root2)
+ {
+ float discriminant = b * b - 4.f * a * c;
+ if (discriminant < 0.f)
+ return false;
+
+ float discriminantSqrt = Sqrt(discriminant);
+ root2 = (-b + discriminantSqrt) / (2.f * a);
+ root1 = (-b - discriminantSqrt) / (2.f * a);
+ return true;
+ }
+
// not too sure about all these...
static uint16 GetRandomNumber(void)
{ return myrand() & MYRAND_MAX; }