mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
2ff07fa66a
-- Reduced memory usage for images with margins -- Implemented RLE compression - Linux-related changes: -- build system updated to include changed paths -- new dependency: boost-program-options -- configure option --disable-debug will produce optimized build - Several gcc compile fixes - Optimized CPU usage on town screens - Removed several includes from headers - Possible fix for #496
67 lines
844 B
C++
67 lines
844 B
C++
#pragma once
|
|
|
|
class CGameHandler;
|
|
|
|
template <typename T>
|
|
class ConstTransitivePtr
|
|
{
|
|
T *ptr;
|
|
ConstTransitivePtr(const T *Ptr)
|
|
: ptr(const_cast<T*>(Ptr))
|
|
{}
|
|
public:
|
|
ConstTransitivePtr(T *Ptr = NULL)
|
|
: ptr(Ptr)
|
|
{}
|
|
|
|
const T& operator*() const
|
|
{
|
|
return *ptr;
|
|
}
|
|
T& operator*()
|
|
{
|
|
return *ptr;
|
|
}
|
|
operator const T*() const
|
|
{
|
|
return ptr;
|
|
}
|
|
T* get()
|
|
{
|
|
return ptr;
|
|
}
|
|
const T* get() const
|
|
{
|
|
return ptr;
|
|
}
|
|
operator T*()
|
|
{
|
|
return ptr;
|
|
}
|
|
T *operator->()
|
|
{
|
|
return ptr;
|
|
}
|
|
const T *operator->() const
|
|
{
|
|
return ptr;
|
|
}
|
|
const T*operator=(T *t)
|
|
{
|
|
return ptr = t;
|
|
}
|
|
|
|
void dellNull()
|
|
{
|
|
delete ptr;
|
|
ptr = NULL;
|
|
}
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
{
|
|
h & ptr;
|
|
}
|
|
|
|
friend class CGameHandler;
|
|
};
|