2
0
Daniele Bartolini 11 жил өмнө
parent
commit
7f1c67aa48

+ 49 - 49
engine/core/containers/array.h

@@ -101,36 +101,36 @@ namespace array
 	template <typename T>
 	inline bool empty(const Array<T>& a)
 	{
-		return a.m_size == 0;
+		return a._size == 0;
 	}
 
 	template <typename T>
 	inline uint32_t size(const Array<T>& a)
 	{
-		return a.m_size;
+		return a._size;
 	}
 
 	template <typename T>
 	inline uint32_t capacity(const Array<T>& a)
 	{
-		return a.m_capacity;
+		return a._capacity;
 	}
 
 	template <typename T>
 	inline void resize(Array<T>& a, uint32_t size)
 	{
-		if (size > a.m_capacity)
+		if (size > a._capacity)
 		{
 			set_capacity(a, size);
 		}
 
-		a.m_size = size;
+		a._size = size;
 	}
 
 	template <typename T>
 	inline void reserve(Array<T>& a, uint32_t capacity)
 	{
-		if (capacity > a.m_capacity)
+		if (capacity > a._capacity)
 		{
 			grow(a, capacity);
 		}
@@ -139,28 +139,28 @@ namespace array
 	template <typename T>
 	inline void set_capacity(Array<T>& a, uint32_t capacity)
 	{
-		if (capacity == a.m_capacity)
+		if (capacity == a._capacity)
 		{
 			return;
 		}
 
-		if (capacity < a.m_size)
+		if (capacity < a._size)
 		{
 			resize(a, capacity);
 		}
 
 		if (capacity > 0)
 		{
-			T* tmp = a.m_array;
-			a.m_capacity = capacity;
+			T* tmp = a._array;
+			a._capacity = capacity;
 
-			a.m_array = (T*)a.m_allocator->allocate(capacity * sizeof(T), CE_ALIGNOF(T));
+			a._array = (T*)a._allocator->allocate(capacity * sizeof(T), CE_ALIGNOF(T));
 
-			memcpy(a.m_array, tmp, a.m_size * sizeof(T));
+			memcpy(a._array, tmp, a._size * sizeof(T));
 
 			if (tmp)
 			{
-				a.m_allocator->deallocate(tmp);
+				a._allocator->deallocate(tmp);
 			}
 		}
 	}
@@ -168,7 +168,7 @@ namespace array
 	template <typename T>
 	inline void grow(Array<T>& a, uint32_t min_capacity)
 	{
-		uint32_t new_capacity = a.m_capacity * 2 + 1;
+		uint32_t new_capacity = a._capacity * 2 + 1;
 
 		if (new_capacity < min_capacity)
 		{
@@ -181,123 +181,123 @@ namespace array
 	template <typename T>
 	inline void condense(Array<T>& a)
 	{
-		resize(a, a.m_size);
+		resize(a, a._size);
 	}
 
 	template <typename T>
 	inline uint32_t push_back(Array<T>& a, const T& item)
 	{
-		if (a.m_capacity == a.m_size)
+		if (a._capacity == a._size)
 		{
 			grow(a, 0);
 		}
 
-		a.m_array[a.m_size] = item;
+		a._array[a._size] = item;
 
-		return 	a.m_size++;
+		return 	a._size++;
 	}
 
 	template <typename T>
 	inline void pop_back(Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The array is empty");
+		CE_ASSERT(a._size > 0, "The array is empty");
 
-		a.m_size--;
+		a._size--;
 	}
 
 	template <typename T>
 	inline uint32_t push(Array<T>& a, const T* items, uint32_t count)
 	{
-		if (a.m_capacity <= a.m_size + count)
+		if (a._capacity <= a._size + count)
 		{
-			grow(a, a.m_size + count);
+			grow(a, a._size + count);
 		}
 
-		memcpy(&a.m_array[a.m_size], items, sizeof(T) * count);
-		a.m_size += count;
+		memcpy(&a._array[a._size], items, sizeof(T) * count);
+		a._size += count;
 
-		return a.m_size;
+		return a._size;
 	}
 
 	template <typename T>
 	inline void clear(Array<T>& a)
 	{
-		a.m_size = 0;
+		a._size = 0;
 	}
 
 	template <typename T>
 	inline const T* begin(const Array<T>& a)
 	{
-		return a.m_array;
+		return a._array;
 	}
 
 	template <typename T>
 	inline T* begin(Array<T>& a)
 	{
-		return a.m_array;
+		return a._array;
 	}
 
 	template <typename T>
 	inline const T* end(const Array<T>& a)
 	{
-		return a.m_array + a.m_size;
+		return a._array + a._size;
 	}
 
 	template <typename T>
 	inline T* end(Array<T>& a)
 	{
-		return a.m_array + a.m_size;
+		return a._array + a._size;
 	}
 
 	template <typename T>
 	inline T& front(Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The array is empty");
+		CE_ASSERT(a._size > 0, "The array is empty");
 
-		return a.m_array[0];
+		return a._array[0];
 	}
 
 	template <typename T>
 	inline const T& front(const Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The array is empty");
+		CE_ASSERT(a._size > 0, "The array is empty");
 
-		return a.m_array[0];
+		return a._array[0];
 	}
 
 	template <typename T>
 	inline T& back(Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The array is empty");
+		CE_ASSERT(a._size > 0, "The array is empty");
 
-		return a.m_array[a.m_size - 1];
+		return a._array[a._size - 1];
 	}
 
 	template <typename T>
 	inline const T& back(const Array<T>& a)
 	{
-		CE_ASSERT(a.m_size > 0, "The array is empty");
+		CE_ASSERT(a._size > 0, "The array is empty");
 
-		return a.m_array[a.m_size - 1];
+		return a._array[a._size - 1];
 	}
 } // namespace array
 
 template <typename T>
 inline Array<T>::Array(Allocator& allocator)
-	: m_allocator(&allocator), m_capacity(0), m_size(0), m_array(NULL)
+	: _allocator(&allocator), _capacity(0), _size(0), _array(NULL)
 {
 }
 
 template <typename T>
 inline Array<T>::Array(Allocator& allocator, uint32_t capacity)
-	: m_allocator(&allocator), m_capacity(0), m_size(0), m_array(NULL)
+	: _allocator(&allocator), _capacity(0), _size(0), _array(NULL)
 {
 	array::resize(*this, capacity);
 }
 
 template <typename T>
 inline Array<T>::Array(const Array<T>& other)
-	: m_allocator(other.m_allocator), m_capacity(0), m_size(0), m_array(NULL)
+	: _allocator(other._allocator), _capacity(0), _size(0), _array(NULL)
 {
 	*this = other;
 }
@@ -305,34 +305,34 @@ inline Array<T>::Array(const Array<T>& other)
 template <typename T>
 inline Array<T>::~Array()
 {
-	if (m_array)
+	if (_array)
 	{
-		m_allocator->deallocate(m_array);
+		_allocator->deallocate(_array);
 	}
 }
 
 template <typename T>
 inline T& Array<T>::operator[](uint32_t index)
 {
-	CE_ASSERT(index < m_size, "Index out of bounds");
+	CE_ASSERT(index < _size, "Index out of bounds");
 
-	return m_array[index];
+	return _array[index];
 }
 
 template <typename T>
 inline const T& Array<T>::operator[](uint32_t index) const
 {
-	CE_ASSERT(index < m_size, "Index out of bounds");
+	CE_ASSERT(index < _size, "Index out of bounds");
 
-	return m_array[index];
+	return _array[index];
 }
 
 template <typename T>
 inline Array<T>& Array<T>::operator=(const Array<T>& other)
 {
-	const uint32_t size = other.m_size;
+	const uint32_t size = other._size;
 	array::resize(*this, size);
-	memcpy(m_array, other.m_array, sizeof(T) * size);
+	memcpy(_array, other._array, sizeof(T) * size);
 	return *this;
 }
 

+ 7 - 7
engine/core/containers/blob.h

@@ -37,8 +37,8 @@ namespace crown
 /// @ingroup Containers
 struct Blob
 {
-	uint32_t m_size;
-	uintptr_t m_data;
+	uint32_t _size;
+	uintptr_t _data;
 };
 
 /// Functions to manipulate Blob.
@@ -60,21 +60,21 @@ namespace blob
 {
 	inline uint32_t size(const Blob& b)
 	{
-		return b.m_size;
+		return b._size;
 	}
 
 	template <typename T>
 	inline const T* get(const Blob& b, uint32_t offset)
 	{
-		CE_ASSERT(offset < b.m_size, "Overflow (size = %d, offset = %d", b.m_size, offset);
-		return (T*) b.m_data + offset;
+		CE_ASSERT(offset < b._size, "Overflow (size = %d, offset = %d", b._size, offset);
+		return (T*) b._data + offset;
 	}
 
 	template <typename T>
 	inline T* get(Blob& b, uint32_t offset)
 	{
-		CE_ASSERT(offset < b.m_size, "Overflow (size = %d, offset = %d", b.m_size, offset);
-		return (T*) b.m_data + offset;
+		CE_ASSERT(offset < b._size, "Overflow (size = %d, offset = %d", b._size, offset);
+		return (T*) b._data + offset;
 	}
 } // namespace blob
 } // namespace crown

+ 14 - 14
engine/core/containers/container_types.h

@@ -56,10 +56,10 @@ struct Array
 
 	Array<T>& operator=(const Array<T>& other);
 
-	Allocator* m_allocator;
-	uint32_t m_capacity;
-	uint32_t m_size;
-	T* m_array;
+	Allocator* _allocator;
+	uint32_t _capacity;
+	uint32_t _size;
+	T* _array;
 };
 
 /// Dynamic array of objects.
@@ -82,7 +82,7 @@ struct Vector
 
 	const Vector<T>& operator=(const Vector<T>& other);
 
-	Array<T> m_array;
+	Array<T> _array;
 };
 
 /// Circular buffer double-ended queue of POD items.
@@ -101,9 +101,9 @@ struct Queue
 	/// Random access by index
 	const T& operator[](uint32_t index) const;
 
-	uint32_t m_read;
-	uint32_t m_size;
-	Array<T> m_queue;
+	uint32_t _read;
+	uint32_t _size;
+	Array<T> _queue;
 };
 
 /// Priority queue of POD items.
@@ -114,7 +114,7 @@ struct PriorityQueue
 {
 	PriorityQueue(Allocator& a);
 
-	Array<T> m_queue;
+	Array<T> _queue;
 };
 
 /// Hash from an uint64_t to POD items. If you want to use a generic key
@@ -156,9 +156,9 @@ struct Map
 		uint32_t color;
 	};
 
-	uint32_t m_root;
-	uint32_t m_sentinel;
-	Vector<Node> m_data;
+	uint32_t _root;
+	uint32_t _sentinel;
+	Vector<Node> _data;
 };
 
 /// Sorted map from key to POD items.
@@ -175,8 +175,8 @@ struct SortMap
 		TValue value;
 	};
 
-	bool m_is_sorted;
-	Array<Entry> m_data;
+	bool _is_sorted;
+	Array<Entry> _data;
 };
 
 } // namespace crown

+ 44 - 44
engine/core/containers/id_array.h

@@ -48,18 +48,18 @@ struct IdArray
 	const T& operator[](uint32_t i) const;
 
 	// The index of the first unused id
-	uint16_t m_freelist;
+	uint16_t _freelist;
 
 	// Next available unique id
-	uint16_t m_next_id;
-	uint16_t m_size;
+	uint16_t _next_id;
+	uint16_t _size;
 
 	// The last valid id is reserved and cannot be used to
 	// refer to Ids from the outside
-	Id m_sparse[MAX];
-	uint16_t m_sparse_to_dense[MAX];
-	uint16_t m_dense_to_sparse[MAX];
-	T m_objects[MAX];
+	Id _sparse[MAX];
+	uint16_t _sparse_to_dense[MAX];
+	uint16_t _dense_to_sparse[MAX];
+	T _objects[MAX];
 };
 
 /// Functions to manipulate IdArray.
@@ -94,28 +94,28 @@ namespace id_array
 	template <uint32_t MAX, typename T>
 	inline Id create(IdArray<MAX, T>& a, const T& object)
 	{
-		CE_ASSERT(a.m_size < MAX, "Object list full");
+		CE_ASSERT(a._size < MAX, "Object list full");
 
 		// Obtain a new id
 		Id id;
-		id.id = a.m_next_id++;
+		id.id = a._next_id++;
 
 		// Recycle slot if there are any
-		if (a.m_freelist != INVALID_ID)
+		if (a._freelist != INVALID_ID)
 		{
-			id.index = a.m_freelist;
-			a.m_freelist = a.m_sparse[a.m_freelist].index;
+			id.index = a._freelist;
+			a._freelist = a._sparse[a._freelist].index;
 		}
 		else
 		{
-			id.index = a.m_size;
+			id.index = a._size;
 		}
 
-		a.m_sparse[id.index] = id;
-		a.m_sparse_to_dense[id.index] = a.m_size;
-		a.m_dense_to_sparse[a.m_size] = id.index;
-		a.m_objects[a.m_size] = object;
-		a.m_size++;
+		a._sparse[id.index] = id;
+		a._sparse_to_dense[id.index] = a._size;
+		a._dense_to_sparse[a._size] = id.index;
+		a._objects[a._size] = object;
+		a._size++;
 
 		return id;
 	}
@@ -126,21 +126,21 @@ namespace id_array
 	{
 		CE_ASSERT(has(a, id), "IdArray does not have ID: %d,%d", id.id, id.index);
 
-		a.m_sparse[id.index].id = INVALID_ID;
-		a.m_sparse[id.index].index = a.m_freelist;
-		a.m_freelist = id.index;
+		a._sparse[id.index].id = INVALID_ID;
+		a._sparse[id.index].index = a._freelist;
+		a._freelist = id.index;
 
 		// Swap with last element
-		const uint32_t last = a.m_size - 1;
-		CE_ASSERT(last >= a.m_sparse_to_dense[id.index], "Swapping with previous item");
-		a.m_objects[a.m_sparse_to_dense[id.index]] = a.m_objects[last];
+		const uint32_t last = a._size - 1;
+		CE_ASSERT(last >= a._sparse_to_dense[id.index], "Swapping with previous item");
+		a._objects[a._sparse_to_dense[id.index]] = a._objects[last];
 
 		// Update tables
-		uint16_t std = a.m_sparse_to_dense[id.index];
-		uint16_t dts = a.m_dense_to_sparse[last];
-		a.m_sparse_to_dense[dts] = std;
-		a.m_dense_to_sparse[std] = dts;
-		a.m_size--;
+		uint16_t std = a._sparse_to_dense[id.index];
+		uint16_t dts = a._dense_to_sparse[last];
+		a._sparse_to_dense[dts] = std;
+		a._dense_to_sparse[std] = dts;
+		a._size--;
 	}
 
 	//-----------------------------------------------------------------------------
@@ -149,62 +149,62 @@ namespace id_array
 	{
 		CE_ASSERT(has(a, id), "IdArray does not have ID: %d,%d", id.id, id.index);
 
-		return a.m_objects[a.m_sparse_to_dense[id.index]];
+		return a._objects[a._sparse_to_dense[id.index]];
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX, typename T>
 	inline bool has(const IdArray<MAX, T>& a, Id id)
 	{
-		return id.index < MAX && a.m_sparse[id.index].id == id.id;
+		return id.index < MAX && a._sparse[id.index].id == id.id;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX, typename T>
 	inline uint32_t size(const IdArray<MAX, T>& a)
 	{
-		return a.m_size;
+		return a._size;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX, typename T>
 	inline T* begin(IdArray<MAX, T>& a)
 	{
-		return a.m_objects;
+		return a._objects;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX, typename T>
 	inline const T* begin(const IdArray<MAX, T>& a)
 	{
-		return a.m_objects;
+		return a._objects;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX, typename T>
 	inline T* end(IdArray<MAX, T>& a)
 	{
-		return a.m_objects + a.m_size;
+		return a._objects + a._size;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX, typename T>
 	inline const T* end(const IdArray<MAX, T>& a)
 	{
-		return a.m_objects + a.m_size;
+		return a._objects + a._size;
 	}
 } // namespace id_array
 
 //-----------------------------------------------------------------------------
 template <uint32_t MAX, typename T>
 inline IdArray<MAX, T>::IdArray()
-	: m_freelist(INVALID_ID)
-	, m_next_id(0)
-	, m_size(0)
+	: _freelist(INVALID_ID)
+	, _next_id(0)
+	, _size(0)
 {
 	for (uint32_t i = 0; i < MAX; i++)
 	{
-		m_sparse[i].id = INVALID_ID;
+		_sparse[i].id = INVALID_ID;
 	}
 }
 
@@ -212,16 +212,16 @@ inline IdArray<MAX, T>::IdArray()
 template <uint32_t MAX, typename T>
 inline T& IdArray<MAX, T>::operator[](uint32_t i)
 {
-	CE_ASSERT(i < m_size, "Index out of bounds");
-	return m_objects[i];
+	CE_ASSERT(i < _size, "Index out of bounds");
+	return _objects[i];
 }
 
 //-----------------------------------------------------------------------------
 template <uint32_t MAX, typename T>
 inline const T& IdArray<MAX, T>::operator[](uint32_t i) const
 {
-	CE_ASSERT(i < m_size, "Index out of bounds");
-	return m_objects[i];
+	CE_ASSERT(i < _size, "Index out of bounds");
+	return _objects[i];
 }
 
 } // namespace crown

+ 23 - 23
engine/core/containers/id_table.h

@@ -43,16 +43,16 @@ struct IdTable
 	IdTable();
 
 	// The index of the first unused id.
-	uint16_t m_freelist;
+	uint16_t _freelist;
 
 	// Next available unique id.
-	uint16_t m_next_id;
-	uint16_t m_size;
+	uint16_t _next_id;
+	uint16_t _size;
 
 	// Table of ids.
 	// The last valid id is reserved and cannot be used to
 	// refer to Ids from the outside.
-	Id m_ids[MAX];
+	Id _ids[MAX];
 };
 
 /// Functions to manipulate IdTable.
@@ -84,21 +84,21 @@ namespace id_table
 	{
 		// Obtain a new id
 		Id id;
-		id.id = a.m_next_id++;
+		id.id = a._next_id++;
 
 		// Recycle slot if there are any
-		if (a.m_freelist != INVALID_ID)
+		if (a._freelist != INVALID_ID)
 		{
-			id.index = a.m_freelist;
-			a.m_freelist = a.m_ids[a.m_freelist].index;
+			id.index = a._freelist;
+			a._freelist = a._ids[a._freelist].index;
 		}
 		else
 		{
-			id.index = a.m_size;
+			id.index = a._size;
 		}
 
-		a.m_ids[id.index] = id;
-		a.m_size++;
+		a._ids[id.index] = id;
+		a._size++;
 
 		return id;
 	}
@@ -109,51 +109,51 @@ namespace id_table
 	{
 		CE_ASSERT(has(a, id), "IdTable does not have ID: %d,%d", id.id, id.index);
 
-		a.m_ids[id.index].id = INVALID_ID;
-		a.m_ids[id.index].index = a.m_freelist;
-		a.m_freelist = id.index;
-		a.m_size--;
+		a._ids[id.index].id = INVALID_ID;
+		a._ids[id.index].index = a._freelist;
+		a._freelist = id.index;
+		a._size--;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX>
 	inline bool has(const IdTable<MAX>& a, Id id)
 	{
-		return id.index < MAX && a.m_ids[id.index].id == id.id;
+		return id.index < MAX && a._ids[id.index].id == id.id;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX>
 	inline uint16_t size(const IdTable<MAX>& a)
 	{
-		return a.m_size;
+		return a._size;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX>
 	inline const Id* begin(const IdTable<MAX>& a)
 	{
-		return a.m_ids;
+		return a._ids;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <uint32_t MAX>
 	inline const Id* end(const IdTable<MAX>& a)
 	{
-		return a.m_ids + MAX;
+		return a._ids + MAX;
 	}
 } // namespace id_table
 
 //-----------------------------------------------------------------------------
 template <uint32_t MAX>
 inline IdTable<MAX>::IdTable()
-	: m_freelist(INVALID_ID)
-	, m_next_id(0)
-	, m_size(0)
+	: _freelist(INVALID_ID)
+	, _next_id(0)
+	, _size(0)
 {
 	for (uint32_t i = 0; i < MAX; i++)
 	{
-		m_ids[i].id = INVALID_ID;
+		_ids[i].id = INVALID_ID;
 	}
 }
 

+ 141 - 141
engine/core/containers/map.h

@@ -74,56 +74,56 @@ namespace map_internal
 	template <typename TKey, typename TValue>
 	inline uint32_t root(const Map<TKey, TValue>& m)
 	{
-		return m.m_root;
+		return m._root;
 	}
 
 	template <typename TKey, typename TValue>
 	inline uint32_t parent(const Map<TKey, TValue>& m, uint32_t n)
 	{
-		CE_ASSERT(n < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), n);
-		return m.m_data[n].parent;
+		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
+		return m._data[n].parent;
 	}
 
 	template <typename TKey, typename TValue>
 	inline uint32_t left(const Map<TKey, TValue>& m, uint32_t n)
 	{
-		CE_ASSERT(n < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), n);
-		return m.m_data[n].left;
+		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
+		return m._data[n].left;
 	}
 
 	template <typename TKey, typename TValue>
 	inline uint32_t right(const Map<TKey, TValue>& m, uint32_t n)
 	{
-		CE_ASSERT(n < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), n);
-		return m.m_data[n].right;
+		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
+		return m._data[n].right;
 	}
 
 	template <typename TKey, typename TValue>
 	inline uint32_t color(const Map<TKey, TValue>& m, uint32_t n)
 	{
-		CE_ASSERT(n < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), n);
-		return m.m_data[n].color;
+		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
+		return m._data[n].color;
 	}
 
 	#ifdef RBTREE_VERIFY
 	template<typename TKey, typename TValue>
 	inline int32_t dbg_verify(Map<TKey, TValue>& m, uint32_t n)
 	{
-		if (n == m.m_sentinel)
+		if (n == m._sentinel)
 		{
 			return 0;
 		}
 
-		if (left(m, n) != m.m_sentinel)
+		if (left(m, n) != m._sentinel)
 		{
 			CE_ASSERT(parent(m, left(m, n)) == n, "Bad RBTree");
-			CE_ASSERT(m.m_data[left(m, n)].key < m.m_data[n].key, "Bad RBTree");
+			CE_ASSERT(m._data[left(m, n)].key < m._data[n].key, "Bad RBTree");
 		}
 
-		if (right(m, n) != m.m_sentinel)
+		if (right(m, n) != m._sentinel)
 		{
 			CE_ASSERT(parent(m, right(m, n)) == n, "Bad RBTree");
-			CE_ASSERT(m.m_data[n].key < m.m_data[right(m, n)].key, "Bad RBTree");
+			CE_ASSERT(m._data[n].key < m._data[right(m, n)].key, "Bad RBTree");
 		}
 
 		int32_t bhL = dbg_verify(m, left(m, n));
@@ -148,7 +148,7 @@ namespace map_internal
 	template<typename TKey, typename TValue>
 	inline int32_t dump(Map<TKey, TValue>& m)
 	{
-		for (uint32_t i = 0; i < vector::size(m.m_data); i++)
+		for (uint32_t i = 0; i < vector::size(m._data); i++)
 		{
 			printf("%d = [%d, %d, %d] ", i, parent(m, i), left(m, i), right(m, i));
 		}
@@ -160,12 +160,12 @@ namespace map_internal
 	template <typename TKey, typename TValue>
 	inline uint32_t min(const Map<TKey, TValue>& m, uint32_t x)
 	{
-		if (x == m.m_sentinel)
+		if (x == m._sentinel)
 		{
 			return x;
 		}
 
-		while (left(m, x) != m.m_sentinel)
+		while (left(m, x) != m._sentinel)
 		{
 			x = left(m, x);
 		}
@@ -176,12 +176,12 @@ namespace map_internal
 	template <typename TKey, typename TValue>
 	inline uint32_t max(const Map<TKey, TValue>& m, uint32_t x)
 	{
-		if (x == m.m_sentinel)
+		if (x == m._sentinel)
 		{
 			return x;
 		}
 
-		while (right(m, x) != m.m_sentinel)
+		while (right(m, x) != m._sentinel)
 		{
 			x = right(m, x);
 		}
@@ -192,7 +192,7 @@ namespace map_internal
 	template <typename TKey, typename TValue>
 	inline uint32_t successor(const Map<TKey, TValue>& m, uint32_t x)
 	{
-		if (right(m, x) != m.m_sentinel)
+		if (right(m, x) != m._sentinel)
 		{
 			return min(m, right(m, x));
 		}
@@ -211,7 +211,7 @@ namespace map_internal
 	template <typename TKey, typename TValue>
 	inline uint32_t predecessor(const Map<TKey, TValue>& m, uint32_t x)
 	{
-		if (left(m, x) != m.m_sentinel)
+		if (left(m, x) != m._sentinel)
 		{
 			return max(m, left(m, x));
 		}
@@ -230,90 +230,90 @@ namespace map_internal
 	template <typename TKey, typename TValue>
 	inline void rotate_left(Map<TKey, TValue>& m, uint32_t x)
 	{
-		CE_ASSERT(x < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), x);
+		CE_ASSERT(x < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), x);
 
 		uint32_t y = right(m, x);
-		m.m_data[x].right = left(m, y);
+		m._data[x].right = left(m, y);
 
-		if (left(m, y) != m.m_sentinel)
+		if (left(m, y) != m._sentinel)
 		{
-			m.m_data[left(m, y)].parent = x;
+			m._data[left(m, y)].parent = x;
 		}
 
-		m.m_data[y].parent = parent(m, x);
+		m._data[y].parent = parent(m, x);
 
 		if (parent(m, x) == NIL)
 		{
-			m.m_root = y;
+			m._root = y;
 		}
 		else
 		{
 			if (x == left(m, parent(m, x)))
 			{
-				m.m_data[parent(m, x)].left = y;
+				m._data[parent(m, x)].left = y;
 			}
 			else
 			{
-				m.m_data[parent(m, x)].right = y;
+				m._data[parent(m, x)].right = y;
 			}
 		}
 
-		m.m_data[y].left = x;
-		m.m_data[x].parent = y;
+		m._data[y].left = x;
+		m._data[x].parent = y;
 	}
 
 	template <typename TKey, typename TValue>
 	inline void rotate_right(Map<TKey, TValue>& m, uint32_t x)
 	{
-		CE_ASSERT(x < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), x);
+		CE_ASSERT(x < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), x);
 
 		uint32_t y = left(m, x);
-		m.m_data[x].left = right(m, y);
+		m._data[x].left = right(m, y);
 
-		if (right(m, y) != m.m_sentinel)
+		if (right(m, y) != m._sentinel)
 		{
-			m.m_data[right(m, y)].parent = x;
+			m._data[right(m, y)].parent = x;
 		}
 
-		m.m_data[y].parent = parent(m, x);
+		m._data[y].parent = parent(m, x);
 
 		if (parent(m, x) == NIL)
 		{
-			m.m_root = y;
+			m._root = y;
 		}
 		else
 		{
 			if (x == left(m, parent(m, x)))
 			{
-				m.m_data[parent(m, x)].left = y;
+				m._data[parent(m, x)].left = y;
 			}
 			else
 			{
-				m.m_data[parent(m, x)].right = y;
+				m._data[parent(m, x)].right = y;
 			}
 		}
 
-		m.m_data[y].right = x;
-		m.m_data[x].parent = y;
+		m._data[y].right = x;
+		m._data[x].parent = y;
 	}
 
 	template <typename TKey, typename TValue>
 	inline void destroy(Map<TKey, TValue>& m, uint32_t n)
 	{
-		CE_ASSERT(n < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), n);
+		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 
-		uint32_t x = vector::size(m.m_data) - 1;
+		uint32_t x = vector::size(m._data) - 1;
 
-		if (x == m.m_root)
+		if (x == m._root)
 		{
-			m.m_root = n;
+			m._root = n;
 
 			if (left(m, x) != NIL)
-				m.m_data[left(m, x)].parent = n;
+				m._data[left(m, x)].parent = n;
 			if (right(m, x) != NIL)
-				m.m_data[right(m, x)].parent = n;
+				m._data[right(m, x)].parent = n;
 
-			m.m_data[n] = m.m_data[x];
+			m._data[n] = m._data[x];
 		}
 		else
 		{
@@ -321,33 +321,33 @@ namespace map_internal
 			{
 				if (x == left(m, parent(m, x)))
 				{
-					m.m_data[parent(m, x)].left = n;
+					m._data[parent(m, x)].left = n;
 				}
 				else if (x == right(m, parent(m, x)))
 				{
-					m.m_data[parent(m, x)].right = n;
+					m._data[parent(m, x)].right = n;
 				}
 
 				if (left(m, x) != NIL)
-					m.m_data[left(m, x)].parent = n;
+					m._data[left(m, x)].parent = n;
 				if (right(m, x) != NIL)
-					m.m_data[right(m, x)].parent = n;
+					m._data[right(m, x)].parent = n;
 
-				m.m_data[n] = m.m_data[x];
+				m._data[n] = m._data[x];
 			}
 		}
 
 		#ifdef RBTREE_VERIFY
-			dbg_verify(m, m.m_root);
+			dbg_verify(m, m._root);
 		#endif
 
-		vector::pop_back(m.m_data);
+		vector::pop_back(m._data);
 	}
 
 	template <typename TKey, typename TValue>
 	inline void insert_fixup(Map<TKey, TValue>& m, uint32_t n)
 	{
-		CE_ASSERT(n < vector::size(m.m_data), "Index out of bounds (size = %d, n = %d)", vector::size(m.m_data), n);
+		CE_ASSERT(n < vector::size(m._data), "Index out of bounds (size = %d, n = %d)", vector::size(m._data), n);
 
 		uint32_t x;
 		uint32_t y;
@@ -362,9 +362,9 @@ namespace map_internal
 
 				if (color(m, y) == RED)
 				{
-					m.m_data[x].color = BLACK;
-					m.m_data[y].color = BLACK;
-					m.m_data[parent(m, x)].color = RED;
+					m._data[x].color = BLACK;
+					m._data[y].color = BLACK;
+					m._data[parent(m, x)].color = RED;
 					n = parent(m, x);
 					continue;
 				}
@@ -377,8 +377,8 @@ namespace map_internal
 						x = parent(m, n);
 					}
 
-					m.m_data[x].color = BLACK;
-					m.m_data[parent(m, x)].color = RED;
+					m._data[x].color = BLACK;
+					m._data[parent(m, x)].color = RED;
 					rotate_right(m, parent(m, x));
 				}
 			}
@@ -388,9 +388,9 @@ namespace map_internal
 
 				if (color(m, y) == RED)
 				{
-					m.m_data[x].color = BLACK;
-					m.m_data[y].color = BLACK;
-					m.m_data[parent(m, x)].color = RED;
+					m._data[x].color = BLACK;
+					m._data[y].color = BLACK;
+					m._data[parent(m, x)].color = RED;
 					n = parent(m, x);
 					continue;
 				}
@@ -403,8 +403,8 @@ namespace map_internal
 						x = parent(m, n);
 					}
 
-					m.m_data[x].color = BLACK;
-					m.m_data[parent(m, x)].color = RED;
+					m._data[x].color = BLACK;
+					m._data[parent(m, x)].color = RED;
 					rotate_left(m, parent(m, x));
 				}
 			}
@@ -414,22 +414,22 @@ namespace map_internal
 	template <typename TKey, typename TValue>
 	inline uint32_t inner_find(const Map<TKey, TValue>& m, const TKey key)
 	{
-		uint32_t x = m.m_root;
+		uint32_t x = m._root;
 
-		while (x != m.m_sentinel)
+		while (x != m._sentinel)
 		{
-			if (m.m_data[x].key < key)
+			if (m._data[x].key < key)
 			{
-				if (right(m, x) == m.m_sentinel)
+				if (right(m, x) == m._sentinel)
 				{
 					return x;
 				}
 
 				x = right(m, x);
 			}
-			else if (key < m.m_data[x].key)
+			else if (key < m._data[x].key)
 			{
-				if (left(m, x) == m.m_sentinel)
+				if (left(m, x) == m._sentinel)
 				{
 					return x;
 				}
@@ -450,7 +450,7 @@ namespace map_internal
 	{
 		uint32_t p = inner_find(m, key);
 
-		if (p != m.m_sentinel && m.m_data[p].key == key)
+		if (p != m._sentinel && m._data[p].key == key)
 			return p;
 
 		return NIL;
@@ -461,7 +461,7 @@ namespace map_internal
 	{
 		uint32_t p = inner_find(m, key);
 
-		if (p != m.m_sentinel && m.m_data[p].key == key)
+		if (p != m._sentinel && m._data[p].key == key)
 		{
 			return p;
 		}
@@ -470,32 +470,32 @@ namespace map_internal
 		n.key = key;
 		n.value = TValue();
 		n.color = RED;
-		n.left = m.m_sentinel;
-		n.right = m.m_sentinel;
+		n.left = m._sentinel;
+		n.right = m._sentinel;
 		n.parent = NIL;
 
-		if (p == m.m_sentinel)
+		if (p == m._sentinel)
 		{
-			m.m_root = n;
+			m._root = n;
 		}
 		else
 		{
-			if (key < m.m_data[p].key)
+			if (key < m._data[p].key)
 			{
-				m.m_data[p].left = n;
+				m._data[p].left = n;
 			}
 			else
 			{
-				m.m_data[p].right = n;
+				m._data[p].right = n;
 			}
 
-			m.m_data[n].parent = p;
+			m._data[n].parent = p;
 		}
 
 		add_fixup(m, n);
-		m.m_data[m.m_root].color = BLACK;
+		m._data[m._root].color = BLACK;
 		#ifdef RBTREE_VERIFY
-			dbg_verify(m, m.m_root);
+			dbg_verify(m, m._root);
 		#endif
 		return n;
 	}
@@ -506,8 +506,8 @@ namespace map
 	template <typename TKey, typename TValue>
 	uint32_t size(const Map<TKey, TValue>& m)
 	{
-		CE_ASSERT(vector::size(m.m_data) > 0, "Bad Map"); // There should be at least sentinel
-		return vector::size(m.m_data) - 1;
+		CE_ASSERT(vector::size(m._data) > 0, "Bad Map"); // There should be at least sentinel
+		return vector::size(m._data) - 1;
 	}
 
 	template <typename TKey, typename TValue>
@@ -521,9 +521,9 @@ namespace map
 	{
 		uint32_t p = map_internal::inner_find(m, key);
 
-		if (p != m.m_sentinel && m.m_data[p].key == key)
+		if (p != m._sentinel && m._data[p].key == key)
 		{
-			return m.m_data[p].value;
+			return m._data[p].value;
 		}
 
 		return deffault;
@@ -536,39 +536,39 @@ namespace map
 		node.key = key;
 		node.value = value;
 		node.color = map_internal::RED;
-		node.left = m.m_sentinel;
-		node.right = m.m_sentinel;
+		node.left = m._sentinel;
+		node.right = m._sentinel;
 		node.parent = map_internal::NIL;
-		uint32_t n = vector::push_back(m.m_data, node);
-		uint32_t x = m.m_root;
+		uint32_t n = vector::push_back(m._data, node);
+		uint32_t x = m._root;
 		uint32_t y = map_internal::NIL;
 
-		if (x == m.m_sentinel)
-			m.m_root = n;
+		if (x == m._sentinel)
+			m._root = n;
 		else
 		{
-			while (x != m.m_sentinel)
+			while (x != m._sentinel)
 			{
 				y = x;
 
-				if (key < m.m_data[x].key)
-					x = m.m_data[x].left;
+				if (key < m._data[x].key)
+					x = m._data[x].left;
 				else
-					x = m.m_data[x].right;
+					x = m._data[x].right;
 			}
 
-			if (key < m.m_data[y].key)
-				m.m_data[y].left = n;
+			if (key < m._data[y].key)
+				m._data[y].left = n;
 			else
-				m.m_data[y].right = n;
+				m._data[y].right = n;
 
-			m.m_data[n].parent = y;
+			m._data[n].parent = y;
 		}
 
 		map_internal::insert_fixup(m, n);
-		m.m_data[m.m_root].color = map_internal::BLACK;
+		m._data[m._root].color = map_internal::BLACK;
 		#ifdef RBTREE_VERIFY
-			map_internal::dbg_verify(m, m.m_root);
+			map_internal::dbg_verify(m, m._root);
 		#endif
 	}
 
@@ -579,7 +579,7 @@ namespace map
 
 		uint32_t n = inner_find(m, key);
 
-		if (!(m.m_data[n].key == key))
+		if (!(m._data[n].key == key))
 		{
 			return;
 		}
@@ -587,7 +587,7 @@ namespace map
 		uint32_t x;
 		uint32_t y;
 
-		if (left(m, n) == m.m_sentinel || right(m, n) == m.m_sentinel)
+		if (left(m, n) == m._sentinel || right(m, n) == m._sentinel)
 		{
 			y = n;
 		}
@@ -596,7 +596,7 @@ namespace map
 			y = successor(m, n);
 		}
 
-		if (left(m, y) != m.m_sentinel)
+		if (left(m, y) != m._sentinel)
 		{
 			x = left(m, y);
 		}
@@ -605,28 +605,28 @@ namespace map
 			x = right(m, y);
 		}
 
-		m.m_data[x].parent = parent(m, y);
+		m._data[x].parent = parent(m, y);
 
 		if (parent(m, y) != map_internal::NIL)
 		{
 			if (y == left(m, parent(m, y)))
 			{
-				m.m_data[parent(m, y)].left = x;
+				m._data[parent(m, y)].left = x;
 			}
 			else
 			{
-				m.m_data[parent(m, y)].right = x;
+				m._data[parent(m, y)].right = x;
 			}
 		}
 		else
 		{
-			m.m_root = x;
+			m._root = x;
 		}
 
 		if (y != n)
 		{
-			m.m_data[n].key = m.m_data[y].key;
-			m.m_data[n].value = m.m_data[y].value;
+			m._data[n].key = m._data[y].key;
+			m._data[n].value = m._data[y].value;
 		}
 
 		// Do the fixup
@@ -634,7 +634,7 @@ namespace map
 		{
 			uint32_t y;
 
-			while (x != m.m_root && color(m, x) == map_internal::BLACK)
+			while (x != m._root && color(m, x) == map_internal::BLACK)
 			{
 				if (x == left(m, parent(m, x)))
 				{
@@ -642,32 +642,32 @@ namespace map
 
 					if (color(m, y) == map_internal::RED)
 					{
-						m.m_data[y].color = map_internal::BLACK;
-						m.m_data[parent(m, x)].color = map_internal::RED;
+						m._data[y].color = map_internal::BLACK;
+						m._data[parent(m, x)].color = map_internal::RED;
 						rotate_left(m, parent(m, x));
 						y = right(m, parent(m, x));
 					}
 
 					if (color(m, left(m, y)) == map_internal::BLACK && color(m, right(m, y)) == map_internal::BLACK)
 					{
-						m.m_data[y].color = map_internal::RED;
+						m._data[y].color = map_internal::RED;
 						x = parent(m, x);
 					}
 					else
 					{
 						if (color(m, right(m, y)) == map_internal::BLACK)
 						{
-							m.m_data[left(m, y)].color = map_internal::BLACK;
-							m.m_data[y].color = map_internal::RED;
+							m._data[left(m, y)].color = map_internal::BLACK;
+							m._data[y].color = map_internal::RED;
 							rotate_right(m, y);
 							y = right(m, parent(m, x));
 						}
 
-						m.m_data[y].color = color(m, parent(m, x));
-						m.m_data[parent(m, x)].color = map_internal::BLACK;
-						m.m_data[right(m, y)].color = map_internal::BLACK;
+						m._data[y].color = color(m, parent(m, x));
+						m._data[parent(m, x)].color = map_internal::BLACK;
+						m._data[right(m, y)].color = map_internal::BLACK;
 						rotate_left(m, parent(m, x));
-						x = m.m_root;
+						x = m._root;
 					}
 				}
 				else
@@ -676,52 +676,52 @@ namespace map
 
 					if (color(m, y) == map_internal::RED)
 					{
-						m.m_data[y].color = map_internal::BLACK;
-						m.m_data[parent(m, x)].color = map_internal::RED;
+						m._data[y].color = map_internal::BLACK;
+						m._data[parent(m, x)].color = map_internal::RED;
 						rotate_right(m, parent(m, x));
 						y = left(m, parent(m, x));
 					}
 
 					if (color(m, right(m, y)) == map_internal::BLACK && color(m, left(m, y)) == map_internal::BLACK)
 					{
-						m.m_data[y].color = map_internal::RED;
+						m._data[y].color = map_internal::RED;
 						x = parent(m, x);
 					}
 					else
 					{
 						if (color(m, left(m, y)) == map_internal::BLACK)
 						{
-							m.m_data[right(m, y)].color = map_internal::BLACK;
-							m.m_data[y].color = map_internal::RED;
+							m._data[right(m, y)].color = map_internal::BLACK;
+							m._data[y].color = map_internal::RED;
 							rotate_left(m, y);
 							y = left(m, parent(m, x));
 						}
 
-						m.m_data[y].color = color(m, parent(m, x));
-						m.m_data[parent(m, x)].color = map_internal::BLACK;
-						m.m_data[left(m, y)].color = map_internal::BLACK;
+						m._data[y].color = color(m, parent(m, x));
+						m._data[parent(m, x)].color = map_internal::BLACK;
+						m._data[left(m, y)].color = map_internal::BLACK;
 						rotate_right(m, parent(m, x));
-						x = m.m_root;
+						x = m._root;
 					}
 				}
 			}
 
-			m.m_data[x].color = map_internal::BLACK;
+			m._data[x].color = map_internal::BLACK;
 		}
 
 		destroy(m, y);
 	 	#ifdef RBTREE_VERIFY
-			map_internal::dbg_verify(m, m.m_root);
+			map_internal::dbg_verify(m, m._root);
 	 	#endif
 	}
 
 	template <typename TKey, typename TValue>
 	void clear(Map<TKey, TValue>& m)
 	{
-		vector::clear(m.m_data);
+		vector::clear(m._data);
 
-		m.m_root = 0;
-		m.m_sentinel = 0;
+		m._root = 0;
+		m._sentinel = 0;
 
 		typename Map<TKey, TValue>::Node r;
 		r.key = TKey();
@@ -730,25 +730,25 @@ namespace map
 		r.right = map_internal::NIL;
 		r.parent = map_internal::NIL;
 		r.color = map_internal::BLACK;
-		vector::push_back(m.m_data, r);
+		vector::push_back(m._data, r);
 	}
 
 	template <typename TKey, typename TValue>
 	const typename Map<TKey, TValue>::Node* begin(const Map<TKey, TValue>& m)
 	{
-		return vector::begin(m.m_data) + 1; // Skip sentinel at index 0
+		return vector::begin(m._data) + 1; // Skip sentinel at index 0
 	}
 
 	template <typename TKey, typename TValue>
 	const typename Map<TKey, TValue>::Node* end(const Map<TKey, TValue>& m)
 	{
-		return vector::end(m.m_data);
+		return vector::end(m._data);
 	}
 } // namespace map
 
 template <typename TKey, typename TValue>
 inline Map<TKey, TValue>::Map(Allocator& a)
-	: m_data(a)
+	: _data(a)
 {
 	map::clear(*this);
 }

+ 6 - 6
engine/core/containers/priority_queue.h

@@ -54,29 +54,29 @@ namespace priority_queue
 	template <typename T>
 	const T& top(const PriorityQueue<T>& q)
 	{
-		return array::front(q.m_queue);
+		return array::front(q._queue);
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	void push(PriorityQueue<T>& q, const T& item)
 	{
-		array::push_back(q.m_queue, item);
-		std::push_heap(array::begin(q.m_queue), array::end(q.m_queue));
+		array::push_back(q._queue, item);
+		std::push_heap(array::begin(q._queue), array::end(q._queue));
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	void pop(PriorityQueue<T>& q)
 	{
-		std::pop_heap(array::begin(q.m_queue), array::end(q.m_queue));
-		array::pop_back(q.m_queue);
+		std::pop_heap(array::begin(q._queue), array::end(q._queue));
+		array::pop_back(q._queue);
 	}
 } // namespace priority_queue
 
 template <typename T>
 PriorityQueue<T>::PriorityQueue(Allocator& a)
-	: m_queue(a)
+	: _queue(a)
 {
 }
 

+ 48 - 49
engine/core/containers/queue.h

@@ -103,36 +103,36 @@ namespace queue
 	template <typename T>
 	inline bool empty(const Queue<T>& q)
 	{
-		return q.m_size == 0;
+		return q._size == 0;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline uint32_t size(const Queue<T>& q)
 	{
-		return q.m_size;
+		return q._size;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline uint32_t space(const Queue<T>& q)
 	{
-		return array::size(q.m_queue) - q.m_size;
+		return array::size(q._queue) - q._size;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline void increase_capacity(Queue<T>& q, uint32_t capacity)
 	{
-		uint32_t old_size = array::size(q.m_queue);
+		uint32_t old_size = array::size(q._queue);
 
-		array::resize(q.m_queue, capacity);
+		array::resize(q._queue, capacity);
 
-		if (q.m_read + q.m_size > old_size)
+		if (q._read + q._size > old_size)
 		{
-			memmove(array::begin(q.m_queue) + capacity - (old_size - q.m_read), array::begin(q.m_queue) + q.m_read, (old_size - q.m_read) * sizeof(T));
+			memmove(array::begin(q._queue) + capacity - (old_size - q._read), array::begin(q._queue) + q._read, (old_size - q._read) * sizeof(T));
 
-			q.m_read += (capacity - old_size);
+			q._read += (capacity - old_size);
 		}
 	}
 
@@ -140,7 +140,7 @@ namespace queue
 	template <typename T>
 	inline void grow(Queue<T>& q, uint32_t min_capacity)
 	{
-		uint32_t new_capacity = array::size(q.m_queue) * 2 + 1;
+		uint32_t new_capacity = array::size(q._queue) * 2 + 1;
 
 		if (new_capacity < min_capacity)
 		{
@@ -159,18 +159,18 @@ namespace queue
 			grow(q, 0);
 		}
 
-		q[q.m_size] = item;
+		q[q._size] = item;
 
-		q.m_size++;
+		q._size++;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline void pop_back(Queue<T>& q)
 	{
-		CE_ASSERT(q.m_size > 0, "The queue is empty");
+		CE_ASSERT(q._size > 0, "The queue is empty");
 
-		q.m_size--;
+		q._size--;
 	}
 
 	//-----------------------------------------------------------------------------
@@ -182,21 +182,21 @@ namespace queue
 			grow(q, 0);
 		}
 
-		q.m_read = (q.m_read - 1 + array::size(q.m_queue)) % array::size(q.m_queue);
+		q._read = (q._read - 1 + array::size(q._queue)) % array::size(q._queue);
 
 		q[0] = item;
 
-		q.m_size++;
+		q._size++;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline void pop_front(Queue<T>& q)
 	{
-		CE_ASSERT(q.m_size > 0, "The queue is empty");
+		CE_ASSERT(q._size > 0, "The queue is empty");
 
-		q.m_read = (q.m_read + 1) % array::size(q.m_queue);
-		q.m_size--;
+		q._read = (q._read + 1) % array::size(q._queue);
+		q._size--;
 	}
 
 	//-----------------------------------------------------------------------------
@@ -208,8 +208,8 @@ namespace queue
 			q.grow(q.size() + n);
 		}
 
-		const uint32_t size = array::size(q.m_queue);
-		const uint32_t insert = (q.m_read + q.m_size) % size;
+		const uint32_t size = array::size(q._queue);
+		const uint32_t insert = (q._read + q._size) % size;
 
 		uint32_t to_insert = n;
 		if (insert + to_insert > size)
@@ -217,100 +217,100 @@ namespace queue
 			to_insert = size - insert;
 		}
 
-		memcpy(array::begin(q.m_queue) + insert, items, to_insert * sizeof(T));
+		memcpy(array::begin(q._queue) + insert, items, to_insert * sizeof(T));
 
-		q.m_size += to_insert;
+		q._size += to_insert;
 		items += to_insert;
 		n -= to_insert;
-		memcpy(array::begin(q.m_queue), items, n * sizeof(T));
+		memcpy(array::begin(q._queue), items, n * sizeof(T));
 
-		q.m_size += n;
+		q._size += n;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline void pop(Queue<T>& q, uint32_t n)
 	{
-		CE_ASSERT(q.m_size > 0, "The queue is empty");
+		CE_ASSERT(q._size > 0, "The queue is empty");
 
-		q.m_read = (q.m_read + n) % array::size(q.m_queue);
-		q.m_size -= n;
+		q._read = (q._read + n) % array::size(q._queue);
+		q._size -= n;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline void clear(Queue<T>& q)
 	{
-		q.m_read = 0;
-		q.m_size = 0;
+		q._read = 0;
+		q._size = 0;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline T* begin(Queue<T>& q)
 	{
-		return array::begin(q.m_queue) + q.m_read;
+		return array::begin(q._queue) + q._read;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline const T* begin(const Queue<T>& q)
 	{
-		return array::begin(q.m_queue) + q.m_read;
+		return array::begin(q._queue) + q._read;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline T* end(Queue<T>& q)
 	{
-		uint32_t end = q.m_read + q.m_size;
+		uint32_t end = q._read + q._size;
 
-		return end >= array::size(q.m_queue) ? array::end(q.m_queue) : array::begin(q.m_queue) + end;
+		return end >= array::size(q._queue) ? array::end(q._queue) : array::begin(q._queue) + end;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline const T* end(const Queue<T>& q)
 	{
-		uint32_t end = q.m_read + q.m_size;
+		uint32_t end = q._read + q._size;
 
-		return end >= array::size(q.m_queue) ? array::end(q.m_queue) : array::begin(q.m_queue) + end;
+		return end >= array::size(q._queue) ? array::end(q._queue) : array::begin(q._queue) + end;
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline T& front(Queue<T>& q)
 	{
-		CE_ASSERT(q.m_size > 0, "The queue is empty");
+		CE_ASSERT(q._size > 0, "The queue is empty");
 
-		return q.m_queue[q.m_read];
+		return q._queue[q._read];
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline const T& front(const Queue<T>& q)
 	{
-		CE_ASSERT(q.m_size > 0, "The queue is empty");
+		CE_ASSERT(q._size > 0, "The queue is empty");
 
-		return q.m_queue[q.m_read];
+		return q._queue[q._read];
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline T& back(Queue<T>& q)
 	{
-		CE_ASSERT(q.m_size > 0, "The queue is empty");
+		CE_ASSERT(q._size > 0, "The queue is empty");
 
-		return q[q.m_size - 1];
+		return q[q._size - 1];
 	}
 
 	//-----------------------------------------------------------------------------
 	template <typename T>
 	inline const T& back(const Queue<T>& q)
 	{
-		CE_ASSERT(q.m_size > 0, "The queue is empty");
+		CE_ASSERT(q._size > 0, "The queue is empty");
 
-		return q[q.m_size - 1];
+		return q[q._size - 1];
 	}
 
 } // namespace queue
@@ -318,9 +318,9 @@ namespace queue
 //-----------------------------------------------------------------------------
 template <typename T>
 inline Queue<T>::Queue(Allocator& allocator)
-	: m_read(0)
-	, m_size(0)
-	, m_queue(allocator)
+	: _read(0)
+	, _size(0)
+	, _queue(allocator)
 {
 }
 
@@ -328,15 +328,14 @@ inline Queue<T>::Queue(Allocator& allocator)
 template <typename T>
 inline T& Queue<T>::operator[](uint32_t index)
 {
-	return m_queue[(m_read + index) % array::size(m_queue)];
+	return _queue[(_read + index) % array::size(_queue)];
 }
 
 //-----------------------------------------------------------------------------
 template <typename T>
 inline const T& Queue<T>::operator[](uint32_t index) const
 {
-	return m_queue[(m_read + index) % array::size(m_queue)];
+	return _queue[(_read + index) % array::size(_queue)];
 }
 
 } // namespace crown
-

+ 19 - 19
engine/core/containers/sort_map.h

@@ -92,17 +92,17 @@ namespace sort_map_internal
 	template <typename TKey, typename TValue, typename Compare>
 	inline FindResult find(const SortMap<TKey, TValue, Compare>& m, const TKey& key)
 	{
-		CE_ASSERT(m.m_is_sorted, "Map not sorted");
+		CE_ASSERT(m._is_sorted, "Map not sorted");
 
 		FindResult result;
 		result.item_i = END_OF_LIST;
 
 		const typename SortMap<TKey, TValue, Compare>::Entry* first =
-			std::lower_bound(array::begin(m.m_data), array::end(m.m_data), key,
+			std::lower_bound(array::begin(m._data), array::end(m._data), key,
 			sort_map_internal::CompareEntry<TKey, TValue, Compare>());
 
-		if (first != array::end(m.m_data) && !(key < first->key))
-		 	result.item_i = first - array::begin(m.m_data);
+		if (first != array::end(m._data) && !(key < first->key))
+		 	result.item_i = first - array::begin(m._data);
 
 		return result;
 	}
@@ -124,15 +124,15 @@ namespace sort_map
 		if (result.item_i == sort_map_internal::END_OF_LIST)
 			return deffault;
 
-		return m.m_data[result.item_i].value;
+		return m._data[result.item_i].value;
 	}
 
 	template <typename TKey, typename TValue, typename Compare>
 	inline void sort(SortMap<TKey, TValue, Compare>& m)
 	{
-		std::sort(array::begin(m.m_data), array::end(m.m_data),
+		std::sort(array::begin(m._data), array::end(m._data),
 			sort_map_internal::CompareEntry<TKey, TValue, Compare>());
-		m.m_is_sorted = true;
+		m._is_sorted = true;
 	}
 
 	template <typename TKey, typename TValue, typename Compare>
@@ -145,14 +145,14 @@ namespace sort_map
 			typename SortMap<TKey, TValue, Compare>::Entry e;
 			e.key = key;
 			e.value = val;
-			array::push_back(m.m_data, e);
+			array::push_back(m._data, e);
 		}
 		else
 		{
-			m.m_data[result.item_i].value = val;
+			m._data[result.item_i].value = val;
 		}
 
-		m.m_is_sorted = false;
+		m._is_sorted = false;
 	}
 
 	template <typename TKey, typename TValue, typename Compare>
@@ -163,38 +163,38 @@ namespace sort_map
 		if (result.item_i == sort_map_internal::END_OF_LIST)
 			return;
 
-		if (array::size(m.m_data))
+		if (array::size(m._data))
 		{
-			m.m_data[result.item_i] = m.m_data[array::size(m.m_data) - 1];
-			array::pop_back(m.m_data);
+			m._data[result.item_i] = m._data[array::size(m._data) - 1];
+			array::pop_back(m._data);
 		}
 
-		m.m_is_sorted = false;
+		m._is_sorted = false;
 	}
 
 	template <typename TKey, typename TValue, typename Compare>
 	inline void clear(SortMap<TKey, TValue, Compare>& m)
 	{
-		array::clear(m.m_data);
-		m.m_is_sorted = true;
+		array::clear(m._data);
+		m._is_sorted = true;
 	}
 
 	template <typename TKey, typename TValue, typename Compare>
 	inline const typename SortMap<TKey, TValue, Compare>::Entry* begin(const SortMap<TKey, TValue, Compare>& m)
 	{
-		return array::begin(m.m_data);
+		return array::begin(m._data);
 	}
 
 	template <typename TKey, typename TValue, typename Compare>
 	inline const typename SortMap<TKey, TValue, Compare>::Entry* end(const SortMap<TKey, TValue, Compare>& m)
 	{
-		return array::end(m.m_data);
+		return array::end(m._data);
 	}
 } // namespace sort_map
 
 template <typename TKey, typename TValue, typename Compare>
 inline SortMap<TKey, TValue, Compare>::SortMap(Allocator& a)
-	: m_is_sorted(true), m_data(a)
+	: _is_sorted(true), _data(a)
 {
 }
 

+ 46 - 46
engine/core/containers/vector.h

@@ -98,63 +98,63 @@ namespace vector
 	template <typename T>
 	bool empty(const Vector<T>& v)
 	{
-		return array::empty(v.m_array);
+		return array::empty(v._array);
 	}
 
 	template <typename T>
 	uint32_t size(const Vector<T>& v)
 	{
-		return array::size(v.m_array);
+		return array::size(v._array);
 	}
 
 	template <typename T>
 	uint32_t capacity(const Vector<T>& v)
 	{
-		return array::capacity(v.m_array);
+		return array::capacity(v._array);
 	}
 
 	template <typename T>
 	void resize(Vector<T>& v, uint32_t size)
 	{
-		array::resize(v.m_array, size);
+		array::resize(v._array, size);
 	}
 
 	template <typename T>
 	void reserve(Vector<T>& v, uint32_t capacity)
 	{
-		array::reserve(v.m_array, capacity);
+		array::reserve(v._array, capacity);
 	}
 
 	template <typename T>
 	void set_capacity(Vector<T>& v, uint32_t capacity)
 	{
-		if (capacity == v.m_array.m_capacity)
+		if (capacity == v._array._capacity)
 			return;
 
-		if (capacity < v.m_array.m_size)
+		if (capacity < v._array._size)
 			resize(v, capacity);
 
 		if (capacity > 0)
 		{
-			Array<T> arr = v.m_array;
+			Array<T> arr = v._array;
 
-			T* tmp = arr.m_array;
-			arr.m_capacity = capacity;
+			T* tmp = arr._array;
+			arr._capacity = capacity;
 
-			arr.m_array = (T*)arr.m_allocator->allocate(capacity * sizeof(T));
+			arr._array = (T*)arr._allocator->allocate(capacity * sizeof(T));
 
-			for (uint32_t i = 0; i < arr.m_size; i++)
+			for (uint32_t i = 0; i < arr._size; i++)
 			{
-				new (arr.m_array + i) T(tmp[i]);
+				new (arr._array + i) T(tmp[i]);
 			}
 
 			if (tmp)
 			{
-				for (uint32_t i = 0; i < arr.m_size; i++)
+				for (uint32_t i = 0; i < arr._size; i++)
 				{
 					tmp[i].~T();
 				}
-				arr.m_allocator->deallocate(tmp);
+				arr._allocator->deallocate(tmp);
 			}
 		}
 	}
@@ -162,24 +162,24 @@ namespace vector
 	template <typename T>
 	void grow(Vector<T>& v, uint32_t min_capacity)
 	{
-		return array::grow(v.m_array, min_capacity);
+		return array::grow(v._array, min_capacity);
 	}
 
 	template <typename T>
 	void condense(Vector<T>& v)
 	{
-		return array::condense(v.m_array);
+		return array::condense(v._array);
 	}
 
 	template <typename T>
 	uint32_t push_back(Vector<T>& v, const T& item)
 	{
-		if (v.m_array.m_capacity == v.m_array.m_size)
+		if (v._array._capacity == v._array._size)
 			grow(v, 0);
 
-		new (v.m_array.m_array + v.m_array.m_size) T(item);
+		new (v._array._array + v._array._size) T(item);
 
-		return v.m_array.m_size++;
+		return v._array._size++;
 	}
 
 	template <typename T>
@@ -187,98 +187,98 @@ namespace vector
 	{
 		CE_ASSERT(vector::size(v) > 0, "The vector is empty");
 
-		v.m_array.m_array[v.m_array.m_size - 1].~T();
-		v.m_array.m_size--;
+		v._array._array[v._array._size - 1].~T();
+		v._array._size--;
 	}
 
 	template <typename T>
 	uint32_t push(Vector<T>& v, const T* items, uint32_t count)
 	{
-		if (v.m_array.m_capacity <= v.m_array.m_size + count)
-			grow(v, v.m_array.m_size + count);
+		if (v._array._capacity <= v._array._size + count)
+			grow(v, v._array._size + count);
 
-		T* arr = &v.m_array.m_array[v.m_array.m_size];
+		T* arr = &v._array._array[v._array._size];
 		for (uint32_t i = 0; i < count; i++)
 		{
 			arr[i] = items[i];
 		}
 
-		v.m_array.m_size += count;
-		return v.m_array.m_size;
+		v._array._size += count;
+		return v._array._size;
 	}
 
 	template <typename T>
 	void clear(Vector<T>& v)
 	{
-		for (uint32_t i = 0; i < v.m_array.m_size; i++)
+		for (uint32_t i = 0; i < v._array._size; i++)
 		{
-			v.m_array.m_array[i].~T();
+			v._array._array[i].~T();
 		}
 
-		v.m_array.m_size = 0;
+		v._array._size = 0;
 	}
 
 	template <typename T>
 	T* begin(Vector<T>& v)
 	{
-		return array::begin(v.m_array);
+		return array::begin(v._array);
 	}
 	template <typename T>
 	const T* begin(const Vector<T>& v)
 	{
-		return array::begin(v.m_array);
+		return array::begin(v._array);
 	}
 	template <typename T>
 	T* end(Vector<T>& v)
 	{
-		return array::end(v.m_array);
+		return array::end(v._array);
 	}
 	template <typename T>
 	const T* end(const Vector<T>& v)
 	{
-		return array::end(v.m_array);
+		return array::end(v._array);
 	}
 
 	template <typename T>
 	T& front(Vector<T>& v)
 	{
-		return array::front(v.m_array);
+		return array::front(v._array);
 	}
 	template <typename T>
 	const T& front(const Vector<T>& v)
 	{
-		return array::front(v.m_array);
+		return array::front(v._array);
 	}
 	template <typename T>
 	T& back(Vector<T>& v)
 	{
-		return array::back(v.m_array);
+		return array::back(v._array);
 	}
 	template <typename T>
 	const T& back(const Vector<T>& v)
 	{
-		return array::back(v.m_array);
+		return array::back(v._array);
 	}
 } // namespace vector
 
 //-----------------------------------------------------------------------------
 template <typename T>
 inline Vector<T>::Vector(Allocator& allocator)
-	: m_array(allocator)
+	: _array(allocator)
 {
 }
 
 //-----------------------------------------------------------------------------
 template <typename T>
 inline Vector<T>::Vector(Allocator& allocator, uint32_t capacity)
-	: m_array(allocator)
+	: _array(allocator)
 {
 }
 
 //-----------------------------------------------------------------------------
 template <typename T>
 inline Vector<T>::Vector(const Vector<T>& other)
-	: m_array(other.m_array)
+	: _array(other._array)
 {
 	*this = other;
 }
@@ -287,9 +287,9 @@ inline Vector<T>::Vector(const Vector<T>& other)
 template <typename T>
 inline Vector<T>::~Vector()
 {
-	for (uint32_t i = 0; i < array::size(m_array); i++)
+	for (uint32_t i = 0; i < array::size(_array); i++)
 	{
-		m_array[i].~T();
+		_array[i].~T();
 	}
 }
 
@@ -297,14 +297,14 @@ inline Vector<T>::~Vector()
 template <typename T>
 inline T& Vector<T>::operator[](uint32_t index)
 {
-	return m_array[index];
+	return _array[index];
 }
 
 //-----------------------------------------------------------------------------
 template <typename T>
 inline const T& Vector<T>::operator[](uint32_t index) const
 {
-	return m_array[index];
+	return _array[index];
 }
 
 //-----------------------------------------------------------------------------
@@ -316,7 +316,7 @@ inline const Vector<T>& Vector<T>::operator=(const Vector<T>& other)
 
 	for (uint32_t i = 0; i < size; i++)
 	{
-		m_array[i] = other.m_array[i];
+		_array[i] = other._array[i];
 	}
 
 	return *this;