Merge pull request #248 from lioncash/kernel
Misc minor kernel-related changes.
This commit is contained in:
		@@ -2,6 +2,8 @@
 | 
			
		||||
// Licensed under GPLv2
 | 
			
		||||
// Refer to the license.txt file included.
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include "common/common.h"
 | 
			
		||||
 | 
			
		||||
#include "core/core.h"
 | 
			
		||||
@@ -37,7 +39,7 @@ Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) {
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ObjectPool::IsValid(Handle handle) {
 | 
			
		||||
bool ObjectPool::IsValid(Handle handle) const {
 | 
			
		||||
    int index = handle - HANDLE_OFFSET;
 | 
			
		||||
    if (index < 0)
 | 
			
		||||
        return false;
 | 
			
		||||
@@ -75,13 +77,8 @@ void ObjectPool::List() {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObjectPool::GetCount() {
 | 
			
		||||
    int count = 0;
 | 
			
		||||
    for (int i = 0; i < MAX_COUNT; i++) {
 | 
			
		||||
        if (occupied[i])
 | 
			
		||||
            count++;
 | 
			
		||||
    }
 | 
			
		||||
    return count;
 | 
			
		||||
int ObjectPool::GetCount() const {
 | 
			
		||||
    return std::count(occupied.begin(), occupied.end(), true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Object* ObjectPool::CreateByIDType(int type) {
 | 
			
		||||
 
 | 
			
		||||
@@ -86,7 +86,7 @@ public:
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool IsValid(Handle handle);
 | 
			
		||||
    bool IsValid(Handle handle) const;
 | 
			
		||||
 | 
			
		||||
    template <class T>
 | 
			
		||||
    T* Get(Handle handle) {
 | 
			
		||||
@@ -142,7 +142,7 @@ public:
 | 
			
		||||
    Object* &operator [](Handle handle);
 | 
			
		||||
    void List();
 | 
			
		||||
    void Clear();
 | 
			
		||||
    int GetCount();
 | 
			
		||||
    int GetCount() const;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user