Changed: Use a CUniquePtr macro since std::unique_ptr doesn't exist on all (yet) supported platforms

--HG--
branch : develop
This commit is contained in:
kervala 2016-12-10 12:05:29 +01:00
parent 0f6ae5e239
commit ab44d7e809
67 changed files with 207 additions and 197 deletions

View file

@ -93,7 +93,7 @@ public:
uint addAnimation (const char* fileName, const char* animName, bool displayMissingFileWarning = true) uint addAnimation (const char* fileName, const char* animName, bool displayMissingFileWarning = true)
{ {
// Allocate an animation // Allocate an animation
std::unique_ptr<CAnimation> anim (new CAnimation); CUniquePtr<CAnimation> anim (new CAnimation);
// Read it // Read it
NLMISC::CIFile file; NLMISC::CIFile file;
@ -130,7 +130,7 @@ public:
virtual uint addSkeletonWeight (const char* fileName, const char* skelName) virtual uint addSkeletonWeight (const char* fileName, const char* skelName)
{ {
// Allocate an animation // Allocate an animation
std::unique_ptr<CSkeletonWeight> skeletonWeight (new CSkeletonWeight); CUniquePtr<CSkeletonWeight> skeletonWeight (new CSkeletonWeight);
// Read it // Read it
NLMISC::CIFile file; NLMISC::CIFile file;

View file

@ -692,7 +692,7 @@ private:
{ {
NLMISC::CMatrix TexMat[IDRV_MAT_MAXTEXTURES]; NLMISC::CMatrix TexMat[IDRV_MAT_MAXTEXTURES];
}; };
std::unique_ptr<CUserTexMat> _TexUserMat; // user texture matrix CUniquePtr<CUserTexMat> _TexUserMat; // user texture matrix
public: public:
// Private. For Driver only. // Private. For Driver only.

View file

@ -282,7 +282,7 @@ inline float CPSAttribMakerBinOp<float>::getMaxValue(void) const
template <class T> template <class T>
inline CPSAttribMakerBinOp<T>::CPSAttribMakerBinOp(const CPSAttribMakerBinOp &other) : CPSAttribMaker<T>(other) // parent copy ctor inline CPSAttribMakerBinOp<T>::CPSAttribMakerBinOp(const CPSAttribMakerBinOp &other) : CPSAttribMaker<T>(other) // parent copy ctor
{ {
std::unique_ptr<CPSAttribMaker<T> > a0(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[0]->clone())) CUniquePtr<CPSAttribMaker<T> > a0(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[0]->clone()))
, a1(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[1]->clone())); , a1(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[1]->clone()));
this->_Op = other._Op; this->_Op = other._Op;
this->_Size = other._Size; this->_Size = other._Size;

View file

@ -1463,7 +1463,7 @@ public:
CPSAttribMakerMemoryBase(const CPSAttribMakerMemoryBase &src) : CPSAttribMaker<T>(src) // parent copy ctor CPSAttribMakerMemoryBase(const CPSAttribMakerMemoryBase &src) : CPSAttribMaker<T>(src) // parent copy ctor
{ {
nlassert(src._Scheme); nlassert(src._Scheme);
std::unique_ptr<CPSAttribMaker<T> > s(NLMISC::safe_cast<CPSAttribMaker<T> *>(src._Scheme->clone())); CUniquePtr<CPSAttribMaker<T> > s(NLMISC::safe_cast<CPSAttribMaker<T> *>(src._Scheme->clone()));
this->_T = src._T; this->_T = src._T;
this->_DefaultValue = src._DefaultValue; this->_DefaultValue = src._DefaultValue;
this->_Scheme = s.release(); this->_Scheme = s.release();

View file

@ -590,7 +590,7 @@ protected:
void serial(NLMISC::IStream &f) throw(NLMISC::EStream); void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
}; };
typedef std::unique_ptr<CGlobalTexAnims> PGlobalTexAnims; typedef CUniquePtr<CGlobalTexAnims> PGlobalTexAnims;
PGlobalTexAnims _GlobalTexAnims; PGlobalTexAnims _GlobalTexAnims;
float _GlobalAnimDate; float _GlobalAnimDate;

View file

@ -162,7 +162,7 @@
# define NL_COMP_GCC # define NL_COMP_GCC
#endif #endif
#if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 110)
# define NL_ISO_CPP0X_AVAILABLE # define NL_ISO_CPP0X_AVAILABLE
#endif #endif
@ -430,30 +430,40 @@ extern void operator delete[](void *p) throw();
# define CHashSet ::std::hash_set # define CHashSet ::std::hash_set
# define CHashMultiMap ::std::hash_multimap # define CHashMultiMap ::std::hash_multimap
# endif // _STLP_HASH_MAP # endif // _STLP_HASH_MAP
# define CUniquePtr ::std::auto_ptr
# define CUniquePtrMove
#elif defined(NL_ISO_CPP0X_AVAILABLE) || (defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 100))
# include <unordered_map>
# include <unordered_set>
# define CHashMap ::std::unordered_map
# define CHashSet ::std::unordered_set
# define CHashMultiMap ::std::unordered_multimap
# define CUniquePtr ::std::unique_ptr
# define CUniquePtrMove ::std::move
#elif defined(NL_ISO_STDTR1_AVAILABLE) // use std::tr1 for CHash* classes, if available (gcc 4.1+ and VC9 with TR1 feature pack) #elif defined(NL_ISO_STDTR1_AVAILABLE) // use std::tr1 for CHash* classes, if available (gcc 4.1+ and VC9 with TR1 feature pack)
# include NL_ISO_STDTR1_HEADER(unordered_map) # include NL_ISO_STDTR1_HEADER(unordered_map)
# include NL_ISO_STDTR1_HEADER(unordered_set) # include NL_ISO_STDTR1_HEADER(unordered_set)
# define CHashMap NL_ISO_STDTR1_NAMESPACE::unordered_map # define CHashMap NL_ISO_STDTR1_NAMESPACE::unordered_map
# define CHashSet NL_ISO_STDTR1_NAMESPACE::unordered_set # define CHashSet NL_ISO_STDTR1_NAMESPACE::unordered_set
# define CHashMultiMap NL_ISO_STDTR1_NAMESPACE::unordered_multimap # define CHashMultiMap NL_ISO_STDTR1_NAMESPACE::unordered_multimap
# define CUniquePtr ::std::auto_ptr
# define CUniquePtrMove
#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 70 && NL_COMP_VC_VERSION <= 90) // VC7 through 9 #elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 70 && NL_COMP_VC_VERSION <= 90) // VC7 through 9
# include <hash_map> # include <hash_map>
# include <hash_set> # include <hash_set>
# define CHashMap stdext::hash_map # define CHashMap stdext::hash_map
# define CHashSet stdext::hash_set # define CHashSet stdext::hash_set
# define CHashMultiMap stdext::hash_multimap # define CHashMultiMap stdext::hash_multimap
#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 100) # define CUniquePtr ::std::auto_ptr
# include <unordered_map> # define CUniquePtrMove
# include <unordered_set>
# define CHashMap ::std::unordered_map
# define CHashSet ::std::unordered_set
# define CHashMultiMap ::std::unordered_multimap
#elif defined(NL_COMP_GCC) // GCC4 #elif defined(NL_COMP_GCC) // GCC4
# include <ext/hash_map> # include <ext/hash_map>
# include <ext/hash_set> # include <ext/hash_set>
# define CHashMap ::__gnu_cxx::hash_map # define CHashMap ::__gnu_cxx::hash_map
# define CHashSet ::__gnu_cxx::hash_set # define CHashSet ::__gnu_cxx::hash_set
# define CHashMultiMap ::__gnu_cxx::hash_multimap # define CHashMultiMap ::__gnu_cxx::hash_multimap
# define CUniquePtr ::std::auto_ptr
# define CUniquePtrMove
namespace __gnu_cxx { namespace __gnu_cxx {

View file

@ -318,7 +318,7 @@ UAnimation* UAnimation::createAnimation (const char* sPath)
NL3D_HAUTO_UI_ANIMATION; NL3D_HAUTO_UI_ANIMATION;
// Allocate an animation // Allocate an animation
std::unique_ptr<CAnimation> anim (new CAnimation); CUniquePtr<CAnimation> anim (new CAnimation);
// Read it // Read it
NLMISC::CIFile file; NLMISC::CIFile file;

View file

@ -225,7 +225,7 @@ bool CAnimationSet::loadFromFiles(const std::string &path, bool recurse /* = tru
{ {
NLMISC::CIFile iFile; NLMISC::CIFile iFile;
iFile.open(anims[k]); iFile.open(anims[k]);
std::unique_ptr<CAnimation> anim(new CAnimation); CUniquePtr<CAnimation> anim(new CAnimation);
anim->serial(iFile); anim->serial(iFile);
addAnimation(NLMISC::CFile::getFilenameWithoutExtension(anims[k]).c_str(), anim.release()); addAnimation(NLMISC::CFile::getFilenameWithoutExtension(anims[k]).c_str(), anim.release());
iFile.close(); iFile.close();

View file

@ -89,8 +89,8 @@ static uint8 *BuildCubeMapTexLuminance(const NLMISC::CVector &start,
CTextureCube *BuildCubeMap(sint mapSize, ICubeMapFunctor &f, bool luminanceOnly /* = false*/, const std::string &shareName /* = "" */) CTextureCube *BuildCubeMap(sint mapSize, ICubeMapFunctor &f, bool luminanceOnly /* = false*/, const std::string &shareName /* = "" */)
{ {
std::unique_ptr<CTextureCube> cubeMap(new CTextureCube); CUniquePtr<CTextureCube> cubeMap(new CTextureCube);
std::unique_ptr<CTextureMem> faces[6]; CUniquePtr<CTextureMem> faces[6];
/// this gives the start (unormalized normal for each face for u,v = 0, 0) /// this gives the start (unormalized normal for each face for u,v = 0, 0)
static const NLMISC::CVector start[] = static const NLMISC::CVector start[] =

View file

@ -105,9 +105,9 @@ CMaterial &CMaterial::operator=(const CMaterial &mat)
// copy texture matrix if there. // copy texture matrix if there.
if (mat._TexUserMat.get()) if (mat._TexUserMat.get())
{ {
std::unique_ptr<CUserTexMat> texMatClone( new CUserTexMat(*(mat._TexUserMat))); // make cpy CUniquePtr<CUserTexMat> texMatClone(new CUserTexMat(*(mat._TexUserMat))); // make cpy
//std::swap(texMatClone, _TexUserMat); // swap with old //std::swap(texMatClone, _TexUserMat); // swap with old
_TexUserMat = std::move(texMatClone); _TexUserMat = CUniquePtrMove(texMatClone);
} }
else else
{ {
@ -265,9 +265,9 @@ void CMaterial::serial(NLMISC::IStream &f)
if ((_Flags & IDRV_MAT_USER_TEX_MAT_ALL)) // are there user textrue coordinates matrix ? if ((_Flags & IDRV_MAT_USER_TEX_MAT_ALL)) // are there user textrue coordinates matrix ?
{ {
std::unique_ptr<CUserTexMat> newPtr(new CUserTexMat); // create new CUniquePtr<CUserTexMat> newPtr(new CUserTexMat); // create new
//std::swap(_TexUserMat, newPtr); // replace old //std::swap(_TexUserMat, newPtr); // replace old
_TexUserMat = std::move(newPtr); _TexUserMat = CUniquePtrMove(newPtr);
} }
} }

View file

@ -1533,7 +1533,7 @@ void CPSConstraintMesh::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
{ {
PGlobalTexAnims newPtr(new CGlobalTexAnims); // create new PGlobalTexAnims newPtr(new CGlobalTexAnims); // create new
//std::swap(_GlobalTexAnims, newPtr); // replace old //std::swap(_GlobalTexAnims, newPtr); // replace old
_GlobalTexAnims = std::move(newPtr); _GlobalTexAnims = CUniquePtrMove(newPtr);
f.serial(*_GlobalTexAnims); f.serial(*_GlobalTexAnims);
} }
@ -2352,7 +2352,7 @@ void CPSConstraintMesh::setTexAnimType(TTexAnimType type)
{ {
PGlobalTexAnims newPtr(new CGlobalTexAnims); PGlobalTexAnims newPtr(new CGlobalTexAnims);
//std::swap(_GlobalTexAnims, newPtr); //std::swap(_GlobalTexAnims, newPtr);
_GlobalTexAnims = std::move(newPtr); _GlobalTexAnims = CUniquePtrMove(newPtr);
_GlobalAnimationEnabled = 1; _GlobalAnimationEnabled = 1;
} }
break; break;

View file

@ -36,7 +36,7 @@ CPSRibbon::TVBMap CPSRibbon::_VBMaps[16];
static ITexture *CreateGradientTexture() static ITexture *CreateGradientTexture()
{ {
NL_PS_FUNC(CreateGradientTexture) NL_PS_FUNC(CreateGradientTexture)
std::unique_ptr<CTextureMem> tex(new CTextureMem((uint8 *) &GradientB2W, CUniquePtr<CTextureMem> tex(new CTextureMem((uint8 *) &GradientB2W,
sizeof(GradientB2W), sizeof(GradientB2W),
false, /* dont delete */ false, /* dont delete */
false, /* not a file */ false, /* not a file */

View file

@ -33,7 +33,7 @@ static NLMISC::CRGBA GradientB2W[] = {NLMISC::CRGBA(0, 0, 0, 0), NLMISC::CRGBA(2
static ITexture *CreateGradientTexture() static ITexture *CreateGradientTexture()
{ {
NL_PS_FUNC(CreateGradientTexture) NL_PS_FUNC(CreateGradientTexture)
std::unique_ptr<CTextureMem> tex(new CTextureMem((uint8 *) &GradientB2W, CUniquePtr<CTextureMem> tex(new CTextureMem((uint8 *) &GradientB2W,
sizeof(GradientB2W), sizeof(GradientB2W),
false, /* dont delete */ false, /* dont delete */
false, /* not a file */ false, /* not a file */

View file

@ -193,7 +193,7 @@ bool CTextureCube::isSelectable() const
ITexture *CTextureCube::buildNonSelectableVersion(uint index) ITexture *CTextureCube::buildNonSelectableVersion(uint index)
{ {
if (!isSelectable()) return this; if (!isSelectable()) return this;
std::unique_ptr<CTextureCube> tc(new CTextureCube); CUniquePtr<CTextureCube> tc(new CTextureCube);
// copy basic texture parameters // copy basic texture parameters
(ITexture &) *tc.get() = (ITexture &) *this; // invoke ITexture = op for basics parameters (ITexture &) *tc.get() = (ITexture &) *this; // invoke ITexture = op for basics parameters

View file

@ -268,7 +268,7 @@ namespace NLMISC
typedef CSynchronized<TMessageQueueMap>::CAccessor TAccessor; typedef CSynchronized<TMessageQueueMap>::CAccessor TAccessor;
// NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794 // NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794
// else, this is one of the way recommended by microsoft to solve the problem. // else, this is one of the way recommended by microsoft to solve the problem.
std::unique_ptr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap)); CUniquePtr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap));
CMsgQueueIdent msgQueueIdent(ownerWindow, localId, foreignId); CMsgQueueIdent msgQueueIdent(ownerWindow, localId, foreignId);
if (messageQueueMap->value().count(msgQueueIdent)) if (messageQueueMap->value().count(msgQueueIdent))
{ {
@ -368,7 +368,7 @@ namespace NLMISC
typedef CSynchronized<TMessageQueueMap>::CAccessor TAccessor; typedef CSynchronized<TMessageQueueMap>::CAccessor TAccessor;
// NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794 // NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794
// else, this is one of the way recommended by microsoft to solve the problem. // else, this is one of the way recommended by microsoft to solve the problem.
std::unique_ptr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap)); CUniquePtr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap));
TMessageQueueMap::iterator it = messageQueueMap->value().find(CMsgQueueIdent(_LocalWindow.getWnd(), _LocalWindow.getId(), _ForeignWindow.getId())); TMessageQueueMap::iterator it = messageQueueMap->value().find(CMsgQueueIdent(_LocalWindow.getWnd(), _LocalWindow.getId(), _ForeignWindow.getId()));
nlassert(it != messageQueueMap->value().end()); nlassert(it != messageQueueMap->value().end());
messageQueueMap->value().erase(it); messageQueueMap->value().erase(it);
@ -408,7 +408,7 @@ namespace NLMISC
typedef CSynchronized<TMessageQueueMap>::CAccessor TAccessor; typedef CSynchronized<TMessageQueueMap>::CAccessor TAccessor;
// NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794 // NB : use a 'new' instead of an automatic object here, because I got an 'INTERNAL COMPILER ERROR' compiler file 'msc1.cpp', line 1794
// else, this is one of the way recommended by microsoft to solve the problem. // else, this is one of the way recommended by microsoft to solve the problem.
std::unique_ptr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap)); CUniquePtr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap));
TMessageQueueMap::iterator it = messageQueueMap->value().find(CMsgQueueIdent(hwnd, toId, fromId)); TMessageQueueMap::iterator it = messageQueueMap->value().find(CMsgQueueIdent(hwnd, toId, fromId));
if (it != messageQueueMap->value().end()) if (it != messageQueueMap->value().end())
{ {

View file

@ -72,7 +72,7 @@ namespace NLNET
friend class CL3ServerRoute; friend class CL3ServerRoute;
public: public:
/// The callback server that receive connection and dispatch message /// The callback server that receive connection and dispatch message
unique_ptr<CCallbackServer> _CallbackServer; CUniquePtr<CCallbackServer> _CallbackServer;
/// A static mapper to retrieve transport from the CCallbackServer pointer /// A static mapper to retrieve transport from the CCallbackServer pointer
typedef map<CCallbackNetBase*, CGatewayL3ServerTransport*> TDispatcherIndex; typedef map<CCallbackNetBase*, CGatewayL3ServerTransport*> TDispatcherIndex;
@ -224,7 +224,7 @@ namespace NLNET
throw ETransportError("openServer : The server is already open"); throw ETransportError("openServer : The server is already open");
// create a new callback server // create a new callback server
unique_ptr<CCallbackServer> cbs(new CCallbackServer()); CUniquePtr<CCallbackServer> cbs(new CCallbackServer());
// register the callbacks // register the callbacks
cbs->setConnectionCallback(cbConnection, static_cast<IGatewayTransport*>(this)); cbs->setConnectionCallback(cbConnection, static_cast<IGatewayTransport*>(this));
@ -234,7 +234,7 @@ namespace NLNET
// open the server // open the server
cbs->init(port); cbs->init(port);
_CallbackServer = std::move(cbs); _CallbackServer = CUniquePtrMove(cbs);
// register it in the dispatcher // register it in the dispatcher
_DispatcherIndex.insert(make_pair(_CallbackServer.get(), this)); _DispatcherIndex.insert(make_pair(_CallbackServer.get(), this));
@ -673,7 +673,7 @@ namespace NLNET
_FreeRoutesIds.pop_back(); _FreeRoutesIds.pop_back();
} }
unique_ptr<CL3ClientRoute> route(new CL3ClientRoute(this, addr, connId)); CUniquePtr<CL3ClientRoute> route(new CL3ClientRoute(this, addr, connId));
// set the callbacks // set the callbacks
route->CallbackClient.setDisconnectionCallback(cbDisconnection, static_cast<IGatewayTransport*>(this)); route->CallbackClient.setDisconnectionCallback(cbDisconnection, static_cast<IGatewayTransport*>(this));

View file

@ -250,7 +250,7 @@ namespace NLNET
// now, load the library // now, load the library
string fullName = NLMISC::CPath::standardizePath(path)+CLibrary::makeLibName(shortName); string fullName = NLMISC::CPath::standardizePath(path)+CLibrary::makeLibName(shortName);
std::unique_ptr<TModuleLibraryInfo> mli(new TModuleLibraryInfo); CUniquePtr<TModuleLibraryInfo> mli(new TModuleLibraryInfo);
if (!mli->LibraryHandler.loadLibrary(fullName, false, true, true)) if (!mli->LibraryHandler.loadLibrary(fullName, false, true, true))
{ {
nlwarning("CModuleManager : failed to load the library '%s' in '%s'", nlwarning("CModuleManager : failed to load the library '%s' in '%s'",
@ -399,7 +399,7 @@ namespace NLNET
IModuleFactory *mf = it->second; IModuleFactory *mf = it->second;
// sanity check // sanity check
nlassert(mf->getModuleClassName() == className); nlassert(mf->getModuleClassName() == className);
std::unique_ptr<IModule> module(mf->createModule()); CUniquePtr<IModule> module(mf->createModule());
if (module.get() == NULL) if (module.get() == NULL)
{ {
nlwarning("createModule : factory failed to create a module instance for class '%s'", className.c_str()); nlwarning("createModule : factory failed to create a module instance for class '%s'", className.c_str());
@ -623,7 +623,7 @@ namespace NLNET
const std::string &moduleManifest, const std::string &moduleManifest,
TModuleId foreignModuleId) TModuleId foreignModuleId)
{ {
std::unique_ptr<CModuleProxy> modProx(new CModuleProxy(localModule, ++_LastGeneratedId, moduleClassName, moduleFullyQualifiedName, moduleManifest)); CUniquePtr<CModuleProxy> modProx(new CModuleProxy(localModule, ++_LastGeneratedId, moduleClassName, moduleFullyQualifiedName, moduleManifest));
modProx->_Gateway = gateway; modProx->_Gateway = gateway;
modProx->_Route = route; modProx->_Route = route;
modProx->_Distance = distance; modProx->_Distance = distance;

View file

@ -103,7 +103,7 @@ UPrimitiveBlock *UPrimitiveBlock::createPrimitiveBlock(NLMISC::IStream &src)
{ {
nlassert(src.isReading()); nlassert(src.isReading());
std::unique_ptr<CPrimitiveBlock> pb(new CPrimitiveBlock); CUniquePtr<CPrimitiveBlock> pb(new CPrimitiveBlock);
pb->serial(src); pb->serial(src);
return pb.release(); return pb.release();
} }

View file

@ -67,7 +67,7 @@ struct CDupObjPolicy
dest.serialPtr(obj); dest.serialPtr(obj);
/*if (dest.isReading()) /*if (dest.isReading())
{ {
std::unique_ptr<T> newObj(new T); CUniquePtr<T> newObj(new T);
newObj->serialPtr(dest); newObj->serialPtr(dest);
delete obj; delete obj;
obj = newObj.release(); obj = newObj.release();
@ -112,7 +112,7 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in)
/** Duplicate the system, and detach. /** Duplicate the system, and detach.
* We can't duplicate the object direclty (it may be referencing other objects in the system, so these objects will be copied too...) * We can't duplicate the object direclty (it may be referencing other objects in the system, so these objects will be copied too...)
*/ */
std::unique_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(in->getOwner())); CUniquePtr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(in->getOwner()));
// scene pointer is not serialised, but 'detach' may need the scene to be specified // scene pointer is not serialised, but 'detach' may need the scene to be specified
newPS->setScene(in->getOwner()->getScene()); newPS->setScene(in->getOwner()->getScene());
return newPS->detach(index); return newPS->detach(index);
@ -142,7 +142,7 @@ NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in)
else else
{ {
CParticleSystem *srcPS = in->getOwner()->getOwner(); CParticleSystem *srcPS = in->getOwner()->getOwner();
std::unique_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(srcPS)); CUniquePtr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(srcPS));
// scene pointer is not serialised, but 'detach' may need the scene to be specified // scene pointer is not serialised, but 'detach' may need the scene to be specified
newPS->setScene(in->getOwner()->getOwner()->getScene()); newPS->setScene(in->getOwner()->getOwner()->getScene());
// //

View file

@ -469,7 +469,7 @@ void CObjectViewer::loadConfigFile()
try try
{ {
CConfigFile::CVar &var = cf.getVar("automatic_animation_path"); CConfigFile::CVar &var = cf.getVar("automatic_animation_path");
std::unique_ptr<CAnimationSet> as(new CAnimationSet); CUniquePtr<CAnimationSet> as(new CAnimationSet);
// //
bool loadingOk = as->loadFromFiles(var.asString(),true ,"anim",true); bool loadingOk = as->loadFromFiles(var.asString(),true ,"anim",true);
// //

View file

@ -574,7 +574,7 @@ void CParticleDlg::OnLoadPSWorkspace()
void CParticleDlg::loadWorkspace(const std::string &fullPath) void CParticleDlg::loadWorkspace(const std::string &fullPath)
{ {
// Add to the path // Add to the path
std::unique_ptr<CParticleWorkspace> newPW(new CParticleWorkspace); CUniquePtr<CParticleWorkspace> newPW(new CParticleWorkspace);
newPW->init(_ObjView, fullPath, _ObjView->getFontManager(), _ObjView->getFontGenerator()); newPW->init(_ObjView, fullPath, _ObjView->getFontManager(), _ObjView->getFontGenerator());
newPW->setModificationCallback(ParticleTreeCtrl); newPW->setModificationCallback(ParticleTreeCtrl);
// save empty workspace // save empty workspace

View file

@ -1006,7 +1006,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())));
std::unique_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank); CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
CParticleSystemModel *psm = NULL; CParticleSystemModel *psm = NULL;
try try
{ {

View file

@ -182,8 +182,8 @@ private:
// Matching infos for each nodes in the CTreeCtrl // Matching infos for each nodes in the CTreeCtrl
std::vector<CNodeType *> _NodeTypes; std::vector<CNodeType *> _NodeTypes;
// //
std::unique_ptr<NL3D::CPSLocated> _LocatedCopy; CUniquePtr<NL3D::CPSLocated> _LocatedCopy;
std::unique_ptr<NL3D::CPSLocatedBindable> _LocatedBindableCopy; CUniquePtr<NL3D::CPSLocatedBindable> _LocatedBindableCopy;
// //
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
// from CParticleWorkspace::IModificationCallback // from CParticleWorkspace::IModificationCallback

View file

@ -202,7 +202,7 @@ void CParticleWorkspace::CNode::createEmptyPS()
NL3D::CParticleSystem emptyPS; NL3D::CParticleSystem emptyPS;
NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape; NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape;
pss->buildFromPS(emptyPS); pss->buildFromPS(emptyPS);
std::unique_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank); CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath);
sb->add(shapeName, pss); sb->add(shapeName, pss);
NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank(); NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank();
@ -298,7 +298,7 @@ bool CParticleWorkspace::CNode::loadPS()
// collapse name // collapse name
inputFile.open(getFullPath()); inputFile.open(getFullPath());
ss.serial(inputFile); ss.serial(inputFile);
std::unique_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank); CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath);
sb->add(shapeName, ss.getShapePointer()); sb->add(shapeName, ss.getShapePointer());
NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank(); NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank();

View file

@ -121,7 +121,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString
return; return;
} }
std::unique_ptr<TCHAR[]> tmpDest(new TCHAR[size]); CUniquePtr<TCHAR[]> tmpDest(new TCHAR[size]);
result = RegQueryValueEx(hKey, name, NULL, &type, (BYTE*)tmpDest.get(), &size); result = RegQueryValueEx(hKey, name, NULL, &type, (BYTE*)tmpDest.get(), &size);
if (result != ERROR_SUCCESS) if (result != ERROR_SUCCESS)
@ -130,7 +130,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString
return; return;
} }
dest = *tmpDest; dest = tmpDest.get();
} }

View file

@ -1180,7 +1180,7 @@ void CExportNel::getBSMeshBuild (std::vector<CMesh::CMeshBuild*> &bsList, INode
convertMatrix(finalSpace, node.GetNodeTM(time)); convertMatrix(finalSpace, node.GetNodeTM(time));
CMeshBase::CMeshBaseBuild *dummyMBB = NULL; CMeshBase::CMeshBaseBuild *dummyMBB = NULL;
std::unique_ptr<CMesh::CMeshBuild> baseMB(createMeshBuild (node, time, dummyMBB, finalSpace)); CUniquePtr<CMesh::CMeshBuild> baseMB(createMeshBuild (node, time, dummyMBB, finalSpace));
delete dummyMBB; delete dummyMBB;
dummyMBB = NULL; dummyMBB = NULL;
if (baseMB.get() == NULL) return; if (baseMB.get() == NULL) return;

View file

@ -39,7 +39,7 @@ static void buildRemanenceError(CExportNel *en, INode &node, const char *mess)
//============================================================================================= //=============================================================================================
NL3D::IShape *CExportNel::buildRemanence(INode& node, TimeValue time) NL3D::IShape *CExportNel::buildRemanence(INode& node, TimeValue time)
{ {
std::unique_ptr<CSegRemanenceShape> srs(new CSegRemanenceShape); CUniquePtr<CSegRemanenceShape> srs(new CSegRemanenceShape);
uint numSlices = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_SLICE_NUMBER, 2); uint numSlices = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_SLICE_NUMBER, 2);
float samplingPeriod = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_SAMPLING_PERIOD, 0.02f); float samplingPeriod = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_SAMPLING_PERIOD, 0.02f);
float rollupRatio = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_ROLLUP_RATIO, 1.f); float rollupRatio = getScriptAppData (&node, NEL3D_APPDATA_REMANENCE_ROLLUP_RATIO, 1.f);

View file

@ -95,7 +95,7 @@ static CZone *LoadZone(uint16 xPos, uint16 yPos, std::string zoneExt)
{ {
std::string zoneName; std::string zoneName;
::getZoneNameByCoord(xPos, yPos, zoneName); ::getZoneNameByCoord(xPos, yPos, zoneName);
std::unique_ptr<CZone> zone(new CZone); CUniquePtr<CZone> zone(new CZone);
std::string lookedUpZoneName = CPath::lookup(zoneName + zoneExt, false, false, false); std::string lookedUpZoneName = CPath::lookup(zoneName + zoneExt, false, false, false);
if (lookedUpZoneName.empty()) return NULL; if (lookedUpZoneName.empty()) return NULL;
CIFile iF; CIFile iF;
@ -174,7 +174,7 @@ static uint CheckZone(std::string middleZoneFile, float weldThreshold, float mid
// Load the zones around // // Load the zones around //
//////////////////////////// ////////////////////////////
std::unique_ptr<CZone> zones[9]; CUniquePtr<CZone> zones[9];
std::string zoneNames[9]; std::string zoneNames[9];
CZoneInfo zoneInfos[9]; CZoneInfo zoneInfos[9];
uint16 xPos, yPos; uint16 xPos, yPos;

View file

@ -153,7 +153,7 @@ static void loadIGFromVillage(const NLGEORGES::UFormElm *villageItem, const std:
if (inputFile.open (nameLookup)) if (inputFile.open (nameLookup))
{ {
// New ig // New ig
std::unique_ptr<CInstanceGroup> group(new CInstanceGroup); CUniquePtr<CInstanceGroup> group(new CInstanceGroup);
try try
{ {
group->serial (inputFile); group->serial (inputFile);

View file

@ -67,7 +67,7 @@ static void usage()
exit(0); exit(0);
} }
static unique_ptr<Test::Output> cmdline(int argc, char* argv[]) static CUniquePtr<Test::Output> cmdline(int argc, char* argv[])
{ {
if (argc > 2) if (argc > 2)
usage(); // will not return usage(); // will not return
@ -102,7 +102,7 @@ static unique_ptr<Test::Output> cmdline(int argc, char* argv[])
} }
} }
return unique_ptr<Test::Output>(output); return CUniquePtr<Test::Output>(output);
} }
// Main test program // Main test program
@ -134,12 +134,12 @@ int main(int argc, char *argv[])
{ {
Test::Suite ts; Test::Suite ts;
ts.add(unique_ptr<Test::Suite>(new CUTMisc)); ts.add(CUniquePtr<Test::Suite>(new CUTMisc));
ts.add(unique_ptr<Test::Suite>(new CUTNet)); ts.add(CUniquePtr<Test::Suite>(new CUTNet));
ts.add(unique_ptr<Test::Suite>(new CUTLigo)); ts.add(CUniquePtr<Test::Suite>(new CUTLigo));
// Add a line here when adding a new test MODULE // Add a line here when adding a new test MODULE
unique_ptr<Test::Output> output(cmdline(argc, argv)); CUniquePtr<Test::Output> output(cmdline(argc, argv));
noerrors = ts.run(*output); noerrors = ts.run(*output);
Test::HtmlOutput* const html = dynamic_cast<Test::HtmlOutput*>(output.get()); Test::HtmlOutput* const html = dynamic_cast<Test::HtmlOutput*>(output.get());

View file

@ -26,7 +26,7 @@ struct CUTLigo : public Test::Suite
{ {
CUTLigo() CUTLigo()
{ {
add(unique_ptr<Test::Suite>(new CUTLigoPrimitive)); add(CUniquePtr<Test::Suite>(new CUTLigoPrimitive));
// Add a line here when adding a new test CLASS // Add a line here when adding a new test CLASS
} }
}; };

View file

@ -37,20 +37,20 @@ struct CUTMisc : public Test::Suite
{ {
CUTMisc() CUTMisc()
{ {
add(unique_ptr<Test::Suite>(new CUTMiscCoTask)); add(CUniquePtr<Test::Suite>(new CUTMiscCoTask));
add(unique_ptr<Test::Suite>(new CUTMiscCommand)); add(CUniquePtr<Test::Suite>(new CUTMiscCommand));
add(unique_ptr<Test::Suite>(new CUTMiscCommon)); add(CUniquePtr<Test::Suite>(new CUTMiscCommon));
add(unique_ptr<Test::Suite>(new CUTMiscConfigFile)); add(CUniquePtr<Test::Suite>(new CUTMiscConfigFile));
add(unique_ptr<Test::Suite>(new CUTMiscDebug)); add(CUniquePtr<Test::Suite>(new CUTMiscDebug));
add(unique_ptr<Test::Suite>(new CUTMiscDynLibLoad)); add(CUniquePtr<Test::Suite>(new CUTMiscDynLibLoad));
add(unique_ptr<Test::Suite>(new CUTMiscFile)); add(CUniquePtr<Test::Suite>(new CUTMiscFile));
add(unique_ptr<Test::Suite>(new CUTMiscPackFile)); add(CUniquePtr<Test::Suite>(new CUTMiscPackFile));
add(unique_ptr<Test::Suite>(new CUTMiscSingleton)); add(CUniquePtr<Test::Suite>(new CUTMiscSingleton));
add(unique_ptr<Test::Suite>(new CUTMiscSString)); add(CUniquePtr<Test::Suite>(new CUTMiscSString));
add(unique_ptr<Test::Suite>(new CUTMiscStream)); add(CUniquePtr<Test::Suite>(new CUTMiscStream));
add(unique_ptr<Test::Suite>(new CUTMiscVariable)); add(CUniquePtr<Test::Suite>(new CUTMiscVariable));
add(unique_ptr<Test::Suite>(new CUTMiscTypes)); add(CUniquePtr<Test::Suite>(new CUTMiscTypes));
add(unique_ptr<Test::Suite>(new CUTMiscStringCommon)); add(CUniquePtr<Test::Suite>(new CUTMiscStringCommon));
// Add a line here when adding a new test CLASS // Add a line here when adding a new test CLASS
} }
}; };

View file

@ -28,9 +28,9 @@ struct CUTNet : public Test::Suite
{ {
CUTNet() CUTNet()
{ {
add(unique_ptr<Test::Suite>(new CUTNetLayer3)); add(CUniquePtr<Test::Suite>(new CUTNetLayer3));
add(unique_ptr<Test::Suite>(new CUTNetMessage)); add(CUniquePtr<Test::Suite>(new CUTNetMessage));
add(unique_ptr<Test::Suite>(new CUTNetModule)); add(CUniquePtr<Test::Suite>(new CUTNetModule));
// Add a line here when adding a new test CLASS // Add a line here when adding a new test CLASS
} }
}; };

View file

@ -273,7 +273,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig)
sShapeName = CPath::lookup(sShapeName,false); sShapeName = CPath::lookup(sShapeName,false);
if (!sShapeName.empty()) if (!sShapeName.empty())
{ {
std::unique_ptr<NLPACS::UPrimitiveBlock> pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(sShapeName)); CUniquePtr<NLPACS::UPrimitiveBlock> pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(sShapeName));
NLPACS::UPrimitiveBlock *pPB = pb.release(); NLPACS::UPrimitiveBlock *pPB = pb.release();
bool bDoorDetectPresent = false; bool bDoorDetectPresent = false;

View file

@ -194,7 +194,7 @@ void addPacsPrim(const std::string &fileName)
nlwarning(("Pacs primitive " + ppName + " already has been inserted").c_str()); nlwarning(("Pacs primitive " + ppName + " already has been inserted").c_str());
return; return;
} }
std::unique_ptr<NLPACS::UPrimitiveBlock> pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(fileName)); CUniquePtr<NLPACS::UPrimitiveBlock> pb(NLPACS::UPrimitiveBlock::createPrimitiveBlockFromFile(fileName));
PacsPrims[ppName] = pb.release(); PacsPrims[ppName] = pb.release();
} }

View file

@ -264,7 +264,7 @@ void CAutoGroup::group(CObject *newEntityDesc, const NLMISC::CVectorD &createPos
else else
{ {
// other is a standalone entity -> create a new group // other is a standalone entity -> create a new group
std::unique_ptr<CObject> newGroup(getEditor().getDMC().newComponent("NpcGrpFeature")); CUniquePtr<CObject> newGroup(getEditor().getDMC().newComponent("NpcGrpFeature"));
if (!newGroup.get()) if (!newGroup.get())
{ {
nlwarning("Syntax error in r2_features_npc_group.lua."); nlwarning("Syntax error in r2_features_npc_group.lua.");

View file

@ -132,7 +132,7 @@ namespace R2 {
client->onScenarioUploaded(server, _Value.get()); client->onScenarioUploaded(server, _Value.get());
} }
private: private:
std::unique_ptr<R2::CObject> _Value; CUniquePtr<R2::CObject> _Value;
}; };
class CServerAnswerMsgSet: public IServerAnswerMsg class CServerAnswerMsgSet: public IServerAnswerMsg
@ -148,7 +148,7 @@ namespace R2 {
private: private:
std::string _InstanceId; std::string _InstanceId;
std::string _AttrName; std::string _AttrName;
std::unique_ptr<R2::CObject> _Value; CUniquePtr<R2::CObject> _Value;
}; };
class CServerAnswerMsgInserted: public IServerAnswerMsg class CServerAnswerMsgInserted: public IServerAnswerMsg
@ -166,7 +166,7 @@ namespace R2 {
std::string _AttrName; std::string _AttrName;
sint32 _Position; sint32 _Position;
std::string _Key; std::string _Key;
std::unique_ptr<R2::CObject> _Value; CUniquePtr<R2::CObject> _Value;
}; };
class CServerAnswerMsgErased: public IServerAnswerMsg class CServerAnswerMsgErased: public IServerAnswerMsg
@ -1140,7 +1140,7 @@ void CClientEditionModule::startingScenario(class NLNET::IModuleProxy * /* serve
_Factory->setMaxId("RtEntryText", 0); _Factory->setMaxId("RtEntryText", 0);
_Factory->setMaxId("RtPlotItem", 0); _Factory->setMaxId("RtPlotItem", 0);
std::unique_ptr<CObject> rtDataPtr( _Client->getComLuaModule().translateFeatures(hlScenario , errorMsg) ); CUniquePtr<CObject> rtDataPtr( _Client->getComLuaModule().translateFeatures(hlScenario , errorMsg) );
rtData.setData(rtDataPtr.get()); rtData.setData(rtDataPtr.get());
if (rtDataPtr.get()) if (rtDataPtr.get())
@ -2351,7 +2351,7 @@ void CClientEditionModule::loadUserComponentFileAccepted(NLNET::IModuleProxy * /
return; return;
} }
unique_ptr<CUserComponentValidator> userComponentToLoad(found->second); CUniquePtr<CUserComponentValidator> userComponentToLoad(found->second);
_UserComponentToLoad.erase(found); _UserComponentToLoad.erase(found);
if (!ok) if (!ok)
@ -2383,7 +2383,7 @@ void CClientEditionModule::saveScenarioFileAccepted(NLNET::IModuleProxy *senderM
return; return;
} }
unique_ptr<CScenarioValidator> scenarioToSave(found->second); CUniquePtr<CScenarioValidator> scenarioToSave(found->second);
_ScenarioToSave.erase(found); _ScenarioToSave.erase(found);
if (ok) if (ok)
@ -2498,7 +2498,7 @@ void CClientEditionModule::loadScenarioFileAccepted(NLNET::IModuleProxy * /* sen
return; return;
} }
unique_ptr<CScenarioValidator> scenarioToLoad(found->second); CUniquePtr<CScenarioValidator> scenarioToLoad(found->second);
_ScenarioToLoad.erase(found); _ScenarioToLoad.erase(found);
if (!ok) if (!ok)

View file

@ -1169,7 +1169,7 @@ private:
uint32 _MaxNpcs; uint32 _MaxNpcs;
uint32 _MaxStaticObjects; uint32 _MaxStaticObjects;
std::unique_ptr<R2::CEmoteBehavior> _Emotes; CUniquePtr<R2::CEmoteBehavior> _Emotes;
CEditorConfig* _ClientEditorConfig; CEditorConfig* _ClientEditorConfig;

View file

@ -227,7 +227,7 @@ std::string CToolCreateEntity::cloneEntityIntoScenario(CEntityCL *clonee,
getDMC().newAction(NLMISC::CI18N::get("uiR2EDCreateAction") + readableName); getDMC().newAction(NLMISC::CI18N::get("uiR2EDCreateAction") + readableName);
} }
// send network commands to create entity on server // send network commands to create entity on server
std::unique_ptr<CObject> desc(getDMC().newComponent(className)); CUniquePtr<CObject> desc(getDMC().newComponent(className));
if (desc.get()) if (desc.get())
{ {

View file

@ -377,7 +377,7 @@ void CToolSelectMove::commitAction(CInstance &instance)
if (_AutoGroup.getGroupingCandidate()) if (_AutoGroup.getGroupingCandidate())
{ {
newCopy.push(); newCopy.push();
std::unique_ptr<CObject> desc(CComLuaModule::getObjectFromLua(ls.getStatePointer())); CUniquePtr<CObject> desc(CComLuaModule::getObjectFromLua(ls.getStatePointer()));
_AutoGroup.group(desc.get(), _FinalPos); _AutoGroup.group(desc.get(), _FinalPos);
} }
else else

View file

@ -196,13 +196,13 @@ bool unpackLZMA(const std::string &lzmaFile, const std::string &destFileName)
} }
// allocate input buffer for props // allocate input buffer for props
unique_ptr<uint8[]> propsBuffer(new uint8[LZMA_PROPS_SIZE]); CUniquePtr<uint8[]> propsBuffer(new uint8[LZMA_PROPS_SIZE]);
// size of LZMA content // size of LZMA content
inSize -= LZMA_PROPS_SIZE + 8; inSize -= LZMA_PROPS_SIZE + 8;
// allocate input buffer for lzma data // allocate input buffer for lzma data
unique_ptr<uint8[]> inBuffer(new uint8[inSize]); CUniquePtr<uint8[]> inBuffer(new uint8[inSize]);
uint64 fileSize = 0; uint64 fileSize = 0;
@ -224,7 +224,7 @@ bool unpackLZMA(const std::string &lzmaFile, const std::string &destFileName)
} }
// allocate the output buffer // allocate the output buffer
unique_ptr<uint8[]> outBuffer(new uint8[fileSize]); CUniquePtr<uint8[]> outBuffer(new uint8[fileSize]);
// in and out file sizes // in and out file sizes
SizeT outProcessed = (SizeT)fileSize; SizeT outProcessed = (SizeT)fileSize;
@ -273,7 +273,7 @@ bool packLZMA(const std::string &srcFileName, const std::string &lzmaFileName)
} }
// allocate input buffer // allocate input buffer
unique_ptr<uint8[]> inBuffer(new uint8[inSize]); CUniquePtr<uint8[]> inBuffer(new uint8[inSize]);
try try
{ {
@ -288,11 +288,11 @@ bool packLZMA(const std::string &srcFileName, const std::string &lzmaFileName)
// allocate output buffer // allocate output buffer
size_t outSize = (11 * inSize / 10) + 65536; // worst case = 1.1 * size + 64K size_t outSize = (11 * inSize / 10) + 65536; // worst case = 1.1 * size + 64K
unique_ptr<uint8[]> outBuffer(new uint8[outSize]); CUniquePtr<uint8[]> outBuffer(new uint8[outSize]);
// allocate buffer for props // allocate buffer for props
size_t outPropsSize = LZMA_PROPS_SIZE; size_t outPropsSize = LZMA_PROPS_SIZE;
unique_ptr<uint8[]> outProps(new uint8[outPropsSize]); CUniquePtr<uint8[]> outProps(new uint8[outPropsSize]);
// compress with best compression and other default settings // compress with best compression and other default settings
sint res = LzmaCompress(outBuffer.get(), &outSize, inBuffer.get(), inSize, outProps.get(), &outPropsSize, 9, 1 << 27, -1, -1, -1, -1, 1); sint res = LzmaCompress(outBuffer.get(), &outSize, inBuffer.get(), inSize, outProps.get(), &outPropsSize, 9, 1 << 27, -1, -1, -1, -1, 1);

View file

@ -294,7 +294,7 @@ CBitmap *buildSharedBitmap(const std::string &filename,
// load the bitmap // load the bitmap
std::string path = CPath::lookup(filename, false); std::string path = CPath::lookup(filename, false);
if (path.empty()) return NULL; if (path.empty()) return NULL;
std::unique_ptr<CBitmap> bm(new CBitmap); CUniquePtr<CBitmap> bm(new CBitmap);
try try
{ {
CIFile f; CIFile f;

View file

@ -2393,7 +2393,7 @@ namespace RSMGR
protected: protected:
/// the callback server adaptor /// the callback server adaptor
std::unique_ptr<ICallbackServerAdaptor> _CallbackServer; CUniquePtr<ICallbackServerAdaptor> _CallbackServer;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
{ {
@ -2464,12 +2464,12 @@ namespace RSMGR
if (replacementAdaptor == NULL) if (replacementAdaptor == NULL)
{ {
// use default callback server // use default callback server
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this)); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(replacementAdaptor); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(replacementAdaptor);
} }
} }
@ -3858,7 +3858,7 @@ namespace RSMGR
protected: protected:
/// the callback client adaptor /// the callback client adaptor
std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; CUniquePtr < ICallbackClientAdaptor > _CallbackClient;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
@ -3922,12 +3922,12 @@ namespace RSMGR
if (adaptorReplacement == NULL) if (adaptorReplacement == NULL)
{ {
// use the default Nel adaptor // use the default Nel adaptor
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement);
} }
} }

View file

@ -362,7 +362,7 @@ public:
typedef std::map<uint32, TCharacterInfo> TCharacterInfos; typedef std::map<uint32, TCharacterInfo> TCharacterInfos;
public: public:
std::unique_ptr<CObject> RtData; CUniquePtr<CObject> RtData;
TScenarioHeaderSerializer ScenarioHeader; TScenarioHeaderSerializer ScenarioHeader;
TSessionId SessionId; TSessionId SessionId;
//vector<userId> //vector<userId>

View file

@ -2215,7 +2215,7 @@ void CServerEditionModule::onNodeSetAsked(NLNET::IModuleProxy *senderModuleProxy
value2.uncompress(); value2.uncompress();
CObject* value = value2.getData(); CObject* value = value2.getData();
std::unique_ptr<CObject> autoDelete(value); CUniquePtr<CObject> autoDelete(value);
bool ok = checkSecurityInfo(senderModuleProxy, charId, clientEid, userPriv, extendedPriv); bool ok = checkSecurityInfo(senderModuleProxy, charId, clientEid, userPriv, extendedPriv);
@ -5116,7 +5116,7 @@ bool CServerEditionModule::wakeUpSession(TSessionId sessionId, TCharId ownerChar
void CServerEditionModule::wakeUpSessionImpl(CEditionSession* session) void CServerEditionModule::wakeUpSessionImpl(CEditionSession* session)
{ {
std::unique_ptr<CEditionSession> sessionPtr(session); CUniquePtr<CEditionSession> sessionPtr(session);
TSessionId sessionId = sessionPtr->SessionId; TSessionId sessionId = sessionPtr->SessionId;
TSessions::iterator found = _Sessions.find(sessionId); TSessions::iterator found = _Sessions.find(sessionId);

View file

@ -541,7 +541,7 @@ namespace R2
private: private:
std::set<TSessionId> _Sessions; std::set<TSessionId> _Sessions;
std::unique_ptr<CUserComponent> _Component; CUniquePtr<CUserComponent> _Component;
}; };
struct CHashKeyMD5Less : public std::binary_function<NLMISC::CHashKeyMD5, NLMISC::CHashKeyMD5, bool> struct CHashKeyMD5Less : public std::binary_function<NLMISC::CHashKeyMD5, NLMISC::CHashKeyMD5, bool>
@ -637,7 +637,7 @@ namespace R2
CTaskList<NLMISC::TTime> _RingAccessTasks; // Remove people that do not belong here CTaskList<NLMISC::TTime> _RingAccessTasks; // Remove people that do not belong here
TOverrideRingAccess _OverrideRingAccess; //Ring access for dev TOverrideRingAccess _OverrideRingAccess; //Ring access for dev
bool _MustUpdateOverrideRingAcess; bool _MustUpdateOverrideRingAcess;
std::unique_ptr<CIdRecycle> _IdRecycle; CUniquePtr<CIdRecycle> _IdRecycle;
TKicked _Kicked; TKicked _Kicked;
// //

View file

@ -55,7 +55,7 @@ namespace ADMIN
protected: protected:
/// the callback server adaptor /// the callback server adaptor
std::unique_ptr<ICallbackServerAdaptor> _CallbackServer; CUniquePtr<ICallbackServerAdaptor> _CallbackServer;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
{ {
@ -102,12 +102,12 @@ namespace ADMIN
if (replacementAdaptor == NULL) if (replacementAdaptor == NULL)
{ {
// use default callback server // use default callback server
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this)); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(replacementAdaptor); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(replacementAdaptor);
} }
} }
@ -439,7 +439,7 @@ namespace ADMIN
protected: protected:
/// the callback client adaptor /// the callback client adaptor
std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; CUniquePtr < ICallbackClientAdaptor > _CallbackClient;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
@ -493,12 +493,12 @@ namespace ADMIN
if (adaptorReplacement == NULL) if (adaptorReplacement == NULL)
{ {
// use the default Nel adaptor // use the default Nel adaptor
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement);
} }
} }

View file

@ -145,7 +145,7 @@ CQueryParser::TParserResult CQueryParser::parseQuery(const std::string &queryStr
return pr; return pr;
} }
unique_ptr<TQueryNode> rootNode(parseExpr(first, queryStr.end())); CUniquePtr<TQueryNode> rootNode(parseExpr(first, queryStr.end()));
// make sure we have consumed all the stream // make sure we have consumed all the stream
iterator rew = first; iterator rew = first;

View file

@ -1190,7 +1190,7 @@ public:
struct TParserResult struct TParserResult
{ {
/// The query tree /// The query tree
mutable std::unique_ptr<TQueryNode> QueryTree; mutable CUniquePtr<TQueryNode> QueryTree;
/// Option to extract full context with selected logs /// Option to extract full context with selected logs
bool FullContext; bool FullContext;

View file

@ -293,7 +293,7 @@ void CContinentContainer::initPacsPrim(const string &path)
if (_PacsPrimMap.find(ppName) != _PacsPrimMap.end()) if (_PacsPrimMap.find(ppName) != _PacsPrimMap.end())
continue; continue;
std::unique_ptr<UPrimitiveBlock> pb(UPrimitiveBlock::createPrimitiveBlockFromFile(CPath::lookup(fileNames[k], false))); CUniquePtr<UPrimitiveBlock> pb(UPrimitiveBlock::createPrimitiveBlockFromFile(CPath::lookup(fileNames[k], false)));
UPrimitiveBlock* ptr = pb.release(); UPrimitiveBlock* ptr = pb.release();
if (ptr != NULL) if (ptr != NULL)
{ {

View file

@ -43,7 +43,7 @@ namespace LS
protected: protected:
/// the callback server adaptor /// the callback server adaptor
std::unique_ptr<ICallbackServerAdaptor> _CallbackServer; CUniquePtr<ICallbackServerAdaptor> _CallbackServer;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
{ {
@ -85,12 +85,12 @@ namespace LS
if (replacementAdaptor == NULL) if (replacementAdaptor == NULL)
{ {
// use default callback server // use default callback server
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this)); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(replacementAdaptor); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(replacementAdaptor);
} }
} }
@ -259,7 +259,7 @@ namespace LS
protected: protected:
/// the callback client adaptor /// the callback client adaptor
std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; CUniquePtr < ICallbackClientAdaptor > _CallbackClient;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
@ -315,12 +315,12 @@ namespace LS
if (adaptorReplacement == NULL) if (adaptorReplacement == NULL)
{ {
// use the default Nel adaptor // use the default Nel adaptor
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement);
} }
} }

View file

@ -168,7 +168,7 @@ namespace MFS
protected: protected:
/// the callback server adaptor /// the callback server adaptor
std::unique_ptr<ICallbackServerAdaptor> _CallbackServer; CUniquePtr<ICallbackServerAdaptor> _CallbackServer;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
{ {
@ -210,12 +210,12 @@ namespace MFS
if (replacementAdaptor == NULL) if (replacementAdaptor == NULL)
{ {
// use default callback server // use default callback server
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this)); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(new CNelCallbackServerAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackServer = std::unique_ptr<ICallbackServerAdaptor>(replacementAdaptor); _CallbackServer = CUniquePtr<ICallbackServerAdaptor>(replacementAdaptor);
} }
} }
@ -351,7 +351,7 @@ namespace MFS
protected: protected:
/// the callback client adaptor /// the callback client adaptor
std::unique_ptr < ICallbackClientAdaptor > _CallbackClient; CUniquePtr < ICallbackClientAdaptor > _CallbackClient;
void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize)
@ -405,12 +405,12 @@ namespace MFS
if (adaptorReplacement == NULL) if (adaptorReplacement == NULL)
{ {
// use the default Nel adaptor // use the default Nel adaptor
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this)); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(new CNelCallbackClientAdaptor(this));
} }
else else
{ {
// use the replacement one // use the replacement one
_CallbackClient = std::unique_ptr < ICallbackClientAdaptor >(adaptorReplacement); _CallbackClient = CUniquePtr < ICallbackClientAdaptor >(adaptorReplacement);
} }
} }

View file

@ -237,22 +237,22 @@ namespace MSW
} }
std::unique_ptr<CStoreResult> CConnection::storeResult() CUniquePtr<CStoreResult> CConnection::storeResult()
{ {
H_AUTO(CConnection_storeResult); H_AUTO(CConnection_storeResult);
MYSQL_RES *res = mysql_store_result(_MysqlContext); MYSQL_RES *res = mysql_store_result(_MysqlContext);
std::unique_ptr<CStoreResult> sr(new CStoreResult(res)); CUniquePtr<CStoreResult> sr(new CStoreResult(res));
return sr; return sr;
} }
std::unique_ptr<CUseResult> CConnection::useResult() CUniquePtr<CUseResult> CConnection::useResult()
{ {
H_AUTO(CConnection_useResult); H_AUTO(CConnection_useResult);
MYSQL_RES *res = mysql_use_result(_MysqlContext); MYSQL_RES *res = mysql_use_result(_MysqlContext);
std::unique_ptr<CUseResult> sr(new CUseResult(res)); CUniquePtr<CUseResult> sr(new CUseResult(res));
return sr; return sr;
} }

View file

@ -108,8 +108,8 @@ namespace MSW
return uint32(mysql_affected_rows(_MysqlContext)); return uint32(mysql_affected_rows(_MysqlContext));
} }
std::unique_ptr<CStoreResult> storeResult(); CUniquePtr<CStoreResult> storeResult();
std::unique_ptr<CUseResult> useResult(); CUniquePtr<CUseResult> useResult();
}; };

View file

@ -642,7 +642,7 @@ public:
return; return;
} }
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
if (result->getNumRows() != 1) if (result->getNumRows() != 1)
{ {
nlinfo("Client from '%s' submited auth cookie '%s' for user %u, but DB return %u row instead of 1", nlinfo("Client from '%s' submited auth cookie '%s' for user %u, but DB return %u row instead of 1",
@ -726,7 +726,7 @@ public:
query << "SELECT session_id, kicked"; query << "SELECT session_id, kicked";
query << " FROM session_participant WHERE char_id = "<< charId; query << " FROM session_participant WHERE char_id = "<< charId;
BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
uint32 row = result->getNumRows(); uint32 row = result->getNumRows();
uint32 index = 0; uint32 index = 0;
@ -757,7 +757,7 @@ public:
query << " FROM characters WHERE char_id = "<<charId; query << " FROM characters WHERE char_id = "<<charId;
BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
BOMB_IF(result->getNumRows() != 1, "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); BOMB_IF(result->getNumRows() != 1, "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return);
result->fetchRow(); result->fetchRow();
uint32 guildId; uint32 guildId;
@ -831,7 +831,7 @@ public:
BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return);
unique_ptr<CStoreResult> result2(_RingDB.storeResult()); CUniquePtr<CStoreResult> result2(_RingDB.storeResult());
// BOMB_IF(result->getNumFields() != 1, "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); // BOMB_IF(result->getNumFields() != 1, "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return);
// parse the result set and build the return vector // parse the result set and build the return vector
@ -917,7 +917,7 @@ public:
query << " WHERE current_status='cs_online'"; query << " WHERE current_status='cs_online'";
query << " AND current_session="<< sd.getSessionId(); query << " AND current_session="<< sd.getSessionId();
BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return); BOMB_IF(!_RingDB.query(query), "error", CSessionBrowserServerWebItf::_CallbackServer->disconnect(from); return);
unique_ptr<CStoreResult> result3(_RingDB.storeResult()); CUniquePtr<CStoreResult> result3(_RingDB.storeResult());
BOMB_IF(result2->getNumRows()<1,"Expected 1 result from SQL nbPlayers request but retrieved none",return); BOMB_IF(result2->getNumRows()<1,"Expected 1 result from SQL nbPlayers request but retrieved none",return);
uint32 nbPlayers; uint32 nbPlayers;
result3->fetchRow(); result3->fetchRow();
@ -960,7 +960,7 @@ public:
query << " AND ring_users.user_id = characters.user_id"; query << " AND ring_users.user_id = characters.user_id";
BOMB_IF(!_RingDB.query(query), "getCharList : error executing request in database", charList(from, charId, sessionId, vector <TCharDesc>()); return); BOMB_IF(!_RingDB.query(query), "getCharList : error executing request in database", charList(from, charId, sessionId, vector <TCharDesc>()); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
vector <TCharDesc> charDescs; vector <TCharDesc> charDescs;
charDescs.resize(result->getNumRows()); charDescs.resize(result->getNumRows());
@ -1044,7 +1044,7 @@ public:
CSString query; CSString query;
query << "SELECT home_mainland_session_id, current_session FROM characters WHERE char_id = "<<charId; query << "SELECT home_mainland_session_id, current_session FROM characters WHERE char_id = "<<charId;
BOMB_IF(!_RingDB.query(query), "invitedCharacterByName : failed request in database", invokeResult(from, charId >> 4, 103, "Database request failed"); return); BOMB_IF(!_RingDB.query(query), "invitedCharacterByName : failed request in database", invokeResult(from, charId >> 4, 103, "Database request failed"); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
BOMB_IF (result->getNumRows() == 0, "invitedCharacterByName : can't find char "<<charId<<" in the characters table", invokeResult(from, charId >> 4, 100, "Owner requester character"); return); BOMB_IF (result->getNumRows() == 0, "invitedCharacterByName : can't find char "<<charId<<" in the characters table", invokeResult(from, charId >> 4, 100, "Owner requester character"); return);
result->fetchRow(); result->fetchRow();
@ -1064,7 +1064,7 @@ public:
query << "SELECT char_id FROM characters WHERE char_name = '"<<shortName<<"' AND home_mainland_session_id = "<<invitedCharHome.asInt(); query << "SELECT char_id FROM characters WHERE char_name = '"<<shortName<<"' AND home_mainland_session_id = "<<invitedCharHome.asInt();
BOMB_IF(!_RingDB.query(query), "invitedCharacterByName : failed request 2 in database", invokeResult(from, charId >> 4, 103, "Database request failed"); return); BOMB_IF(!_RingDB.query(query), "invitedCharacterByName : failed request 2 in database", invokeResult(from, charId >> 4, 103, "Database request failed"); return);
result = unique_ptr<CStoreResult>(_RingDB.storeResult()); result = CUniquePtr<CStoreResult>(_RingDB.storeResult());
BOMB_IF (result->getNumRows() == 0, "invitedCharacterByName : can't find invited char '"<<shortName<<"' from shard "<<invitedCharHome.asInt()<<" in the characters table", invokeResult(from, charId >> 4, 104, "Invited char not found"); return); BOMB_IF (result->getNumRows() == 0, "invitedCharacterByName : can't find invited char '"<<shortName<<"' from shard "<<invitedCharHome.asInt()<<" in the characters table", invokeResult(from, charId >> 4, 104, "Invited char not found"); return);
result->fetchRow(); result->fetchRow();
@ -1097,7 +1097,7 @@ public:
query << " WHERE char_id = "<<charId<<" AND session_log.id = "<<sessionId; query << " WHERE char_id = "<<charId<<" AND session_log.id = "<<sessionId;
BOMB_IF(!_RingDB.query(query), "getRingRatings : failed request in database", playerRatings(from, charId, false, 0,0,0,0,0); return); BOMB_IF(!_RingDB.query(query), "getRingRatings : failed request in database", playerRatings(from, charId, false, 0,0,0,0,0); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
if (result->getNumRows() == 0) if (result->getNumRows() == 0)
{ {
@ -1133,7 +1133,7 @@ public:
query << " GROUP BY session_log.id"; query << " GROUP BY session_log.id";
BOMB_IF(!_RingDB.query(query), "getScessionAverageScores : failed request in database", sessionAverageScores(from, false, 0,0,0,0,0, 0); return); BOMB_IF(!_RingDB.query(query), "getScessionAverageScores : failed request in database", sessionAverageScores(from, false, 0,0,0,0,0, 0); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
if (result->getNumRows() == 0) if (result->getNumRows() == 0)
{ {
@ -1178,7 +1178,7 @@ public:
query << " GROUP BY scenario.id"; query << " GROUP BY scenario.id";
BOMB_IF(!_RingDB.query(query), "getScenarioAverageScores : failed request in database", scenarioAverageScores(from, false, 0,0,0,0,0,0); return); BOMB_IF(!_RingDB.query(query), "getScenarioAverageScores : failed request in database", scenarioAverageScores(from, false, 0,0,0,0,0,0); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
if (result->getNumRows() == 0) if (result->getNumRows() == 0)
{ {
@ -1219,7 +1219,7 @@ public:
CSString query; CSString query;
query << "SELECT rrp_am, rrp_masterless, rrp_author FROM characters WHERE char_id = "<<charId; query << "SELECT rrp_am, rrp_masterless, rrp_author FROM characters WHERE char_id = "<<charId;
BOMB_IF(!_RingDB.query(query), "getRingRatings : failed request in database", ringRatings(from, charId, 0, 0, 0); return); BOMB_IF(!_RingDB.query(query), "getRingRatings : failed request in database", ringRatings(from, charId, 0, 0, 0); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
BOMB_IF (result->getNumRows() == 0, "getRingRatings : can't find char "<<charId<<" in the characters table", ringRatings(from, charId, 0, 0, 0); return); BOMB_IF (result->getNumRows() == 0, "getRingRatings : can't find char "<<charId<<" in the characters table", ringRatings(from, charId, 0, 0, 0); return);
result->fetchRow(); result->fetchRow();
@ -1240,7 +1240,7 @@ public:
CSString query; CSString query;
query << "SELECT ring_access FROM characters WHERE char_id = "<<charId; query << "SELECT ring_access FROM characters WHERE char_id = "<<charId;
BOMB_IF(!_RingDB.query(query), "on_getRingPoints: failed request in database", ringPoints(from, charId, "", MaxRingPoints); return); BOMB_IF(!_RingDB.query(query), "on_getRingPoints: failed request in database", ringPoints(from, charId, "", MaxRingPoints); return);
unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
BOMB_IF (result->getNumRows() == 0, "on_getRingPoints : can't find char "<<charId<<" in the characters table", ringPoints(from, charId, "", MaxRingPoints); return); BOMB_IF (result->getNumRows() == 0, "on_getRingPoints : can't find char "<<charId<<" in the characters table", ringPoints(from, charId, "", MaxRingPoints); return);
result->fetchRow(); result->fetchRow();

View file

@ -1307,7 +1307,7 @@ namespace CHARSYNC
query << " AND session_type = 'st_edit'"; query << " AND session_type = 'st_edit'";
if (_RingDB.query(query) ) if (_RingDB.query(query) )
{ {
std::unique_ptr<CStoreResult> result(_RingDB.storeResult()); CUniquePtr<CStoreResult> result(_RingDB.storeResult());
bool sessionClosed = false; bool sessionClosed = false;
if (!result->getNumRows() == 0) if (!result->getNumRows() == 0)
@ -1389,7 +1389,7 @@ namespace CHARSYNC
// return true; // return true;
// } // }
// //
// std::unique_ptr<CStoreResult> result(_RingDB.storeResult()); // CUniquePtr<CStoreResult> result(_RingDB.storeResult());
// //
// result->fetchRow(); // result->fetchRow();
// result->getField(0, dstUserId); // result->getField(0, dstUserId);

View file

@ -578,7 +578,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -638,7 +638,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -1230,7 +1230,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -1288,7 +1288,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -1992,7 +1992,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -2082,7 +2082,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -3940,7 +3940,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -4092,7 +4092,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -5435,7 +5435,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -6105,7 +6105,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -6155,7 +6155,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -6748,7 +6748,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -6808,7 +6808,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -7378,7 +7378,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -7965,7 +7965,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -8637,7 +8637,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -8687,7 +8687,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -9909,7 +9909,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
for (uint i=0; i<result->getNumRows(); ++i) for (uint i=0; i<result->getNumRows(); ++i)
{ {
@ -10453,7 +10453,7 @@ namespace RSMGR
return false; return false;
} }
std::unique_ptr<MSW::CStoreResult> result(connection.storeResult()); CUniquePtr<MSW::CStoreResult> result(connection.storeResult());
// check that the data description is consistent with database content // check that the data description is consistent with database content
nlassert(result->getNumRows() <= 1); nlassert(result->getNumRows() <= 1);

View file

@ -382,7 +382,7 @@ namespace LS
CSString query; CSString query;
query << "SELECT UId FROM user WHERE GMId = "<<userId<<""; query << "SELECT UId FROM user WHERE GMId = "<<userId<<"";
BOMB_IF(!_NelDb.query(query), "on_login : Failed to request in database", loginResult(from, userId, "", 6, "Failed request"); return); BOMB_IF(!_NelDb.query(query), "on_login : Failed to request in database", loginResult(from, userId, "", 6, "Failed request"); return);
unique_ptr<CStoreResult> result(_NelDb.storeResult()); CUniquePtr<CStoreResult> result(_NelDb.storeResult());
for (uint32 i=0; i!=result->getNumRows(); ++i) for (uint32 i=0; i!=result->getNumRows(); ++i)
{ {
result->fetchRow(); result->fetchRow();

View file

@ -207,7 +207,7 @@ namespace MFS
BOMB_IF(!_RingDb.query(query), ("Database error, no guild forum notification"), break;); BOMB_IF(!_RingDb.query(query), ("Database error, no guild forum notification"), break;);
unique_ptr<MSW::CStoreResult> result(_RingDb.storeResult()); CUniquePtr<MSW::CStoreResult> result(_RingDb.storeResult());
BOMB_IF(result->getNumRows() != 1, ("Database error, no guild forum notification"), break;); BOMB_IF(result->getNumRows() != 1, ("Database error, no guild forum notification"), break;);
@ -229,7 +229,7 @@ namespace MFS
string query = "SELECT COUNT(*) FROM mfs_mail WHERE date > '"+MSW::encodeDate(lastDisconnectionDate)+"' AND status = 'ms_new' AND erase_series = 0"; string query = "SELECT COUNT(*) FROM mfs_mail WHERE date > '"+MSW::encodeDate(lastDisconnectionDate)+"' AND status = 'ms_new' AND erase_series = 0";
BOMB_IF(!_RingDb.query(query), ("Database error, no mail notification"), return;); BOMB_IF(!_RingDb.query(query), ("Database error, no mail notification"), return;);
unique_ptr<MSW::CStoreResult> result(_RingDb.storeResult()); CUniquePtr<MSW::CStoreResult> result(_RingDb.storeResult());
BOMB_IF(result->getNumRows() != 1, ("Database error, no mail notification"), return;); BOMB_IF(result->getNumRows() != 1, ("Database error, no mail notification"), return;);

View file

@ -789,7 +789,7 @@ bool CNameManager::loadAccountNamesFromDatabase()
query << "SELECT user_id, user_name FROM ring_users"; query << "SELECT user_id, user_name FROM ring_users";
BOMB_IF(!_Database->query(query), "Failed to load account names from the database", return false); BOMB_IF(!_Database->query(query), "Failed to load account names from the database", return false);
unique_ptr<CUseResult> result(_Database->useResult()); CUniquePtr<CUseResult> result(_Database->useResult());
while (result->fetchRow()) while (result->fetchRow())
{ {
@ -986,7 +986,7 @@ bool CNameManager::loadCharacterNamesFromDatabase()
query << "SELECT char_id, char_name, home_mainland_session_id FROM characters"; query << "SELECT char_id, char_name, home_mainland_session_id FROM characters";
BOMB_IF(!_Database->query(query), "Failed to load character names from the database", return false); BOMB_IF(!_Database->query(query), "Failed to load character names from the database", return false);
unique_ptr<CUseResult> result(_Database->useResult()); CUniquePtr<CUseResult> result(_Database->useResult());
while (result->fetchRow()) while (result->fetchRow())
{ {

View file

@ -299,7 +299,7 @@ namespace RSMGR
list<TSessionId> sessionIds; list<TSessionId> sessionIds;
{ {
// scope the result to make it destroyed at scope end // scope the result to make it destroyed at scope end
unique_ptr<MSW::CUseResult> result(_RingDb.useResult()); CUniquePtr<MSW::CUseResult> result(_RingDb.useResult());
// for each open session, put it in the locked state // for each open session, put it in the locked state
while (result->fetchRow()) while (result->fetchRow())
@ -627,7 +627,7 @@ namespace RSMGR
// query << " AND ShardId = " << shardId; // query << " AND ShardId = " << shardId;
// //
// BOMB_IF(!_NelDb.query(query), "registerWS : Failed to request into the NeL database", return CNelShardPtr()); // BOMB_IF(!_NelDb.query(query), "registerWS : Failed to request into the NeL database", return CNelShardPtr());
// unique_ptr<CStoreResult> result(_NelDb.storeResult()); // CUniquePtr<CStoreResult> result(_NelDb.storeResult());
// BOMB_IF(result.get() == NULL, "registerWS : Failed to retrieve request result", return CNelShardPtr()); // BOMB_IF(result.get() == NULL, "registerWS : Failed to retrieve request result", return CNelShardPtr());
// //
// if (result->getNumRows() == 0) // if (result->getNumRows() == 0)
@ -656,7 +656,7 @@ namespace RSMGR
// joinSessionResult(from, charId>>4, 0, 12, "failed to request for access permission", TSessionPartStatus::invalid_val); // joinSessionResult(from, charId>>4, 0, 12, "failed to request for access permission", TSessionPartStatus::invalid_val);
return false; return false;
} }
unique_ptr<CStoreResult> result(_NelDb.storeResult()); CUniquePtr<CStoreResult> result(_NelDb.storeResult());
if (result->getNumRows() == 0) if (result->getNumRows() == 0)
{ {
return false; return false;
@ -1008,7 +1008,7 @@ restartLoop:
CSString query; CSString query;
query << "SELECT id FROM scenario WHERE md5 = '"<<scenarioInfo.getScenarioKey().toString()<<"'"; query << "SELECT id FROM scenario WHERE md5 = '"<<scenarioInfo.getScenarioKey().toString()<<"'";
BOMB_IF(!_RingDb.query(query), "Failed to request in ring database", return;); BOMB_IF(!_RingDb.query(query), "Failed to request in ring database", return;);
unique_ptr<CStoreResult> result(_RingDb.storeResult()); CUniquePtr<CStoreResult> result(_RingDb.storeResult());
if (result->getNumRows() != 0) if (result->getNumRows() != 0)
{ {
result->fetchRow(); result->fetchRow();
@ -1139,7 +1139,7 @@ restartLoop:
CSString query; CSString query;
query << "SELECT id FROM scenario WHERE md5 = '"<<scenarioInfo.getScenarioKey().toString()<<"'"; query << "SELECT id FROM scenario WHERE md5 = '"<<scenarioInfo.getScenarioKey().toString()<<"'";
BOMB_IF(!_RingDb.query(query), "Failed to request in ring database", return;); BOMB_IF(!_RingDb.query(query), "Failed to request in ring database", return;);
unique_ptr<CStoreResult> result(_RingDb.storeResult()); CUniquePtr<CStoreResult> result(_RingDb.storeResult());
if (result->getNumRows() != 0) if (result->getNumRows() != 0)
{ {
result->fetchRow(); result->fetchRow();
@ -1918,7 +1918,7 @@ endOfWelcomeUserResult:
CSString query; CSString query;
query << "SELECT COUNT(*) FROM sessions WHERE owner = "<<charId<<" AND state = '"<<TSessionState::toString(TSessionState::ss_open)<<"' AND session_type = '"<<session->getSessionType().toString()<<"'"; query << "SELECT COUNT(*) FROM sessions WHERE owner = "<<charId<<" AND state = '"<<TSessionState::toString(TSessionState::ss_open)<<"' AND session_type = '"<<session->getSessionType().toString()<<"'";
BOMB_IF(!_RingDb.query(query), "Failed to count number of edit session for character "<<charId, invokeResult(from, charId>>4, 5, "Database failure"); return); BOMB_IF(!_RingDb.query(query), "Failed to count number of edit session for character "<<charId, invokeResult(from, charId>>4, 5, "Database failure"); return);
unique_ptr<MSW::CStoreResult> result(_RingDb.storeResult()); CUniquePtr<MSW::CStoreResult> result(_RingDb.storeResult());
result->fetchRow(); result->fetchRow();
uint32 nbSession; uint32 nbSession;
@ -2114,7 +2114,7 @@ endOfWelcomeUserResult:
query << " AND session_type = 'st_edit'"; query << " AND session_type = 'st_edit'";
BOMB_IF(!_RingDb.query(query), "Error in database request", invokeResult(from, userId, 2, "Error in database request"); return); BOMB_IF(!_RingDb.query(query), "Error in database request", invokeResult(from, userId, 2, "Error in database request"); return);
unique_ptr<CStoreResult> result(_RingDb.storeResult()); CUniquePtr<CStoreResult> result(_RingDb.storeResult());
bool sessionClosed = false; bool sessionClosed = false;
if (result->getNumRows() == 0) if (result->getNumRows() == 0)
@ -2196,7 +2196,7 @@ endOfWelcomeUserResult:
query << "SELECT session_id FROM sessions"; query << "SELECT session_id FROM sessions";
query << " WHERE owner = "<<charId<<" AND session_type ='st_edit'"; query << " WHERE owner = "<<charId<<" AND session_type ='st_edit'";
BOMB_IF(!_RingDb.query(query), "on_hibernateEditSession : Failed to request in database", invokeResult(from, charId>>4, 1, "Database error"); return); BOMB_IF(!_RingDb.query(query), "on_hibernateEditSession : Failed to request in database", invokeResult(from, charId>>4, 1, "Database error"); return);
unique_ptr<CStoreResult> result(_RingDb.storeResult()); CUniquePtr<CStoreResult> result(_RingDb.storeResult());
// 1.1 : if no session so no need to hibernate (not an error) // 1.1 : if no session so no need to hibernate (not an error)
if (result->getNumRows() != 0) if (result->getNumRows() != 0)
@ -2243,7 +2243,7 @@ endOfWelcomeUserResult:
query << "SELECT session_id FROM sessions"; query << "SELECT session_id FROM sessions";
query << " WHERE owner = "<<charId<<" AND session_type ='st_anim'"; query << " WHERE owner = "<<charId<<" AND session_type ='st_anim'";
BOMB_IF(!_RingDb.query(query), "on_hibernateEditSession : Failed to request in database", invokeResult(from, charId>>4, 1, "Database error"); return); BOMB_IF(!_RingDb.query(query), "on_hibernateEditSession : Failed to request in database", invokeResult(from, charId>>4, 1, "Database error"); return);
unique_ptr<CStoreResult> result(_RingDb.storeResult()); CUniquePtr<CStoreResult> result(_RingDb.storeResult());
// 1.1 : if no session so no need to hibernate (not an error) // 1.1 : if no session so no need to hibernate (not an error)
if (result->getNumRows() > 1) if (result->getNumRows() > 1)
@ -3546,7 +3546,7 @@ endOfWelcomeUserResult:
query << "SELECT session_id FROM sessions"; query << "SELECT session_id FROM sessions";
query << " WHERE owner = "<<charId<<" AND session_type ='st_edit'"; query << " WHERE owner = "<<charId<<" AND session_type ='st_edit'";
BOMB_IF(!_RingDb.query(query), "on_joinEditSession : Failed to request in database", joinSessionResult(from, charId>>4, TSessionId(0), 11, "Database error", TSessionPartStatus::invalid_val); return); BOMB_IF(!_RingDb.query(query), "on_joinEditSession : Failed to request in database", joinSessionResult(from, charId>>4, TSessionId(0), 11, "Database error", TSessionPartStatus::invalid_val); return);
unique_ptr<CStoreResult> result(_RingDb.storeResult()); CUniquePtr<CStoreResult> result(_RingDb.storeResult());
// 1.1 : if no session found, return an error to the client // 1.1 : if no session found, return an error to the client
if (result->getNumRows() == 0) if (result->getNumRows() == 0)
@ -4387,7 +4387,7 @@ endOfWelcomeUserResult:
set<uint32> sessionToClose; set<uint32> sessionToClose;
unique_ptr<MSW::CUseResult> result = _RingDb.useResult(); CUniquePtr<MSW::CUseResult> result = _RingDb.useResult();
while (result->fetchRow()) while (result->fetchRow())
{ {

View file

@ -114,7 +114,7 @@ namespace RSMGR
list<uint32> sessionIds; list<uint32> sessionIds;
{ {
// scope the result to make it destroyed at scope end // scope the result to make it destroyed at scope end
unique_ptr<MSW::CUseResult> result(_RingDb.useResult()); CUniquePtr<MSW::CUseResult> result(_RingDb.useResult());
// for each open session, put it in the locked state // for each open session, put it in the locked state
while (result->fetchRow()) while (result->fetchRow())
@ -1313,7 +1313,7 @@ namespace RSMGR
set<uint32> sessionToClose; set<uint32> sessionToClose;
unique_ptr<MSW::CUseResult> result(_RingDb.useResult()); CUniquePtr<MSW::CUseResult> result(_RingDb.useResult());
while (result->fetchRow()) while (result->fetchRow())
{ {

View file

@ -741,7 +741,7 @@ public:
// _TalkToMenu.initPhrase(md, prim, temp); // _TalkToMenu.initPhrase(md, prim, temp);
_TalkToObjective = NULL; _TalkToObjective = NULL;
std::unique_ptr<CStepDynChatTalkTo> talkToObjective; // next calls could throw exceptions, so take care... CUniquePtr<CStepDynChatTalkTo> talkToObjective; // next calls could throw exceptions, so take care...
if (!temp.empty()) if (!temp.empty())
{ {
talkToObjective.reset(new CStepDynChatTalkTo(md, prim, "talk_to_")); talkToObjective.reset(new CStepDynChatTalkTo(md, prim, "talk_to_"));

View file

@ -66,7 +66,7 @@ struct CDupObjPolicy
dest.serialPtr(obj); dest.serialPtr(obj);
/*if (dest.isReading()) /*if (dest.isReading())
{ {
std::unique_ptr<T> newObj(new T); CUniquePtr<T> newObj(new T);
newObj->serialPtr(dest); newObj->serialPtr(dest);
delete obj; delete obj;
obj = newObj.release(); obj = newObj.release();
@ -111,7 +111,7 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in)
/** Duplicate the system, and detach. /** Duplicate the system, and detach.
* We can't duplicate the object direclty (it may be referencing other objects in the system, so these objects will be copied too...) * We can't duplicate the object direclty (it may be referencing other objects in the system, so these objects will be copied too...)
*/ */
std::unique_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(in->getOwner())); CUniquePtr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(in->getOwner()));
// scene pointer is not serialised, but 'detach' may need the scene to be specified // scene pointer is not serialised, but 'detach' may need the scene to be specified
newPS->setScene(in->getOwner()->getScene()); newPS->setScene(in->getOwner()->getScene());
return newPS->detach(index); return newPS->detach(index);
@ -141,7 +141,7 @@ NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in)
else else
{ {
CParticleSystem *srcPS = in->getOwner()->getOwner(); CParticleSystem *srcPS = in->getOwner()->getOwner();
std::unique_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(srcPS)); CUniquePtr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(srcPS));
// scene pointer is not serialised, but 'detach' may need the scene to be specified // scene pointer is not serialised, but 'detach' may need the scene to be specified
newPS->setScene(in->getOwner()->getOwner()->getScene()); newPS->setScene(in->getOwner()->getOwner()->getScene());
// //

View file

@ -105,7 +105,7 @@ NL3D::CParticleSystemModel *CParticleEditor::getModelFromPS(NL3D::CParticleSyste
void CParticleEditor::loadWorkspace(const std::string &fullPath) void CParticleEditor::loadWorkspace(const std::string &fullPath)
{ {
// Add to the path // Add to the path
std::unique_ptr<CParticleWorkspace> newPW(new CParticleWorkspace); CUniquePtr<CParticleWorkspace> newPW(new CParticleWorkspace);
newPW->init(fullPath); newPW->init(fullPath);
// save empty workspace // save empty workspace

View file

@ -193,7 +193,7 @@ void CWorkspaceNode::createEmptyPS()
NL3D::CParticleSystem emptyPS; NL3D::CParticleSystem emptyPS;
NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape; NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape;
pss->buildFromPS(emptyPS); pss->buildFromPS(emptyPS);
std::unique_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank); CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath);
sb->add(shapeName, pss); sb->add(shapeName, pss);
NL3D::CShapeBank *oldSB = Modules::psEdit().getScene()->getShapeBank(); NL3D::CShapeBank *oldSB = Modules::psEdit().getScene()->getShapeBank();
@ -272,7 +272,7 @@ bool CWorkspaceNode::loadPS() throw(NLMISC::EStream)
// collapse name // collapse name
inputFile.open(getFullPath()); inputFile.open(getFullPath());
ss.serial(inputFile); ss.serial(inputFile);
std::unique_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank); CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
std::string shapeName = NLMISC::CFile::getFilename(_RelativePath); std::string shapeName = NLMISC::CFile::getFilename(_RelativePath);
sb->add(shapeName, ss.getShapePointer()); sb->add(shapeName, ss.getShapePointer());
NL3D::CShapeBank *oldSB = Modules::psEdit().getScene()->getShapeBank(); NL3D::CShapeBank *oldSB = Modules::psEdit().getScene()->getShapeBank();

View file

@ -123,8 +123,8 @@ private:
QAction *_lod2Action; QAction *_lod2Action;
QAction *_externIDAction; QAction *_externIDAction;
std::unique_ptr<NL3D::CPSLocated> _LocatedCopy; CUniquePtr<NL3D::CPSLocated> _LocatedCopy;
std::unique_ptr<NL3D::CPSLocatedBindable> _LocatedBindableCopy; CUniquePtr<NL3D::CPSLocatedBindable> _LocatedBindableCopy;
CParticleTreeItem *_currentItem; CParticleTreeItem *_currentItem;