small fixes

This commit is contained in:
aap 2020-05-07 21:56:09 +02:00
parent 3ae10c93ac
commit a8f1505517
4 changed files with 15 additions and 3 deletions

View File

@ -1360,7 +1360,7 @@ CStreaming::StreamZoneModels(const CVector &pos)
// unload pevious group // unload pevious group
if(ms_currentPedGrp != -1) 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) if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
break; break;
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]); SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
@ -1369,7 +1369,7 @@ CStreaming::StreamZoneModels(const CVector &pos)
ms_currentPedGrp = info.pedGroup; 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) if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
break; break;
RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE); RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE);

View File

@ -17,6 +17,16 @@ public:
void clear(void){ void clear(void){
this->allocPtr = 0; 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<typename T, typename U = T> template<typename T, typename U = T>

View File

@ -48,7 +48,7 @@ public:
m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck
} }
char *GetName(void) { return m_name; } char *GetName(void) { return m_name; }
void SetName(const char *name) { strncpy(m_name, name, 24); } void SetName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
void SetColModel(CColModel *col, bool owns = false){ void SetColModel(CColModel *col, bool owns = false){
m_colModel = col; m_bOwnsColModel = owns; } m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; } CColModel *GetColModel(void) { return m_colModel; }

View File

@ -1,3 +1,5 @@
#pragma once
enum { enum {
EFFECT_LIGHT, EFFECT_LIGHT,
EFFECT_PARTICLE, EFFECT_PARTICLE,