From a8f1505517f1baf061fe6b545906eaed09f851b8 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 7 May 2020 21:56:09 +0200 Subject: small fixes --- src/core/Streaming.cpp | 4 ++-- src/core/templates.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 72630d57..5aa419b1 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1360,7 +1360,7 @@ CStreaming::StreamZoneModels(const CVector &pos) // unload pevious group if(ms_currentPedGrp != -1) - for(i = 0; i < 8; i++){ + for(i = 0; i < NUMMODELSPERPEDGROUP; i++){ if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1) break; SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]); @@ -1369,7 +1369,7 @@ CStreaming::StreamZoneModels(const CVector &pos) ms_currentPedGrp = info.pedGroup; - for(i = 0; i < 8; i++){ + for(i = 0; i < NUMMODELSPERPEDGROUP; i++){ if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1) break; RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE); diff --git a/src/core/templates.h b/src/core/templates.h index 921b109a..69844fa4 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -17,6 +17,16 @@ public: void clear(void){ this->allocPtr = 0; } + int getIndex(T *item){ + assert(item >= &this->store[0]); + assert(item < &this->store[n]); + return item - this->store; + } + T *getItem(int index){ + assert(index >= 0); + assert(index < n); + return &this->store[index]; + } }; template -- cgit v1.2.3