From a55e738dfad92ae7e23e45c3593384b9469f1177 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 9 May 2020 20:21:13 +0300 Subject: ccarctrl big fix --- src/core/General.h | 2 ++ src/core/Placeable.h | 2 +- src/core/templates.h | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/General.h b/src/core/General.h index 7ffa99de..3188d82b 100644 --- a/src/core/General.h +++ b/src/core/General.h @@ -145,4 +145,6 @@ public: static int32 GetRandomNumberInRange(int32 low, int32 high) { return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); } + static void SetRandomSeed(int32 seed) + { mysrand(seed); } }; diff --git a/src/core/Placeable.h b/src/core/Placeable.h index 7e858283..26a2291a 100644 --- a/src/core/Placeable.h +++ b/src/core/Placeable.h @@ -16,7 +16,7 @@ public: m_matrix.GetPosition().y = y; m_matrix.GetPosition().z = z; } - void SetPosition(const CVector &pos) { m_matrix.GetPosition() = pos; } + void SetPosition(const CVector& pos) { m_matrix.GetPosition() = pos; } CVector &GetRight(void) { return m_matrix.GetRight(); } CVector &GetForward(void) { return m_matrix.GetForward(); } CVector &GetUp(void) { return m_matrix.GetUp(); } diff --git a/src/core/templates.h b/src/core/templates.h index aa71fe5d..465e3bef 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -133,7 +133,7 @@ public: // TODO: the cast is unsafe return (int)((U*)entry - m_entries); } - int GetNoOfUsedSpaces(void){ + int GetNoOfUsedSpaces(void) const { int i; int n = 0; for(i = 0; i < m_size; i++) @@ -164,6 +164,7 @@ public: memcpy(entries, m_entries, sizeof(U)*m_size); debug("Stored:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */ } + int32 GetNoOfFreeSpaces() const { return GetSize() - GetNoOfUsedSpaces(); } }; template -- cgit v1.2.3