From db6110e996756672595f3d0e69b8e96977a534e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 13 Jun 2020 23:39:14 +0300 Subject: Peds, mission switcher & fixes --- src/core/General.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/core/General.h') 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; } -- cgit v1.2.3