|
|
@ -2,6 +2,8 @@
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
|
|
#include "common/common.h"
|
|
|
|
#include "common/common.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "core/core.h"
|
|
|
|
#include "core/core.h"
|
|
|
@ -37,7 +39,7 @@ Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ObjectPool::IsValid(Handle handle) {
|
|
|
|
bool ObjectPool::IsValid(Handle handle) const {
|
|
|
|
int index = handle - HANDLE_OFFSET;
|
|
|
|
int index = handle - HANDLE_OFFSET;
|
|
|
|
if (index < 0)
|
|
|
|
if (index < 0)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -75,13 +77,8 @@ void ObjectPool::List() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ObjectPool::GetCount() {
|
|
|
|
int ObjectPool::GetCount() const {
|
|
|
|
int count = 0;
|
|
|
|
return std::count(occupied.begin(), occupied.end(), true);
|
|
|
|
for (int i = 0; i < MAX_COUNT; i++) {
|
|
|
|
|
|
|
|
if (occupied[i])
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Object* ObjectPool::CreateByIDType(int type) {
|
|
|
|
Object* ObjectPool::CreateByIDType(int type) {
|
|
|
|