Added irrAllocator to irrList, submitted by Nox [bug 2682209]

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2273 dfc29bdd-3216-0410-991c-e03cc46cb475
master
bitplane 2009-03-11 23:00:34 +00:00
parent 3301848313
commit 7e78383571
2 changed files with 21 additions and 13 deletions

View File

@ -1,5 +1,7 @@
Changes in 1.6 Changes in 1.6
- irrList now uses irrAllocator, fixed by Nox
- Added IGUIWindow::setDraggable and IGUIWindow::isDraggable, by Nox - Added IGUIWindow::setDraggable and IGUIWindow::isDraggable, by Nox
- Added SGI RGB file reader by Gary Conway, for loading Silicon Graphics .rgb, .rgba, .sgi, .int and .inta textures - Added SGI RGB file reader by Gary Conway, for loading Silicon Graphics .rgb, .rgba, .sgi, .int and .inta textures
@ -26,6 +28,8 @@ Changes in 1.6
- Added generic console device. You can now use Irrlicht to create and manipuate graphics on a shell where no graphics hardware - Added generic console device. You can now use Irrlicht to create and manipuate graphics on a shell where no graphics hardware
or windowing system is available. To enable it uncomment #define _IRR_USE_CONSOLE_DEVICE_ in IrrCompileConfig.h or windowing system is available. To enable it uncomment #define _IRR_USE_CONSOLE_DEVICE_ in IrrCompileConfig.h
- The console device can now present images from the software drivers and display them as ASCII art in the console
- By default it replaces the default font in the skin, to prevent fonts from being huge.
Changes in 1.6 TA Changes in 1.6 TA
- implemented isALoadableFileFormat ( File *file ) for the Archive Loader - implemented isALoadableFileFormat ( File *file ) for the Archive Loader

View File

@ -6,6 +6,7 @@
#define __IRR_LIST_H_INCLUDED__ #define __IRR_LIST_H_INCLUDED__
#include "irrTypes.h" #include "irrTypes.h"
#include "irrAllocator.h"
namespace irr namespace irr
{ {
@ -22,7 +23,7 @@ private:
//! List element node with pointer to previous and next element in the list. //! List element node with pointer to previous and next element in the list.
struct SKListNode struct SKListNode
{ {
SKListNode() : Next(0), Prev(0) {} SKListNode(const T& e) : Next(0), Prev(0), Element(e) {}
SKListNode* Next; SKListNode* Next;
SKListNode* Prev; SKListNode* Prev;
@ -181,7 +182,8 @@ public:
while(First) while(First)
{ {
SKListNode * next = First->Next; SKListNode * next = First->Next;
delete First; allocator.destruct(First);
allocator.deallocate(First);
First = next; First = next;
} }
@ -203,8 +205,8 @@ public:
/** \param element Element to add to the list. */ /** \param element Element to add to the list. */
void push_back(const T& element) void push_back(const T& element)
{ {
SKListNode* node = new SKListNode; SKListNode* node = allocator.allocate(1);
node->Element = element; allocator.construct(node, element);
++Size; ++Size;
@ -224,8 +226,8 @@ public:
/** \param element: Element to add to the list. */ /** \param element: Element to add to the list. */
void push_front(const T& element) void push_front(const T& element)
{ {
SKListNode* node = new SKListNode; SKListNode* node = allocator.allocate(1);
node->Element = element; allocator.construct(node, element);
++Size; ++Size;
@ -298,8 +300,8 @@ public:
*/ */
void insert_after(const Iterator& it, const T& element) void insert_after(const Iterator& it, const T& element)
{ {
SKListNode* node = new SKListNode; SKListNode* node = allocator.allocate(1);
node->Element = element; allocator.construct(node, element);
node->Next = it.Current->Next; node->Next = it.Current->Next;
@ -322,8 +324,8 @@ public:
*/ */
void insert_before(const Iterator& it, const T& element) void insert_before(const Iterator& it, const T& element)
{ {
SKListNode* node = new SKListNode; SKListNode* node = allocator.allocate(1);
node->Element = element; allocator.construct(node, element);
node->Prev = it.Current->Prev; node->Prev = it.Current->Prev;
@ -368,7 +370,8 @@ public:
it.Current->Next->Prev = it.Current->Prev; it.Current->Next->Prev = it.Current->Prev;
} }
delete it.Current; allocator.destruct(it.Current);
allocator.deallocate(it.Current);
it.Current = 0; it.Current = 0;
--Size; --Size;
@ -377,6 +380,7 @@ public:
private: private:
irrAllocator<SKListNode> allocator;
SKListNode* First; SKListNode* First;
SKListNode* Last; SKListNode* Last;
u32 Size; u32 Size;