mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Properly construct all objects that has been allocated with AddObjectAt()
This commit is contained in:
parent
330b45a1ed
commit
0b12d160bb
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2008 the OpenMoHAA team
|
||||
Copyright (C) 2025 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
|
@ -216,11 +216,17 @@ int Container<Type>::AddUniqueObject(const Type& obj)
|
|||
template<class Type>
|
||||
void Container<Type>::AddObjectAt(int index, const Type& obj)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (index > maxobjects) {
|
||||
Resize(index);
|
||||
}
|
||||
|
||||
if (index > numobjects) {
|
||||
for (i = numobjects; i < index; i++) {
|
||||
new (objlist + i) Type();
|
||||
}
|
||||
|
||||
numobjects = index;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue