mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
e777161888
Implement the use of the new vmap3-format by Lynx3d (mad props to you for this, and thanks for the talks earlier) + reduced Vmap size to less than one third, and improve precision + indoor/outdoor check which allows automatic unmounting of players + additional area information from WMOAreaTable.dbc, removed existing "hacks" + WMO liquid information for swimming and fishing correctly in buildings/cities/caves/instances (lava and slime WILL hurt from now on!) - buildfiles for windows are not properly done, and will need to be sorted out NOTE: Do NOT annoy Lynx3d about this, any issues with this "port" is entirely our fault ! THIS REVISION IS CONSIDERED UNSTABLE AND CONTAINS WORK IN PROGRESS - USE AT YOUR OWN RISK! --HG-- branch : trunk
94 lines
2.3 KiB
C++
94 lines
2.3 KiB
C++
/**
|
|
@file MemoryManager.h
|
|
|
|
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
|
|
@created 2009-04-20
|
|
@edited 2009-04-20
|
|
|
|
Copyright 2000-2009, Morgan McGuire.
|
|
All rights reserved.
|
|
*/
|
|
#ifndef G3D_MemoryManager_h
|
|
#define G3D_MemoryManager_h
|
|
|
|
#include "G3D/platform.h"
|
|
#include "G3D/ReferenceCount.h"
|
|
|
|
namespace G3D {
|
|
|
|
/**
|
|
Abstraction of memory management.
|
|
Default implementation uses G3D::System::malloc and is threadsafe.
|
|
|
|
\sa CRTMemoryManager, AlignedMemoryManager, AreaMemoryManager */
|
|
class MemoryManager : public ReferenceCountedObject {
|
|
protected:
|
|
|
|
MemoryManager();
|
|
|
|
public:
|
|
|
|
typedef ReferenceCountedPointer<class MemoryManager> Ref;
|
|
|
|
/** Return a pointer to \a s bytes of memory that are unused by
|
|
the rest of the program. The contents of the memory are
|
|
undefined */
|
|
virtual void* alloc(size_t s);
|
|
|
|
/** Invoke to declare that this memory will no longer be used by
|
|
the program. The memory manager is not required to actually
|
|
reuse or release this memory. */
|
|
virtual void free(void* ptr);
|
|
|
|
/** Returns true if this memory manager is threadsafe (i.e., alloc
|
|
and free can be called asychronously) */
|
|
virtual bool isThreadsafe() const;
|
|
|
|
/** Return the instance. There's only one instance of the default
|
|
MemoryManager; it is cached after the first creation. */
|
|
static MemoryManager::Ref create();
|
|
};
|
|
|
|
/**
|
|
Allocates memory on 16-byte boundaries.
|
|
\sa MemoryManager, CRTMemoryManager, AreaMemoryManager */
|
|
class AlignedMemoryManager : public MemoryManager {
|
|
protected:
|
|
|
|
AlignedMemoryManager();
|
|
|
|
public:
|
|
|
|
typedef ReferenceCountedPointer<class AlignedMemoryManager> Ref;
|
|
|
|
|
|
virtual void* alloc(size_t s);
|
|
|
|
virtual void free(void* ptr);
|
|
|
|
virtual bool isThreadsafe() const;
|
|
|
|
static AlignedMemoryManager::Ref create();
|
|
};
|
|
|
|
|
|
/** MemoryManager implemented using the C runtime. */
|
|
class CRTMemoryManager : public MemoryManager {
|
|
protected:
|
|
CRTMemoryManager();
|
|
|
|
public:
|
|
typedef ReferenceCountedPointer<class MemoryManager> Ref;
|
|
virtual void* alloc(size_t s);
|
|
virtual void free(void* ptr);
|
|
virtual bool isThreadsafe() const;
|
|
|
|
/** There's only one instance of this memory manager; it is
|
|
cached after the first creation. */
|
|
static CRTMemoryManager::Ref create();
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|