kernel: Shorten GetCount
This commit is contained in:
parent
9b68d5e074
commit
208598dbe2
@ -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"
|
||||||
@ -76,12 +78,7 @@ void ObjectPool::List() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ObjectPool::GetCount() const {
|
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user