Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-12-10 19:52:43 +01:00
commit f085121937
198 changed files with 1225 additions and 1963 deletions

View file

@ -255,8 +255,19 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION "6.0A")
ENDIF()
ELSEIF(MSVC80)
IF(NOT MSVC_EXPRESS)
# TODO: fix this version
SET(WINSDK_MSVC80_COMPATIBLES "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A" "5.2A")
# look for each Windows SDK supported by VC++ 2005 (7.1 is the latest)
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
# look if this version of Windows SDK is installed
LIST(FIND WINSDK_MSVC80_COMPATIBLES ${_VERSION} _FOUND)
IF(NOT _FOUND EQUAL -1)
SET(WINSDK_VERSION "${_VERSION}")
BREAK()
ENDIF()
ENDFOREACH()
IF(NOT MSVC_EXPRESS AND NOT WINSDK_VERSION)
SET(WINSDK_VERSION "5.2A")
ENDIF()
ELSE()
@ -441,8 +452,8 @@ IF(WINSDK_INCLUDE_DIR)
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
# Fix for using Windows SDK 7.1 with Visual C++ 2012
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
# Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013 and 2015
IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14))
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
ENDIF()
ELSE()

View file

@ -888,7 +888,11 @@ MACRO(NL_SETUP_BUILD)
ENDIF()
# never display these warnings because they are minor
ADD_PLATFORM_FLAGS("-Wno-unused-parameter -Wno-unused-private-field -Wno-unused-local-typedef -Wno-unused-variable")
ADD_PLATFORM_FLAGS("-Wno-unused-parameter -Wno-unused-variable -Wunused-function -Wunused-value")
IF(CLANG)
ADD_PLATFORM_FLAGS("-Wno-unused-private-field -Wno-unused-local-typedef")
ENDIF()
IF(ANDROID)
ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}")

View file

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

View file

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

View file

@ -282,7 +282,7 @@ inline float CPSAttribMakerBinOp<float>::getMaxValue(void) const
template <class T>
inline CPSAttribMakerBinOp<T>::CPSAttribMakerBinOp(const CPSAttribMakerBinOp &other) : CPSAttribMaker<T>(other) // parent copy ctor
{
std::auto_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()));
this->_Op = other._Op;
this->_Size = other._Size;

View file

@ -1463,7 +1463,7 @@ public:
CPSAttribMakerMemoryBase(const CPSAttribMakerMemoryBase &src) : CPSAttribMaker<T>(src) // parent copy ctor
{
nlassert(src._Scheme);
std::auto_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->_DefaultValue = src._DefaultValue;
this->_Scheme = s.release();

View file

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

View file

@ -107,7 +107,7 @@ public:
const CPrimitiveClass *getPrimitiveClass (const NLLIGO::IPrimitive &primitive) const;
// Get a primitive class
const CPrimitiveClass *getPrimitiveClass (const char *className) const;
const CPrimitiveClass *getPrimitiveClass (const std::string &className) const;
// Get the primitive color
NLMISC::CRGBA getPrimitiveColor (const NLLIGO::IPrimitive &primitive);
@ -134,10 +134,10 @@ public:
bool canBeRoot (const NLLIGO::IPrimitive &primitive);
// Read a property from an XML file
bool getPropertyString (std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName);
bool getPropertyString (std::string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &propName);
// Output error message
void syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format, ...);
void syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...);
virtual void errorMessage (const char *format, ... );
// Access to the config string
@ -157,7 +157,7 @@ public:
private:
// Init primitive class manager
bool initPrimitiveClass (const char *filename);
bool initPrimitiveClass (const std::string &ilename);
// The primitive class manager
std::map<std::string, CPrimitiveClass> _PrimitiveClasses;

View file

@ -83,9 +83,8 @@ class CPropertyString : public IProperty
{
public:
CPropertyString () {}
CPropertyString (const char *str);
CPropertyString (const std::string &str);
CPropertyString (const char *str, bool _default);
CPropertyString (const std::string &str, bool _default);
virtual ~CPropertyString () {}
std::string String;
@ -287,42 +286,42 @@ public:
* If the property already exist, the method does nothing and returns false.
* The pointer will be deleted by the primitive using the ::delete operator.
**/
bool addPropertyByName (const char *property_name, IProperty *result);
bool addPropertyByName (const std::string &property_name, IProperty *result);
/**
* Get a property with its name
**/
bool getPropertyByName (const char *property_name, const IProperty *&result) const;
bool getPropertyByName (const std::string &property_name, const IProperty *&result) const;
/**
* Get a property with its name
**/
bool getPropertyByName (const char *property_name, IProperty *&result) const;
bool getPropertyByName (const std::string &property_name, IProperty *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const char *property_name, std::string *&result) const;
bool getPropertyByName (const std::string &property_name, std::string *&result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, std::vector<std::string> *&result) const;
bool getPropertyByName (const std::string &property_name, std::vector<std::string> *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const char *property_name, std::string &result) const;
bool getPropertyByName (const std::string &property_name, std::string &result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const;
bool getPropertyByName (const std::string &property_name, const std::vector<std::string> *&result) const;
/**
* Get a color property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const;
bool getPropertyByName (const std::string &property_name, NLMISC::CRGBA &result) const;
/**
* Remove a property
@ -333,7 +332,7 @@ public:
/**
* Remove a property by its name
**/
bool removePropertyByName (const char *property_name);
bool removePropertyByName (const std::string &property_name);
/**
* Remove all the properties
@ -347,10 +346,10 @@ public:
void initDefaultValues (CLigoConfig &config);
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
virtual bool read (xmlNodePtr xmlNode, const std::string &property_name, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
virtual void write (xmlNodePtr xmlNode, const std::string &property_name) const;
// Get the vertices
virtual uint getNumVector () const = 0;
@ -435,7 +434,7 @@ protected:
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// \name From IPrimitive
virtual IPrimitive *copy () const;
@ -474,10 +473,10 @@ protected:
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
@ -509,10 +508,10 @@ protected:
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
@ -568,10 +567,10 @@ protected:
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
@ -632,9 +631,9 @@ public:
uint32 getFullAlias() const;
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// Create a copy of this primitive
virtual IPrimitive *copy () const;
// serial for binary save
@ -686,13 +685,13 @@ public:
void convert (const CPrimRegion &region);
// Read the primitive
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config);
bool read (xmlNodePtr xmlNode, const std::string &filename, CLigoConfig &config);
// Write the primitive
void write (xmlDocPtr xmlNode, const char *filename) const;
void write (xmlDocPtr xmlNode, const std::string &filename) const;
// Write the primitive
void write (xmlNodePtr root, const char *filename) const;
void write (xmlNodePtr root, const std::string &filename) const;
// serial the primitive. Used for binary files.
void serial(NLMISC::IStream &f);

View file

@ -108,6 +108,7 @@ namespace NLMISC
{
public:
CApplicationContext();
virtual ~CApplicationContext();
virtual void *getSingletonPointer(const std::string &singletonName);
virtual void setSingletonPointer(const std::string &singletonName, void *ptr);

View file

@ -201,7 +201,9 @@ namespace NLMISC
*/
void sleep(uint milliseconds);
/** Release internal instance.
*/
static void releaseInstance();
};

View file

@ -120,11 +120,11 @@ public:
/** Get the first child node pointer named childName. NULL if no node named childName.
*/
static xmlNodePtr getFirstChildNode (xmlNodePtr parent, const char *childName);
static xmlNodePtr getFirstChildNode (xmlNodePtr parent, const std::string &childName);
/** Get the next child node pointer name childName, brother of previous. NULL if no node named childName.
*/
static xmlNodePtr getNextChildNode (xmlNodePtr last, const char *childName);
static xmlNodePtr getNextChildNode (xmlNodePtr last, const std::string &childName);
/** Get the first child node pointer of type. NULL if no node of type.
*/
@ -136,7 +136,7 @@ public:
/** Count number of sub node named with a given name for a given node.
*/
static uint countChildren (xmlNodePtr node, const char *childName);
static uint countChildren (xmlNodePtr node, const std::string &childName);
/** Count number of sub node of type for a given node.
*/
@ -147,22 +147,22 @@ public:
*
* Returns true and the result if the property has been found, else false.
*/
static bool getPropertyString (std::string &result, xmlNodePtr node, const char *property);
static bool getPropertyString (std::string &result, xmlNodePtr node, const std::string &property);
/**
* Read an integer property - if the property is not found the default value is returned
*/
static int getIntProperty(xmlNodePtr node, const char *property, int defaultValue);
static int getIntProperty(xmlNodePtr node, const std::string &property, int defaultValue);
/**
* Read a floating point property - if the property is not found the default value is returned
*/
static double getFloatProperty(xmlNodePtr node, const char *property, float defaultValue);
static double getFloatProperty(xmlNodePtr node, const std::string &property, float defaultValue);
/**
* Read a string property - if the property is not found the default value is returned
*/
static std::string getStringProperty(xmlNodePtr node, const char *property, const std::string& defaultValue);
static std::string getStringProperty(xmlNodePtr node, const std::string &property, const std::string& defaultValue);
/**
* Read the content of the node as a string
@ -198,12 +198,12 @@ private:
virtual void serialBuffer(uint8 *buf, uint len);
virtual void serialBit(bool &bit);
virtual bool xmlPushBeginInternal (const char *nodeName);
virtual bool xmlPushBeginInternal (const std::string &nodeName);
virtual bool xmlPushEndInternal ();
virtual bool xmlPopInternal ();
virtual bool xmlSetAttribInternal (const char *attribName);
virtual bool xmlSetAttribInternal (const std::string &attribName);
virtual bool xmlBreakLineInternal ();
virtual bool xmlCommentInternal (const char *comment);
virtual bool xmlCommentInternal (const std::string &comment);
// Internal functions
void serialSeparatedBufferIn ( std::string &value, bool checkSeparator = true );

View file

@ -95,7 +95,7 @@ public:
* \param version is the version to write in the XML header. Default is 1.0.
* \return true if initialisation is successful, false if the stream passed is not an output stream.
*/
bool init (IStream *stream, const char *version="1.0");
bool init (IStream *stream, const std::string &version = "1.0");
/** Return the error string.
* if not empty, something wrong appends
@ -120,7 +120,7 @@ public:
/** Return true if the string is valid to be stored in a XML property without modification.
*/
static bool isStringValidForProperties (const char *str);
static bool isStringValidForProperties (const std::string &str);
private:
@ -144,15 +144,15 @@ private:
virtual void serialBuffer(uint8 *buf, uint len);
virtual void serialBit(bool &bit);
virtual bool xmlPushBeginInternal (const char *nodeName);
virtual bool xmlPushBeginInternal (const std::string &nodeName);
virtual bool xmlPushEndInternal ();
virtual bool xmlPopInternal ();
virtual bool xmlSetAttribInternal (const char *attribName);
virtual bool xmlSetAttribInternal (const std::string &attribName);
virtual bool xmlBreakLineInternal ();
virtual bool xmlCommentInternal (const char *comment);
virtual bool xmlCommentInternal (const std::string &comment);
// Internal functions
void serialSeparatedBufferOut( const char *value );
void serialSeparatedBufferOut( const std::string &value );
inline void flushContentString ();
// Push mode

View file

@ -83,8 +83,10 @@ private:
# define NL_USES_DEFAULT_ARENA_OBJECT_ALLOCATOR \
void *operator new(size_t size) { return NLMISC::CObjectArenaAllocator::getDefaultAllocator().alloc((uint) size); }\
void *operator new(size_t size, int _BlockUse, char const* _FileName, int _LineNumber) { return NLMISC::CObjectArenaAllocator::getDefaultAllocator().alloc((uint) size); }\
void *operator new(size_t size, char const* _FileName, int _LineNumber) { return NLMISC::CObjectArenaAllocator::getDefaultAllocator().alloc((uint) size); }\
void operator delete(void *block) { NLMISC::CObjectArenaAllocator::getDefaultAllocator().freeBlock(block); }\
void operator delete(void *block, int _BlockUse, char const* _FileName, int _LineNumber) { NLMISC::CObjectArenaAllocator::getDefaultAllocator().freeBlock(block); }
void operator delete(void *block, int _BlockUse, char const* _FileName, int _LineNumber) { NLMISC::CObjectArenaAllocator::getDefaultAllocator().freeBlock(block); } \
void operator delete(void *block, char const* _FileName, int _LineNumber) { NLMISC::CObjectArenaAllocator::getDefaultAllocator().freeBlock(block); }
}

View file

@ -209,7 +209,7 @@ public:
* \param relativePath is the path to make relative to basePath.
* return true if relativePath as been done relative to basePath, false is relativePath has not been changed.
*/
bool makePathRelative (const char *basePath, std::string &relativePath);
bool makePathRelative (const std::string &basePath, std::string &relativePath);
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
*/
@ -505,7 +505,7 @@ public:
* \param relativePath is the path to make relative to basePath.
* return true if relativePath as been done relative to basePath, false is relativePath has not been changed.
*/
static bool makePathRelative (const char *basePath, std::string &relativePath);
static bool makePathRelative(const std::string &basePath, std::string &relativePath);
/** Make path absolute
* \param relativePath - The relative path

View file

@ -108,7 +108,7 @@ template <class TPtr, class TKey, class TResourceFinder>
class CResourcePtr
{
private:
CRefCount::CPtrInfo *pinfo; // A ptr to the handle of the object.
CRefCount::CPtrInfoBase *pinfo; // A ptr to the handle of the object.
TKey Key; // The key used to find the pointer
mutable TPtr *Ptr; // A cache for pinfo->Ptr. Useful to speed up ope->() and ope*()

View file

@ -61,7 +61,7 @@ template <class TPtr, class TKey, class TResourceFinder> SMART_INLINE void CReso
if(pinfo->Ptr)
{
// Inform the Object that no more CResourcePtr points on it.
((TPtr*)(pinfo->Ptr))->pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
((TPtr*)(pinfo->Ptr))->pinfo = &CRefCount::NullPtrInfo;
}
// Then delete the pinfo.
delete pinfo;
@ -74,7 +74,7 @@ template <class TPtr, class TKey, class TResourceFinder> SMART_INLINE void CReso
// Cons - dest.
template <class TPtr, class TKey, class TResourceFinder> inline CResourcePtr<TPtr, TKey, TResourceFinder>::CResourcePtr()
{
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
REF_TRACE("Smart()");
@ -95,7 +95,7 @@ template <class TPtr, class TKey, class TResourceFinder> inline CResourcePtr<TPt
pinfo->RefCount++;
}
else
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
REF_TRACE("Smart(TPtr*)");
}
@ -117,7 +117,7 @@ template <class TPtr, class TKey, class TResourceFinder> inline CResourcePtr<TPt
REF_TRACE("~Smart()");
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
}
@ -142,7 +142,7 @@ template <class TPtr, class TKey, class TResourceFinder> CResourcePtr<TPtr, TKey
else
{
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
}
@ -179,7 +179,7 @@ template <class TPtr, class TKey, class TResourceFinder> void CResourcePtr<T>::k
// First, release the refptr.
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
// Then delete the pointer.
@ -196,7 +196,7 @@ template <class TPtr, class TKey, class TResourceFinder> inline CResourcePtr<TPt
// Refresh the Ptr.
Ptr= (TPtr*)pinfo->Ptr;
if (pinfo != static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo))
if (pinfo != &CRefCount::NullPtrInfo)
{
// Does the pointer has been deleted ?
if (Ptr == NULL)
@ -310,7 +310,7 @@ template <class TPtr, class TKey, class TResourceFinder> void CStaticResourcePtr
// First, release the refptr.
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
// Then delete the pointer.

View file

@ -43,7 +43,7 @@ public:
/// Destructor which release pinfo if necessary.
~CRefCount();
/// Default constructor init crefs to 0.
CRefCount() { crefs = 0; pinfo=static_cast<CPtrInfo*>(&NullPtrInfo); }
CRefCount() { crefs = 0; pinfo = &NullPtrInfo; }
/* The instance handle.
Can't put those to private since must be used by CRefPtr (and friend doesn't work with template).
@ -56,6 +56,7 @@ public:
sint RefCount; // RefCount of ptrinfo (!= instance)
bool IsNullPtrInfo; // For dll problems, must use a flag to mark NullPtrInfo.
};
struct CPtrInfo : public CPtrInfoBase
{
CPtrInfo(CRefCount const* p) {Ptr=p; RefCount=0; IsNullPtrInfo=false;}
@ -75,13 +76,13 @@ public:
// Can't put this to private since must be used by CSmartPtr (and friend doesn't work with template).
// Provide incref()/decref() function doen't work since decref() can't do a delete this on a non virtual dtor.
// So Ptr gestion can only be used via CSmartPtr.
mutable sint crefs; // The ref counter for SmartPtr use.
mutable CPtrInfo *pinfo; // The ref ptr for RefPtr use.
mutable sint crefs; // The ref counter for SmartPtr use.
mutable CPtrInfoBase *pinfo; // The ref ptr for RefPtr use.
/// operator= must NOT copy crefs/pinfo!!
CRefCount &operator=(const CRefCount &) {return *this;}
/// copy cons must NOT copy crefs/pinfo!!
CRefCount(const CRefCount &) {crefs = 0; pinfo=static_cast<CPtrInfo*>(&NullPtrInfo);}
CRefCount(const CRefCount &) { crefs = 0; pinfo = &NullPtrInfo; }
};
// To use CVirtualRefPtr (or if you just want to have a RefCount with virtual destructor), derive from this class.
@ -99,7 +100,7 @@ public:
#define SMART_TRACE(_s) ((void)0)
#define REF_TRACE(_s) ((void)0)
//#define SMART_TRACE(_s) printf("%s: %d \n", _s, Ptr?Ptr->crefs:0)
//#define REF_TRACE(_s) printf("%s: %d \n", _s, pinfo!=&CRefCount::NullPtrInfo?pinfo->RefCount:0)
//#define REF_TRACE(_s) printf("%s: %d \n", _s, pinfo != &CRefCount::NullPtrInfo?pinfo->RefCount:0)
/**
@ -294,7 +295,8 @@ template <class T>
class CRefPtr
{
private:
CRefCount::CPtrInfo *pinfo; // A ptr to the handle of the object.
CRefCount::CPtrInfoBase *pinfo; // A ptr to the handle of the object.
mutable T *Ptr; // A cache for pinfo->Ptr. Useful to speed up ope->() and ope*()
void unRef() const; // Just release the handle pinfo, but do not update pinfo/Ptr, if deleted.
@ -380,7 +382,7 @@ template <class T>
class CVirtualRefPtr
{
private:
CRefCount::CPtrInfo *pinfo; // A ptr to the handle of the object.
CRefCount::CPtrInfoBase *pinfo; // A ptr to the handle of the object.
mutable T *Ptr; // A cache for pinfo->Ptr. Useful to speed up ope->() and ope*()
void unRef() const; // Just release the handle pinfo, but do not update pinfo/Ptr, if deleted.

View file

@ -134,7 +134,7 @@ SMART_INLINE void CRefPtr<T>::unRef() const
if(pinfo->Ptr)
{
// Inform the Object that no more CRefPtr points on it.
pinfo->Ptr->pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo->Ptr->pinfo = &CRefCount::NullPtrInfo;
}
// Then delete the pinfo.
delete pinfo;
@ -148,7 +148,7 @@ SMART_INLINE void CRefPtr<T>::unRef() const
// Cons - dest.
template <class T> inline CRefPtr<T>::CRefPtr()
{
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
REF_TRACE("Smart()");
@ -170,7 +170,7 @@ template <class T> inline CRefPtr<T>::CRefPtr(T *v)
#endif
}
else
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
REF_TRACE("Smart(T*)");
}
@ -187,7 +187,7 @@ template <class T> inline CRefPtr<T>::~CRefPtr(void)
REF_TRACE("~Smart()");
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
}
@ -216,7 +216,7 @@ template <class T> CRefPtr<T> &CRefPtr<T>::operator=(T *v)
else
{
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
}
@ -250,7 +250,7 @@ template <class T> void CRefPtr<T>::kill()
// First, release the refptr.
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
// Then delete the pointer.
@ -316,7 +316,7 @@ SMART_INLINE void CVirtualRefPtr<T>::unRef() const
if(pinfo->Ptr)
{
// Inform the Object that no more CVirtualRefPtr points on it.
pinfo->Ptr->pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo->Ptr->pinfo = &CRefCount::NullPtrInfo;
}
// Then delete the pinfo.
delete pinfo;
@ -330,7 +330,7 @@ SMART_INLINE void CVirtualRefPtr<T>::unRef() const
// Cons - dest.
template <class T> inline CVirtualRefPtr<T>::CVirtualRefPtr()
{
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
REF_TRACE("Smart()");
@ -352,7 +352,7 @@ template <class T> inline CVirtualRefPtr<T>::CVirtualRefPtr(T *v)
#endif
}
else
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
REF_TRACE("Smart(T*)");
}
@ -370,7 +370,7 @@ template <class T> inline CVirtualRefPtr<T>::~CVirtualRefPtr(void)
REF_TRACE("~Smart()");
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
}
@ -399,7 +399,7 @@ template <class T> CVirtualRefPtr<T> &CVirtualRefPtr<T>::operator=(T *v)
else
{
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
}
@ -435,7 +435,7 @@ template <class T> void CVirtualRefPtr<T>::kill()
// First, release the refptr.
unRef();
pinfo= static_cast<CRefCount::CPtrInfo*>(&CRefCount::NullPtrInfo);
pinfo = &CRefCount::NullPtrInfo;
Ptr= NULL;
// Then delete the pointer.

View file

@ -724,7 +724,7 @@ public:
* xmlSerial() serial a values into a node.
*/
template<class T>
void xmlSerial (T& value0, const char *nodeName)
void xmlSerial (T& value0, const std::string &nodeName)
{
// Open the node
xmlPush (nodeName);
@ -736,7 +736,7 @@ public:
xmlPop ();
}
template<class T>
void xmlSerial (T& value0, T& value1, const char *nodeName)
void xmlSerial (T& value0, T& value1, const std::string &nodeName)
{
// Open the node
xmlPush (nodeName);
@ -748,7 +748,7 @@ public:
xmlPop ();
}
template<class T>
void xmlSerial (T& value0, T& value1, T& value2, const char *nodeName)
void xmlSerial (T& value0, T& value1, T& value2, const std::string &nodeName)
{
// Open the node
xmlPush (nodeName);
@ -760,7 +760,7 @@ public:
xmlPop ();
}
template<class T>
void xmlSerial (T& value0, T& value1, T& value2, T& value3, const char *nodeName)
void xmlSerial (T& value0, T& value1, T& value2, T& value3, const std::string &nodeName)
{
// Open the node
xmlPush (nodeName);
@ -778,7 +778,7 @@ public:
* \name is the name of the node to open
* \return true if you can open the node, false if the stream is between a xmlPushBegin() and a xmlPushEnd() call.
*/
bool xmlPush (const char *name)
bool xmlPush (const std::string &name)
{
// XML Mode ?
if (_XML)
@ -802,7 +802,7 @@ public:
* \name is the name of the node to open
* \return true if you can open the node header, false if the stream is between a xmlPushBegin() and a xmlPushEnd() call.
*/
bool xmlPushBegin (const char *name)
bool xmlPushBegin (const std::string &name)
{
// XML Mode ?
if (_XML)
@ -854,7 +854,7 @@ public:
* \param name is the name of the node header attribute serialised.
* \return true if the attribute name have been set, false if the node header is not open (the call is not between xmlPushBegin and xmlPushEnd)
*/
bool xmlSetAttrib (const char *name)
bool xmlSetAttrib (const std::string &name)
{
// XML Mode ?
if (_XML)
@ -888,7 +888,7 @@ public:
*
* \return true if the comment is added, return false if no node is opened.
*/
bool xmlComment (const char *comment)
bool xmlComment (const std::string &comment)
{
// XML Mode ?
if (_XML)
@ -910,7 +910,7 @@ protected:
void setXMLMode (bool on);
/// xmlPushBegin implementation
virtual bool xmlPushBeginInternal (const char * /* name */) { return true; };
virtual bool xmlPushBeginInternal (const std::string &/* name */) { return true; };
/// xmlPushEnd implementation
virtual bool xmlPushEndInternal () { return true; };
@ -919,13 +919,13 @@ protected:
virtual bool xmlPopInternal () { return true; };
/// xmlBreakLine implementation
virtual bool xmlSetAttribInternal (const char * /* name */) { return true; };
virtual bool xmlSetAttribInternal (const std::string &/* name */) { return true; };
/// xmlBreakLine implementation
virtual bool xmlBreakLineInternal () { return true; };
/// xmlComment implementation
virtual bool xmlCommentInternal (const char * /* comment */) { return true; };
virtual bool xmlCommentInternal (const std::string &/* comment */) { return true; };
/**
* for Deriver: reset the PtrTable in the stream.

View file

@ -162,7 +162,7 @@
# define NL_COMP_GCC
#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
#endif
@ -430,30 +430,40 @@ extern void operator delete[](void *p) throw();
# define CHashSet ::std::hash_set
# define CHashMultiMap ::std::hash_multimap
# 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)
# include NL_ISO_STDTR1_HEADER(unordered_map)
# include NL_ISO_STDTR1_HEADER(unordered_set)
# define CHashMap NL_ISO_STDTR1_NAMESPACE::unordered_map
# define CHashSet NL_ISO_STDTR1_NAMESPACE::unordered_set
# 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
# include <hash_map>
# include <hash_set>
# define CHashMap stdext::hash_map
# define CHashSet stdext::hash_set
# define CHashMultiMap stdext::hash_multimap
#elif 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::auto_ptr
# define CUniquePtrMove
#elif defined(NL_COMP_GCC) // GCC4
# include <ext/hash_map>
# include <ext/hash_set>
# define CHashMap ::__gnu_cxx::hash_map
# define CHashSet ::__gnu_cxx::hash_set
# define CHashMultiMap ::__gnu_cxx::hash_multimap
# define CUniquePtr ::std::auto_ptr
# define CUniquePtrMove
namespace __gnu_cxx {

View file

@ -1,27 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/anim_ctrl.h"
namespace NL3D
{
} // NL3D

View file

@ -19,6 +19,9 @@
#include "nel/3d/animatable.h"
#include "nel/3d/channel_mixer.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D
{

View file

@ -22,6 +22,10 @@
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D
{

View file

@ -21,6 +21,10 @@
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D
{

View file

@ -21,6 +21,10 @@
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D
{

View file

@ -1,36 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/animated_value.h"
namespace NL3D
{
/*
// Some compilation check: force Visual to compile to template
CAnimatedValueBool atoto1;
CAnimatedValueInt atoto2;
CAnimatedValueFloat atoto3;
CAnimatedValueVector atoto4;
CAnimatedValueString atoto5;
CAnimatedValueQuat atoto6;
CAnimatedValueRGBA atoto7;
*/
} // NL3D

View file

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

View file

@ -22,6 +22,10 @@
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D
{

View file

@ -29,6 +29,10 @@
using namespace std;
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D
{
@ -221,7 +225,7 @@ bool CAnimationSet::loadFromFiles(const std::string &path, bool recurse /* = tru
{
NLMISC::CIFile iFile;
iFile.open(anims[k]);
std::auto_ptr<CAnimation> anim(new CAnimation);
CUniquePtr<CAnimation> anim(new CAnimation);
anim->serial(iFile);
addAnimation(NLMISC::CFile::getFilenameWithoutExtension(anims[k]).c_str(), anim.release());
iFile.close();

View file

@ -1,26 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/animation_time.h"
namespace NL3D {
} // NL3D

View file

@ -31,6 +31,9 @@
using namespace std;
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NL3D
{

View file

@ -1,27 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/async_texture_block.h"
namespace NL3D
{
} // NL3D

View file

@ -1,25 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/cube_grid.h"
namespace NL3D
{
} // NL3D

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 /* = "" */)
{
std::auto_ptr<CTextureCube> cubeMap(new CTextureCube);
std::auto_ptr<CTextureMem> faces[6];
CUniquePtr<CTextureCube> cubeMap(new CTextureCube);
CUniquePtr<CTextureMem> faces[6];
/// this gives the start (unormalized normal for each face for u,v = 0, 0)
static const NLMISC::CVector start[] =

View file

@ -477,18 +477,18 @@ bool CDriverGL::unInit()
// Restore monitor color parameters
if (_NeedToRestoreGammaRamp)
{
HDC dc = CreateDCA ("DISPLAY", NULL, NULL, NULL);
HDC dc = CreateDCA("DISPLAY", NULL, NULL, NULL);
if (dc)
{
if (!SetDeviceGammaRamp (dc, _GammaRampBackuped))
nlwarning ("(CDriverGL::release): SetDeviceGammaRamp failed");
if (!SetDeviceGammaRamp(dc, _GammaRampBackuped))
nlwarning("(CDriverGL::release): SetDeviceGammaRamp failed");
// Release the DC
ReleaseDC (NULL, dc);
ReleaseDC(NULL, dc);
}
else
{
nlwarning ("(CDriverGL::release): can't create DC");
nlwarning("(CDriverGL::release): can't create DC");
}
}

View file

@ -105,9 +105,9 @@ CMaterial &CMaterial::operator=(const CMaterial &mat)
// copy texture matrix if there.
if (mat._TexUserMat.get())
{
std::auto_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
_TexUserMat = texMatClone;
_TexUserMat = CUniquePtrMove(texMatClone);
}
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 ?
{
std::auto_ptr<CUserTexMat> newPtr(new CUserTexMat); // create new
CUniquePtr<CUserTexMat> newPtr(new CUserTexMat); // create new
//std::swap(_TexUserMat, newPtr); // replace old
_TexUserMat = newPtr;
_TexUserMat = CUniquePtrMove(newPtr);
}
}

View file

@ -1,26 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/matrix_3x4.h"
namespace NL3D
{
} // NL3D

View file

@ -1,26 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/mesh_vertex_program.h"
namespace NL3D
{
} // NL3D

View file

@ -1,26 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/mrm_parameters.h"
namespace NL3D
{
} // NL3D

View file

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

View file

@ -1,25 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/ps_particle.h"
namespace NL3D
{
/// NOTE : implementation of particles rendering has now been split accross vrious files...
} // NL3D

View file

@ -1,24 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/ps_particle2.h"
namespace NL3D
{
} // NL3D

View file

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

View file

@ -1,27 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/ptr_set.h"
namespace NL3D
{
} // NL3D

View file

@ -1,41 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/radix_sort.h"
namespace NL3D {
// To test compiling.
/*struct Pipo
{
uint32 a;
uint32 getRadixKey() const {return a;}
};
CRadixSort<Pipo> PipoSort;
static void pipo()
{
PipoSort.sort(NULL, NULL, 30);
}*/
} // NL3D

View file

@ -1,27 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/scissor.h"
namespace NL3D
{
} // NL3D

View file

@ -1,27 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/static_quad_grid.h"
namespace NL3D
{
} // NL3D

View file

@ -1,27 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/tess_list.h"
namespace NL3D
{
} // NL3D

View file

@ -1,25 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/texture_bloom.h"
namespace NL3D {
} // NL3D

View file

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

View file

@ -1,31 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/texture_user.h"
namespace NL3D
{
void dummyToAvoidStupidCompilerWarning_texture_user_cpp()
{
}
} // NL3D

View file

@ -1,26 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/tile_color.h"
namespace NL3D
{
} // NL3D

View file

@ -1,33 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/trav_scene.h"
#include "nel/3d/scene.h"
namespace NL3D
{
} // NL3D
/* End of trav_scene.cpp */

View file

@ -1,27 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/vegetable_def.h"
namespace NL3D
{
} // NL3D

View file

@ -1,26 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "std3d.h"
#include "nel/3d/vegetable_uv8.h"
namespace NL3D
{
} // NL3D

View file

@ -21,6 +21,10 @@
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
// This code is not used actually and doesn't compile
// just preproc comment it
#if 0

View file

@ -1,17 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdgeorges.h"

View file

@ -4625,34 +4625,21 @@ namespace NLGUI
result = url;
string tmp;
// folder used for images cache
static const string cacheDir = "cache";
string::size_type protocolPos = toLower(result).find("://");
if (protocolPos != string::npos)
if (toLower(result).find("file:") == 0 && result.size() > 5)
{
// protocol present, it's an url so file must be searched in cache folder
// TODO: case of special characters & and ?
result = cacheDir + result.substr(protocolPos+2);
// if the file is already cached, use it
if (CFile::fileExists(result)) tmp = result;
result = result.substr(5, result.size()-5);
}
else
else if (result.find("://") != string::npos || result.find("//") == 0)
{
// Url is a file ?
if (toLower(result).find("file:") == 0)
{
result = result.substr(5, result.size()-5);
}
// http://, https://, etc or protocol-less url "//domain.com/image.png"
return false;
}
tmp = CPath::lookup (CFile::getFilename(result), false, false, false);
if (tmp.empty())
{
// try to find in local directory
tmp = CPath::lookup (result, false, false, true);
}
tmp = CPath::lookup (CFile::getFilename(result), false, false, false);
if (tmp.empty())
{
// try to find in local directory
tmp = CPath::lookup (result, false, false, true);
}
if (!tmp.empty())

View file

@ -508,13 +508,13 @@ bool CLigoConfig::canBeRoot (const NLLIGO::IPrimitive &child)
// ***************************************************************************
bool CLigoConfig::getPropertyString (std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName)
bool CLigoConfig::getPropertyString(std::string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &propName)
{
// Call the CIXml version
if (!CIXml::getPropertyString (result, xmlNode, propName))
{
// Output a formated error
syntaxError (filename, xmlNode, "Missing XML node property (%s)", propName);
syntaxError (filename, xmlNode, "Missing XML node property (%s)", propName.c_str());
return false;
}
return true;
@ -522,7 +522,7 @@ bool CLigoConfig::getPropertyString (std::string &result, const char *filename,
// ***************************************************************************
void CLigoConfig::syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format, ...)
void CLigoConfig::syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...)
{
va_list args;
va_start( args, format );
@ -530,7 +530,7 @@ void CLigoConfig::syntaxError (const char *filename, xmlNodePtr xmlNode, const c
vsnprintf( buffer, 1024, format, args );
va_end( args );
errorMessage ("(%s), node (%s), line (%p) :\n%s", filename, xmlNode->name, xmlNode->content, buffer);
errorMessage ("(%s), node (%s), line (%p) :\n%s", filename.c_str(), xmlNode->name, xmlNode->content, buffer);
}
// ***************************************************************************
@ -589,7 +589,7 @@ const CPrimitiveClass *CLigoConfig::getPrimitiveClass (const IPrimitive &primiti
// ***************************************************************************
const CPrimitiveClass *CLigoConfig::getPrimitiveClass (const char *className) const
const CPrimitiveClass *CLigoConfig::getPrimitiveClass(const std::string &className) const
{
std::map<std::string, CPrimitiveClass>::const_iterator ite = _PrimitiveClasses.find (className);
if (ite != _PrimitiveClasses.end ())

View file

@ -22,6 +22,10 @@
//using namespace NL3D;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLLIGO
{

View file

@ -28,6 +28,10 @@ using namespace std;
const uint32 NLLIGO_PRIMITIVE_VERSION = 1;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLLIGO
{
@ -38,7 +42,7 @@ CPrimitiveContext *CPrimitiveContext::_Instance = NULL;
// XML helpers
// ***************************************************************************
void Error (const char *filename, const char *format, ...)
void Error (const std::string &filename, const char *format, ...)
{
va_list args;
va_start( args, format );
@ -46,12 +50,12 @@ void Error (const char *filename, const char *format, ...)
vsnprintf( buffer, 1024, format, args );
va_end( args );
nlwarning ("In File (%s) %s", filename, buffer);
nlwarning ("In File (%s) %s", filename.c_str(), buffer);
}
// ***************************************************************************
void XMLError (xmlNodePtr xmlNode, const char *filename, const char *format, ... )
void XMLError (xmlNodePtr xmlNode, const std::string &filename, const char *format, ... )
{
va_list args;
va_start( args, format );
@ -65,20 +69,20 @@ void XMLError (xmlNodePtr xmlNode, const char *filename, const char *format, ...
// ***************************************************************************
xmlNodePtr GetFirstChildNode (xmlNodePtr xmlNode, const char *filename, const char *childName)
xmlNodePtr GetFirstChildNode (xmlNodePtr xmlNode, const std::string &filename, const std::string &childName)
{
// Call the CIXml version
xmlNodePtr result = CIXml::getFirstChildNode (xmlNode, childName);
if (result) return result;
// Output a formated error
XMLError (xmlNode, filename, "Can't find XML node named (%s)", childName);
XMLError (xmlNode, filename.c_str(), "Can't find XML node named (%s)", childName);
return NULL;
}
// ***************************************************************************
bool GetPropertyString (string &result, const char *filename, xmlNodePtr xmlNode, const char *propName)
bool GetPropertyString (string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &propName)
{
// Call the CIXml version
if (!CIXml::getPropertyString (result, xmlNode, propName))
@ -92,7 +96,7 @@ bool GetPropertyString (string &result, const char *filename, xmlNodePtr xmlNode
// ***************************************************************************
bool ReadInt (const char *propName, int &result, const char *filename, xmlNodePtr xmlNode)
bool ReadInt (const std::string &propName, int &result, const std::string &filename, xmlNodePtr xmlNode)
{
string value;
if (GetPropertyString (value, filename, xmlNode, propName))
@ -105,15 +109,15 @@ bool ReadInt (const char *propName, int &result, const char *filename, xmlNodePt
// ***************************************************************************
void WriteInt (const char *propName, int value, xmlNodePtr xmlNode)
void WriteInt (const std::string &propName, int value, xmlNodePtr xmlNode)
{
// Set properties
xmlSetProp (xmlNode, (const xmlChar*)propName, (const xmlChar*)(toString (value).c_str ()));
xmlSetProp (xmlNode, (const xmlChar*)propName.c_str(), (const xmlChar*)(toString (value).c_str ()));
}
// ***************************************************************************
bool ReadUInt (const char *propName, uint &result, const char *filename, xmlNodePtr xmlNode)
bool ReadUInt (const std::string &propName, uint &result, const std::string &filename, xmlNodePtr xmlNode)
{
string value;
if (GetPropertyString (value, filename, xmlNode, propName))
@ -126,15 +130,15 @@ bool ReadUInt (const char *propName, uint &result, const char *filename, xmlNode
// ***************************************************************************
void WriteUInt (const char *propName, uint value, xmlNodePtr xmlNode)
void WriteUInt (const std::string &propName, uint value, xmlNodePtr xmlNode)
{
// Set properties
xmlSetProp (xmlNode, (const xmlChar*)propName, (const xmlChar*)(toString (value).c_str ()));
xmlSetProp (xmlNode, (const xmlChar*)propName.c_str(), (const xmlChar*)(toString (value).c_str ()));
}
// ***************************************************************************
bool ReadFloat (const char *propName, float &result, const char *filename, xmlNodePtr xmlNode)
bool ReadFloat (const std::string &propName, float &result, const std::string &filename, xmlNodePtr xmlNode)
{
string value;
if (GetPropertyString (value, filename, xmlNode, propName))
@ -147,15 +151,15 @@ bool ReadFloat (const char *propName, float &result, const char *filename, xmlNo
// ***************************************************************************
void WriteFloat (const char *propName, float value, xmlNodePtr xmlNode)
void WriteFloat (const std::string &propName, float value, xmlNodePtr xmlNode)
{
// Set properties
xmlSetProp (xmlNode, (const xmlChar*)propName, (const xmlChar*)(toString (value).c_str ()));
xmlSetProp (xmlNode, (const xmlChar*)propName.c_str(), (const xmlChar*)(toString (value).c_str ()));
}
// ***************************************************************************
bool ReadVector (CPrimVector &point, const char *filename, xmlNodePtr xmlNode)
bool ReadVector (CPrimVector &point, const std::string &filename, xmlNodePtr xmlNode)
{
CPrimVector pos;
if (ReadFloat ("X", pos.x, filename, xmlNode))
@ -194,7 +198,7 @@ void WriteVector (const CPrimVector &point, xmlNodePtr xmlNode)
// ***************************************************************************
bool GetNodeString (string &result, const char *filename, xmlNodePtr xmlNode, const char *nodeName)
bool GetNodeString (string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &nodeName)
{
// Look for the node
xmlNodePtr node = CIXml::getFirstChildNode (xmlNode, nodeName);
@ -216,7 +220,7 @@ bool GetNodeString (string &result, const char *filename, xmlNodePtr xmlNode, co
// ***************************************************************************
bool GetContentString (string &result, const char *filename, xmlNodePtr xmlNode)
bool GetContentString (string &result, const std::string &filename, xmlNodePtr xmlNode)
{
// Get the node string
if (!CIXml::getContentString (result, xmlNode))
@ -232,11 +236,6 @@ bool GetContentString (string &result, const char *filename, xmlNodePtr xmlNode)
// CPropertyString
// ***************************************************************************
CPropertyString::CPropertyString (const char *str)
{
String = str;
}
CPropertyString::CPropertyString (const std::string &str)
{
String = str;
@ -244,7 +243,7 @@ CPropertyString::CPropertyString (const std::string &str)
// ***************************************************************************
CPropertyString::CPropertyString (const char *str, bool _default)
CPropertyString::CPropertyString (const std::string &str, bool _default)
{
String = str;
Default = _default;
@ -386,7 +385,7 @@ bool CPrimZone::contains (const NLMISC::CVector &v, const std::vector<NLMISC::CV
// CPrimNode
// ***************************************************************************
bool CPrimNode::read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config)
bool CPrimNode::read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config)
{
return IPrimitive::read (xmlNode, filename, version, config);
}
@ -484,7 +483,7 @@ NLLIGO::IPrimitive *CPrimPoint::copy () const
// ***************************************************************************
bool CPrimPoint::read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config)
bool CPrimPoint::read(xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config)
{
// Read points
xmlNodePtr ptNode = GetFirstChildNode (xmlNode, filename, "PT");
@ -514,7 +513,7 @@ bool CPrimPoint::read (xmlNodePtr xmlNode, const char *filename, uint version, C
// ***************************************************************************
void CPrimPoint::write (xmlNodePtr xmlNode, const char *filename) const
void CPrimPoint::write (xmlNodePtr xmlNode, const std::string &filename) const
{
// Save the point
xmlNodePtr ptNode = xmlNewChild ( xmlNode, NULL, (const xmlChar*)"PT", NULL);
@ -566,7 +565,7 @@ CPrimVector *CPrimPath::getPrimVector ()
// ***************************************************************************
bool CPrimPath::read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config)
bool CPrimPath::read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config)
{
// Read points
VPoints.clear ();
@ -591,7 +590,7 @@ bool CPrimPath::read (xmlNodePtr xmlNode, const char *filename, uint version, CL
// ***************************************************************************
void CPrimPath::write (xmlNodePtr xmlNode, const char *filename) const
void CPrimPath::write (xmlNodePtr xmlNode, const std::string &filename) const
{
// Save the points
for (uint i=0; i<VPoints.size (); i++)
@ -638,7 +637,7 @@ CPrimVector *CPrimZone::getPrimVector ()
// ***************************************************************************
bool CPrimZone::read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config)
bool CPrimZone::read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config)
{
// Read points
VPoints.clear ();
@ -663,7 +662,7 @@ bool CPrimZone::read (xmlNodePtr xmlNode, const char *filename, uint version, CL
// ***************************************************************************
void CPrimZone::write (xmlNodePtr xmlNode, const char *filename) const
void CPrimZone::write (xmlNodePtr xmlNode, const std::string &filename) const
{
// Save the points
for (uint i=0; i<VPoints.size (); i++)
@ -1310,7 +1309,7 @@ bool IPrimitive::getProperty (uint index, std::string &property_name, IProperty
// ***************************************************************************
bool IPrimitive::getPropertyByName (const char *property_name, const IProperty *&result) const
bool IPrimitive::getPropertyByName (const std::string &property_name, const IProperty *&result) const
{
// Look for the property
std::map<std::string, IProperty*>::const_iterator ite = _Properties.find (property_name);
@ -1324,7 +1323,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, const IProperty *
// ***************************************************************************
bool IPrimitive::getPropertyByName (const char *property_name, IProperty *&result) const
bool IPrimitive::getPropertyByName (const std::string &property_name, IProperty *&result) const
{
// Look for the property
std::map<std::string, IProperty*>::const_iterator ite = _Properties.find (property_name);
@ -1338,7 +1337,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, IProperty *&resul
// ***************************************************************************
bool IPrimitive::getPropertyByName (const char *property_name, std::string *&result) const
bool IPrimitive::getPropertyByName (const std::string &property_name, std::string *&result) const
{
// Get the property
IProperty *prop;
@ -1352,7 +1351,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, std::string *&res
}
else
{
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name.c_str());
}
}
return false;
@ -1360,7 +1359,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, std::string *&res
// ***************************************************************************
bool IPrimitive::getPropertyByName (const char *property_name, std::string &result) const
bool IPrimitive::getPropertyByName (const std::string &property_name, std::string &result) const
{
// Get the property
const IProperty *prop;
@ -1374,7 +1373,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, std::string &resu
}
else
{
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name.c_str());
}
}
return false;
@ -1382,7 +1381,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, std::string &resu
// ***************************************************************************
bool IPrimitive::getPropertyByName (const char *property_name, std::vector<std::string> *&result) const
bool IPrimitive::getPropertyByName (const std::string &property_name, std::vector<std::string> *&result) const
{
// Get the property
IProperty *prop;
@ -1396,7 +1395,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, std::vector<std::
}
else
{
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name.c_str());
}
}
return false;
@ -1404,7 +1403,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, std::vector<std::
// ***************************************************************************
bool IPrimitive::getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const
bool IPrimitive::getPropertyByName (const std::string &property_name, const std::vector<std::string> *&result) const
{
// Get the property
IProperty *prop;
@ -1418,7 +1417,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, const std::vector
}
else
{
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name.c_str());
}
}
return false;
@ -1426,7 +1425,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, const std::vector
// ***************************************************************************
bool IPrimitive::getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const
bool IPrimitive::getPropertyByName (const std::string &property_name, NLMISC::CRGBA &result) const
{
// Get the property
IProperty *prop;
@ -1440,7 +1439,7 @@ bool IPrimitive::getPropertyByName (const char *property_name, NLMISC::CRGBA &re
}
else
{
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a color.", property_name);
nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a color.", property_name.c_str());
}
}
return false;
@ -1468,7 +1467,7 @@ bool IPrimitive::removeProperty (uint index)
// ***************************************************************************
bool IPrimitive::removePropertyByName (const char *property_name)
bool IPrimitive::removePropertyByName (const std::string &property_name)
{
// Look for the property
std::map<std::string, IProperty*>::iterator ite = _Properties.find (property_name);
@ -1642,7 +1641,7 @@ bool IPrimitive::checkProperty(const std::string &property_name) const
// ***************************************************************************
bool IPrimitive::addPropertyByName (const char *property_name, IProperty *result)
bool IPrimitive::addPropertyByName (const std::string &property_name, IProperty *result)
{
bool inserted = _Properties.insert (std::map<std::string, IProperty*>::value_type (property_name, result)).second;
if (inserted)
@ -1654,7 +1653,7 @@ bool IPrimitive::addPropertyByName (const char *property_name, IProperty *result
// ***************************************************************************
bool IPrimitive::read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config)
bool IPrimitive::read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config)
{
// Erase old properties
_Properties.clear ();
@ -1915,7 +1914,7 @@ void IPrimitive::initDefaultValues (CLigoConfig &config)
// ***************************************************************************
void IPrimitive::write (xmlNodePtr xmlNode, const char *filename) const
void IPrimitive::write (xmlNodePtr xmlNode, const std::string &filename) const
{
// Save the expanded flag
// if (!Expanded)
@ -2112,7 +2111,7 @@ void CPrimAlias::regenAlias()
// Read the primitive
bool CPrimAlias::read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config)
bool CPrimAlias::read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config)
{
// Read alias
xmlNodePtr ptNode = CIXml::getFirstChildNode (xmlNode, "ALIAS");
@ -2146,7 +2145,7 @@ bool CPrimAlias::read (xmlNodePtr xmlNode, const char *filename, uint version, C
return IPrimitive::read (xmlNode, filename, version, config);
}
// Write the primitive
void CPrimAlias::write (xmlNodePtr xmlNode, const char *filename) const
void CPrimAlias::write (xmlNodePtr xmlNode, const std::string &filename) const
{
// Write alias
xmlNodePtr ptNode = xmlNewChild(xmlNode, NULL, (const xmlChar*)"ALIAS", NULL);
@ -2458,7 +2457,7 @@ CPrimitives& CPrimitives::operator= (const CPrimitives &other)
// ***************************************************************************
bool CPrimitives::read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config)
bool CPrimitives::read (xmlNodePtr xmlNode, const std::string &filename, CLigoConfig &config)
{
nlassert (xmlNode);
@ -2531,7 +2530,7 @@ bool CPrimitives::read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &c
// ***************************************************************************
void CPrimitives::write (xmlDocPtr doc, const char *filename) const
void CPrimitives::write (xmlDocPtr doc, const std::string &filename) const
{
nlassert (doc);
@ -2544,7 +2543,7 @@ void CPrimitives::write (xmlDocPtr doc, const char *filename) const
// ***************************************************************************
void CPrimitives::write (xmlNodePtr root, const char *filename) const
void CPrimitives::write (xmlNodePtr root, const std::string &filename) const
{
nlassert (root);

View file

@ -14,7 +14,15 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/misc/types_nl.h"
#ifndef STDLIGO_H
#define STDLIGO_H
#if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#include <algorithm>
#include <cmath>
@ -44,6 +52,7 @@
// Include from libxml2
#include <libxml/parser.h>
#include "nel/misc/types_nl.h"
#include "nel/misc/debug.h"
#include "nel/misc/common.h"
#include "nel/misc/fast_mem.h"
@ -67,3 +76,5 @@
#endif
#include <windows.h>
#endif
#endif

View file

@ -22,6 +22,10 @@
#include "nel/ligo/ligo_error.h"
#include "nel/ligo/ligo_material.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLLIGO
{

View file

@ -28,6 +28,9 @@
using namespace std;
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLLIGO
{

View file

@ -25,6 +25,10 @@
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLLIGO
{

View file

@ -14,8 +14,15 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_STDMISC_H
#define NL_STDMISC_H
#ifndef NL_STDLOGIC_H
#define NL_STDLOGIC_H
#if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
#include <vector>
#include <map>
@ -24,6 +31,12 @@
#include <libxml/parser.h>
#include "nel/misc/types_nl.h"
#include "nel/misc/entity_id.h"
#include "nel/misc/i_xml.h"
#include "nel/misc/o_xml.h"
#include "nel/misc/stream.h"
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# define _WIN32_WINDOWS 0x0500

View file

@ -124,6 +124,27 @@ CApplicationContext::CApplicationContext()
contextReady();
}
CApplicationContext::~CApplicationContext()
{
#ifdef NL_DEBUG
TSingletonRegistry::iterator it = _SingletonRegistry.begin(), iend = _SingletonRegistry.end();
while (it != iend)
{
// can't use nldebug there because it'll create new displayers
std::string message = toString("Instance '%s' still allocated at %p", it->first.c_str(), it->second);
#ifdef NL_OS_WINDOWS
OutputDebugStringW(utf8ToWide(message));
#else
printf("%s\n", message.c_str());
#endif
++it;
}
#endif
}
void *CApplicationContext::getSingletonPointer(const std::string &singletonName)
{
TSingletonRegistry::iterator it(_SingletonRegistry.find(singletonName));

View file

@ -339,6 +339,9 @@ bool CBigFile::BNP::readHeader(FILE *file)
it++;
}
if (FileNames)
delete[] FileNames;
FileNames = new char[nSize];
memset(FileNames, 0, nSize);
Files.resize(nNb);

View file

@ -213,6 +213,16 @@ namespace NLMISC
return _ThreadMainFiber.getPointer();
}
#endif
static void releaseInstance()
{
if (_Instance)
{
NLMISC::INelContext::getInstance().releaseSingletonPointer("CCurrentCoTask", _Instance);
delete _Instance;
_Instance = NULL;
}
}
};
NLMISC_SAFE_SINGLETON_IMPL(CCurrentCoTask);
@ -560,5 +570,10 @@ namespace NLMISC
}
}
void CCoTask::releaseInstance()
{
CCurrentCoTask::releaseInstance();
}
} // namespace NLMISC

View file

@ -765,7 +765,8 @@ static bool createProcess(const std::string &programName, const std::string &arg
args = toString("\"%s\" ", programName.c_str()) + arguments;
}
BOOL res = CreateProcessW(sProgramName, utf8ToWide(args), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
// or 0 for a window
BOOL res = CreateProcessW(sProgramName, utf8ToWide(args), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL /* current dir */, &si, &pi);
if (sProgramName)
{
@ -1012,20 +1013,32 @@ sint launchProgramAndWaitForResult(const std::string &programName, const std::st
if (!createProcess(programName, arguments, log, pi)) return -1;
// Successfully created the process. Wait for it to finish.
WaitForSingleObject(pi.hProcess, INFINITE);
DWORD ret = WaitForSingleObject(pi.hProcess, INFINITE);
// Get the exit code.
DWORD exitCode = 0;
BOOL ok = GetExitCodeProcess(pi.hProcess, &exitCode);
if (ret == WAIT_OBJECT_0)
{
// Get the exit code.
DWORD exitCode = 0;
BOOL ok = GetExitCodeProcess(pi.hProcess, &exitCode);
//nldebug("LAUNCH: Successful launch '%s' with arg '%s'", programName.c_str(), arguments.c_str());
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
//nldebug("LAUNCH: Successful launch '%s' with arg '%s'", programName.c_str(), arguments.c_str());
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
if (ok) return (sint)exitCode;
if (ok) return (sint)exitCode;
}
if (log)
nlwarning("LAUNCH: Failed launched '%s' with arg '%s'", programName.c_str(), arguments.c_str());
{
std::string error = toString((uint)ret);
if (ret == WAIT_FAILED)
{
error += "(" + formatErrorMessage(getLastError()) +")";
}
nlwarning("LAUNCH: Failed launched '%s' with arg '%s' and error: %s", programName.c_str(), arguments.c_str(), error.c_str());
}
return -1;
#else
@ -1535,7 +1548,7 @@ static bool openDocWithExtension (const std::string &document, const std::string
if (command.empty())
{
nlwarning("Unable to open %s", document);
nlwarning("Unable to open %s", document.c_str());
return false;
}

View file

@ -3221,7 +3221,7 @@ static void *yy_flex_alloc( size )
yy_size_t size;
#endif
{
return (void *) malloc( size ); // TODO: delete
return (void *) malloc( size );
}
#ifdef YY_USE_PROTOS

View file

@ -715,7 +715,7 @@ void CIXml::serialBuffer(uint8 *buf, uint len)
// ***************************************************************************
bool CIXml::xmlPushBeginInternal (const char *nodeName)
bool CIXml::xmlPushBeginInternal (const std::string &nodeName)
{
nlassert( isReading() );
@ -744,12 +744,12 @@ bool CIXml::xmlPushBeginInternal (const char *nodeName)
nlassert (_CurrentNode->name);
// Node element with the good name ?
if ( (_CurrentNode->type != XML_ELEMENT_NODE) || ( (const char*)_CurrentNode->name != string(nodeName)) )
if ( (_CurrentNode->type != XML_ELEMENT_NODE) || ( (const char*)_CurrentNode->name != nodeName) )
{
// Make an error message
char tmp[512];
smprintf (tmp, 512, "NeL XML Syntax error : root node has the wrong name : \"%s\" should have \"%s\"",
_CurrentNode->name, nodeName);
_CurrentNode->name, nodeName.c_str());
throw EXmlParsingError (tmp);
}
}
@ -769,7 +769,7 @@ bool CIXml::xmlPushBeginInternal (const char *nodeName)
nlassert (_CurrentNode->name);
// Node with the good name
if ( (_CurrentNode->type == XML_ELEMENT_NODE) && ( (const char*)_CurrentNode->name == string(nodeName)) )
if ( (_CurrentNode->type == XML_ELEMENT_NODE) && ( (const char*)_CurrentNode->name == nodeName) )
{
// Save current element
_CurrentElement = _CurrentNode;
@ -789,7 +789,7 @@ bool CIXml::xmlPushBeginInternal (const char *nodeName)
// Make an error message
char tmp[512];
smprintf (tmp, 512, "NeL XML Syntax error in block line %d \nCan't open the node named %s in node named %s",
(int)_CurrentElement->line, nodeName, _CurrentElement->name);
(int)_CurrentElement->line, nodeName.c_str(), _CurrentElement->name);
throw EXmlParsingError (tmp);
}
@ -902,7 +902,7 @@ bool CIXml::xmlPopInternal ()
// ***************************************************************************
bool CIXml::xmlSetAttribInternal (const char *attribName)
bool CIXml::xmlSetAttribInternal (const std::string &attribName)
{
nlassert( isReading() );
@ -951,7 +951,7 @@ bool CIXml::xmlBreakLineInternal ()
// ***************************************************************************
bool CIXml::xmlCommentInternal (const char * /* comment */)
bool CIXml::xmlCommentInternal (const std::string &/* comment */)
{
// Ok
return true;
@ -959,12 +959,12 @@ bool CIXml::xmlCommentInternal (const char * /* comment */)
// ***************************************************************************
xmlNodePtr CIXml::getFirstChildNode (xmlNodePtr parent, const char *childName)
xmlNodePtr CIXml::getFirstChildNode (xmlNodePtr parent, const std::string &childName)
{
xmlNodePtr child = parent->children;
while (child)
{
if (strcmp ((const char*)child->name, childName) == 0)
if (childName == (const char*)child->name)
return child;
child = child->next;
}
@ -973,12 +973,12 @@ xmlNodePtr CIXml::getFirstChildNode (xmlNodePtr parent, const char *childName)
// ***************************************************************************
xmlNodePtr CIXml::getNextChildNode (xmlNodePtr last, const char *childName)
xmlNodePtr CIXml::getNextChildNode (xmlNodePtr last, const std::string &childName)
{
last = last->next;
while (last)
{
if (strcmp ((const char*)last->name, childName) == 0)
if (childName == (const char*)last->name)
return last;
last = last->next;
}
@ -1015,7 +1015,7 @@ xmlNodePtr CIXml::getNextChildNode (xmlNodePtr last, sint /* xmlElementType */ t
// ***************************************************************************
uint CIXml::countChildren (xmlNodePtr node, const char *childName)
uint CIXml::countChildren (xmlNodePtr node, const std::string &childName)
{
uint count=0;
xmlNodePtr child = getFirstChildNode (node, childName);
@ -1053,10 +1053,10 @@ xmlNodePtr CIXml::getRootNode () const
// ***************************************************************************
bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const char *property)
bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const std::string &property)
{
// Get the value
const char *value = (const char*)xmlGetProp (node, (xmlChar*)property);
const char *value = (const char*)xmlGetProp (node, (xmlChar*)property.c_str());
if (value)
{
// Active value
@ -1073,7 +1073,7 @@ bool CIXml::getPropertyString (std::string &result, xmlNodePtr node, const char
// ***************************************************************************
int CIXml::getIntProperty(xmlNodePtr node, const char *property, int defaultValue)
int CIXml::getIntProperty(xmlNodePtr node, const std::string &property, int defaultValue)
{
CSString s;
bool b;
@ -1095,7 +1095,7 @@ int CIXml::getIntProperty(xmlNodePtr node, const char *property, int defaultValu
// ***************************************************************************
double CIXml::getFloatProperty(xmlNodePtr node, const char *property, float defaultValue)
double CIXml::getFloatProperty(xmlNodePtr node, const std::string &property, float defaultValue)
{
CSString s;
bool b;
@ -1109,7 +1109,7 @@ double CIXml::getFloatProperty(xmlNodePtr node, const char *property, float defa
// ***************************************************************************
std::string CIXml::getStringProperty(xmlNodePtr node, const char *property, const std::string& defaultValue)
std::string CIXml::getStringProperty(xmlNodePtr node, const std::string &property, const std::string& defaultValue)
{
std::string s;
bool b;

View file

@ -268,7 +268,7 @@ namespace NLMISC
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
// else, this is one of the way recommended by microsoft to solve the problem.
std::auto_ptr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap));
CUniquePtr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap));
CMsgQueueIdent msgQueueIdent(ownerWindow, localId, foreignId);
if (messageQueueMap->value().count(msgQueueIdent))
{
@ -368,7 +368,7 @@ namespace NLMISC
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
// else, this is one of the way recommended by microsoft to solve the problem.
std::auto_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()));
nlassert(it != messageQueueMap->value().end());
messageQueueMap->value().erase(it);
@ -408,7 +408,7 @@ namespace NLMISC
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
// else, this is one of the way recommended by microsoft to solve the problem.
std::auto_ptr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap));
CUniquePtr<TAccessor> messageQueueMap(new TAccessor(&_MessageQueueMap));
TMessageQueueMap::iterator it = messageQueueMap->value().find(CMsgQueueIdent(hwnd, toId, fromId));
if (it != messageQueueMap->value().end())
{

View file

@ -152,7 +152,7 @@ void xmlGenericErrorFuncWrite (void *ctx, const char *msg, ...)
// ***************************************************************************
bool COXml::init (IStream *stream, const char *version)
bool COXml::init (IStream *stream, const std::string &version)
{
resetPtrTable();
@ -201,7 +201,7 @@ COXml::~COXml ()
// ***************************************************************************
void COXml::serialSeparatedBufferOut( const char *value )
void COXml::serialSeparatedBufferOut( const std::string &value )
{
nlassert( ! isReading() );
@ -218,7 +218,7 @@ void COXml::serialSeparatedBufferOut( const char *value )
if (_AttribPresent)
{
// Set the attribute
xmlSetProp (_CurrentNode, (const xmlChar*)_AttribName.c_str(), (const xmlChar*)value);
xmlSetProp (_CurrentNode, (const xmlChar*)_AttribName.c_str(), (const xmlChar*)value.c_str());
// The attribute has been used
_AttribPresent = false;
@ -349,7 +349,8 @@ void COXml::serialBit(bool &bit)
#ifndef NL_OS_CYGWIN
void COXml::serial(char &b)
{
char tmp[2] = {b , 0};
std::string tmp;
tmp += b;
serialSeparatedBufferOut( tmp );
}
#endif // NL_OS_CYGWIN
@ -364,7 +365,7 @@ void COXml::serial(std::string &b)
if (_PushBegin)
{
// Only serial the string
serialSeparatedBufferOut( b.c_str() );
serialSeparatedBufferOut( b );
}
else
{
@ -372,7 +373,7 @@ void COXml::serial(std::string &b)
xmlPush ("S");
// Serial the string
serialSeparatedBufferOut( b.c_str() );
serialSeparatedBufferOut( b );
// Close the node
xmlPop ();
@ -415,7 +416,7 @@ void COXml::serialBuffer(uint8 *buf, uint len)
// ***************************************************************************
bool COXml::xmlPushBeginInternal (const char *nodeName)
bool COXml::xmlPushBeginInternal (const std::string &nodeName)
{
nlassert( ! isReading() );
@ -439,7 +440,7 @@ bool COXml::xmlPushBeginInternal (const char *nodeName)
}
// Create the first node
_CurrentNode=xmlNewDocNode (_Document, NULL, (const xmlChar*)nodeName, NULL);
_CurrentNode=xmlNewDocNode (_Document, NULL, (const xmlChar*)nodeName.c_str(), NULL);
xmlDocSetRootElement (_Document, _CurrentNode);
// Return NULL if error
@ -451,7 +452,7 @@ bool COXml::xmlPushBeginInternal (const char *nodeName)
flushContentString ();
// Create a new node
_CurrentNode=xmlNewChild (_CurrentNode, NULL, (const xmlChar*)nodeName, NULL);
_CurrentNode=xmlNewChild (_CurrentNode, NULL, (const xmlChar*)nodeName.c_str(), NULL);
// Return NULL if error
nlassert (_CurrentNode);
@ -543,7 +544,7 @@ bool COXml::xmlPopInternal ()
// ***************************************************************************
bool COXml::xmlSetAttribInternal (const char *attribName)
bool COXml::xmlSetAttribInternal (const std::string &attribName)
{
nlassert( ! isReading() );
@ -608,7 +609,7 @@ bool COXml::xmlBreakLineInternal ()
// ***************************************************************************
bool COXml::xmlCommentInternal (const char *comment)
bool COXml::xmlCommentInternal (const std::string &comment)
{
nlassert( ! isReading() );
@ -619,7 +620,7 @@ bool COXml::xmlCommentInternal (const char *comment)
if ( _CurrentNode != NULL)
{
// Add a comment node
xmlNodePtr commentPtr = xmlNewComment ((const xmlChar *)comment);
xmlNodePtr commentPtr = xmlNewComment ((const xmlChar *)comment.c_str());
// Add the node
xmlAddChild (_CurrentNode, commentPtr);
@ -665,15 +666,9 @@ void COXml::flush ()
// ***************************************************************************
bool COXml::isStringValidForProperties (const char *str)
bool COXml::isStringValidForProperties (const std::string &str)
{
while (*str)
{
if (*str == '\n')
return false;
str++;
}
return true;
return str.find('\n') == std::string::npos;
}
// ***************************************************************************

View file

@ -50,8 +50,11 @@ struct CPMainThread : public CPThread
~CPMainThread()
{
if(pthread_key_delete(threadSpecificKey) != 0)
throw EThread("cannot delete thread specific storage key.");
if (pthread_key_delete(threadSpecificKey) != 0)
{
nlwarning("cannot delete thread specific storage key.");
// throw EThread("cannot delete thread specific storage key.");
}
}
};

View file

@ -2523,7 +2523,7 @@ bool CFile::createDirectoryTree(const std::string &filename)
return lastResult;
}
bool CPath::makePathRelative (const char *basePath, std::string &relativePath)
bool CPath::makePathRelative (const std::string &basePath, std::string &relativePath)
{
// Standard path with final slash
string tmp = standardizePath (basePath, true);

View file

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

View file

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

View file

@ -63,6 +63,10 @@ typedef int SOCKET;
using namespace std;
using namespace NLMISC;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLNET {

View file

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

View file

@ -94,6 +94,10 @@ using namespace NLMISC;
using namespace NLLIGO;
using namespace NL3D;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
// APP DATA
#define NEL3D_APPDATA_LIGO_USE_BOUNDINGBOX ((uint32)1342141818)

View file

@ -67,7 +67,7 @@ struct CDupObjPolicy
dest.serialPtr(obj);
/*if (dest.isReading())
{
std::auto_ptr<T> newObj(new T);
CUniquePtr<T> newObj(new T);
newObj->serialPtr(dest);
delete obj;
obj = newObj.release();
@ -112,7 +112,7 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in)
/** 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...)
*/
std::auto_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
newPS->setScene(in->getOwner()->getScene());
return newPS->detach(index);
@ -142,7 +142,7 @@ NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in)
else
{
CParticleSystem *srcPS = in->getOwner()->getOwner();
std::auto_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
newPS->setScene(in->getOwner()->getOwner()->getScene());
//

View file

@ -764,7 +764,7 @@ void CLocatedBindableDialog::updateZBias()
m_ZBias.GetWindowText(value);
float zbias = 0.f;
int dummy; // to test if end of string as no not wanted extra characters
if (sscanf((LPCTSTR) (value + "\n0"), "%f\n%d", &zbias, &dummy) == 2)
if (_stscanf((LPCTSTR)(value + _T("\n0")), _T("%f\n%d"), &zbias, &dummy) == 2)
{
NLMISC::safe_cast<NL3D::CPSParticle *>(_Bindable)->setZBias(-zbias);
}

View file

@ -469,7 +469,7 @@ void CObjectViewer::loadConfigFile()
try
{
CConfigFile::CVar &var = cf.getVar("automatic_animation_path");
std::auto_ptr<CAnimationSet> as(new CAnimationSet);
CUniquePtr<CAnimationSet> as(new CAnimationSet);
//
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)
{
// Add to the path
std::auto_ptr<CParticleWorkspace> newPW(new CParticleWorkspace);
CUniquePtr<CParticleWorkspace> newPW(new CParticleWorkspace);
newPW->init(_ObjView, fullPath, _ObjView->getFontManager(), _ObjView->getFontGenerator());
newPW->setModificationCallback(ParticleTreeCtrl);
// 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
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())));
std::auto_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
CParticleSystemModel *psm = NULL;
try
{
@ -1147,7 +1147,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
{
float value;
int dummy; // to avoid non numeric characters at the end
if (sscanf ((LPCTSTR)(valueDlg.Value + "\n0"), "%f\n%d", &value, &dummy) == 2)
if (_stscanf((LPCTSTR)(valueDlg.Value + _T("\n0")), _T("%f\n%d"), &value, &dummy) == 2)
{
nlassert(getOwnerNode(nt)->getPSPointer());
getOwnerNode(nt)->getPSPointer()->setZBias(-value);
@ -1526,9 +1526,11 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
{
static const TCHAR BASED_CODE szFilter[] = _T("NeL Particle systems (*.ps)|*.ps||");
CFileDialog fd(TRUE, _T(".ps"), _T("*.ps"), OFN_ALLOWMULTISELECT|OFN_FILEMUSTEXIST, szFilter, this);
const uint MAX_NUM_CHAR = 65536;
TCHAR filenamesBuf[MAX_NUM_CHAR];
_tcscpy(filenamesBuf, _T("*.ps"));
_tcscpy_s(filenamesBuf, MAX_NUM_CHAR, _T("*.ps"));
fd.m_ofn.lpstrFile = filenamesBuf;
fd.m_ofn.nMaxFile = MAX_NUM_CHAR - 1;
if (fd.DoModal() == IDOK)

View file

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

View file

@ -202,7 +202,7 @@ void CParticleWorkspace::CNode::createEmptyPS()
NL3D::CParticleSystem emptyPS;
NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape;
pss->buildFromPS(emptyPS);
std::auto_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
std::string shapeName = NLMISC::CFile::getFilename(_RelativePath);
sb->add(shapeName, pss);
NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank();
@ -276,16 +276,7 @@ void CParticleWorkspace::CNode::savePSAs(const std::string &fullPath) throw(NLMI
std::string CParticleWorkspace::CNode::getFullPath() const
{
nlassert(_WS);
char fullPath[MAX_PATH];
std::string basePath = NLMISC::CPath::standardizeDosPath(_WS->getPath());
if (PathCombine(fullPath, basePath.c_str(), _RelativePath.c_str()))
{
return fullPath;
}
else
{
return _RelativePath.c_str();
}
return NLMISC::CPath::makePathAbsolute(_RelativePath, _WS->getPath(), true);
}
//***********************************************************************************************
@ -298,7 +289,7 @@ bool CParticleWorkspace::CNode::loadPS()
// collapse name
inputFile.open(getFullPath());
ss.serial(inputFile);
std::auto_ptr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
std::string shapeName = NLMISC::CFile::getFilename(_RelativePath);
sb->add(shapeName, ss.getShapePointer());
NL3D::CShapeBank *oldSB = NL3D::CNELU::Scene->getShapeBank();
@ -375,16 +366,18 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena
{
if (NLMISC::nlstricmp(_Nodes[k]->getFilename(), fileName) == 0) return NULL;
}
char resultPath[MAX_PATH];
// TODO: replace with NeL methods
TCHAR resultPath[MAX_PATH];
std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath());
std::string relativePath;
if (!PathRelativePathTo(resultPath, dosPath.c_str(), FILE_ATTRIBUTE_DIRECTORY, filenameWithFullPath.c_str(), 0))
if (!PathRelativePathTo(resultPath, utf8ToTStr(dosPath), FILE_ATTRIBUTE_DIRECTORY, utf8ToTStr(filenameWithFullPath), 0))
{
relativePath = filenameWithFullPath;
}
else
{
relativePath = resultPath;
relativePath = tStrToUtf8(resultPath);
}
if (relativePath.size() >= 2)

View file

@ -121,7 +121,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString
return;
}
std::auto_ptr<TCHAR> tmpDest(new TCHAR[size]);
CUniquePtr<TCHAR[]> tmpDest(new TCHAR[size]);
result = RegQueryValueEx(hKey, name, NULL, &type, (BYTE*)tmpDest.get(), &size);
if (result != ERROR_SUCCESS)
@ -130,7 +130,7 @@ void CSnapshotToolDlg::stringFromRegistry(HKEY hKey, const TCHAR *name, CString
return;
}
dest = *tmpDest;
dest = tmpDest.get();
}
@ -210,8 +210,8 @@ void CSnapshotToolDlg::toRegistry()
HKEY hKey;
if (RegCreateKey(HKEY_CURRENT_USER, NEL_OV_SNAPSHOT_TOOL_REGKEY, &hKey)==ERROR_SUCCESS)
{
RegSetValueEx(hKey, _T("InputPath"), 0, REG_SZ, (BYTE*) (LPCTSTR) m_InputPath, m_InputPath.GetLength() + 1);
RegSetValueEx(hKey, _T("OutputPath"), 0, REG_SZ, (BYTE*) (LPCTSTR) m_OutputPath, m_OutputPath.GetLength() + 1);
RegSetValueEx(hKey, _T("InputPath"), 0, REG_SZ, (BYTE*) (LPCTSTR) m_InputPath, (m_InputPath.GetLength() + 1) * sizeof(TCHAR));
RegSetValueEx(hKey, _T("OutputPath"), 0, REG_SZ, (BYTE*) (LPCTSTR) m_OutputPath, (m_OutputPath.GetLength() + 1) * sizeof(TCHAR));
CString filters;
for (uint k = 0; k < (uint) m_Filters.GetCount(); ++k)
{
@ -221,7 +221,7 @@ void CSnapshotToolDlg::toRegistry()
filters += filter;
}
RegSetValueEx(hKey, _T("Filters"), 0, REG_SZ, (BYTE*) (LPCTSTR) filters, filters.GetLength() + 1);
RegSetValueEx(hKey, _T("Filters"), 0, REG_SZ, (BYTE*) (LPCTSTR) filters, (filters.GetLength() + 1) * sizeof(TCHAR));
DWORD recurseSubFolder = m_RecurseSubFolder;
DWORD dumpTextureSets = m_DumpTextureSets;
DWORD width = (DWORD) m_OutputWidth;

View file

@ -18,7 +18,7 @@
//
#include "std_afx.h"
#include <tchar.h>
//#include "nel/3d/register_3d.h"
//#include "nel/3d/scene.h"
@ -29,9 +29,9 @@
using namespace NLMISC;
using namespace std;
int APIENTRY WinMain(HINSTANCE hInstance,
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
LPTSTR lpCmdLine,
int nCmdShow)
{
// Register 3d
@ -41,13 +41,13 @@ int APIENTRY WinMain(HINSTANCE hInstance,
// init3d ();
// Remove command line ""
char commandLine[512];
char *commandLinePtr=commandLine;
strcpy (commandLine, lpCmdLine);
if (commandLine[0]=='"')
TCHAR commandLine[512];
TCHAR *commandLinePtr=commandLine;
_tcscpy (commandLine, lpCmdLine);
if (commandLine[0]==_T('"'))
commandLinePtr++;
if (commandLinePtr[strlen (commandLinePtr)-1]=='"')
commandLinePtr[strlen (commandLinePtr)-1]=0;
if (commandLinePtr[_tcslen (commandLinePtr)-1]==_T('"'))
commandLinePtr[_tcslen (commandLinePtr)-1]=0;
// Create a object viewer
IObjectViewer *objectViewer=IObjectViewer::getInterface();
@ -58,11 +58,11 @@ int APIENTRY WinMain(HINSTANCE hInstance,
if (objectViewer->initUI ())
{
// Argument ?
if (strcmp (commandLinePtr, "")!=0)
if (_tcscmp (commandLinePtr, _T(""))!=0)
{
// Make a string vector
vector<string> strVector;
strVector.push_back (commandLinePtr);
strVector.push_back (tStrToUtf8(commandLinePtr));
// Try to load a shape
if (objectViewer->loadMesh (strVector, ""))

View file

@ -18,103 +18,42 @@
#include "nel_export.h"
//--------------------------------------------------------------------------------------------------------------
#include "nel/misc/path.h"
ULONG CNelExport::ExtractFileName(char* Path, char* Name)
{
long i,j;
char temp[MAX_PATH];
for(j=0,i=strlen(Path)-1 ; i>=0 && Path[i]!='\\' && Path[i]!='//' ; i--,j++)
temp[j]=Path[i];
temp[j]=0;
for(i=strlen(temp)-1,j=0 ; i>=0 ; i--,j++)
Name[j]=temp[i];
Name[j]=0;
return(1);
}
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::ExtractPath(char* FullPath, char* Path)
ULONG CNelExport::SelectFileForSave(HWND Parent, TCHAR* Title, const TCHAR* Mask, std::string &FileName)
{
long i;
TCHAR curdir[MAX_PATH];
TCHAR fname[MAX_PATH];
for(i=strlen(FullPath)-1 ; i>=0 && FullPath[i]!='\\' && FullPath[i]!='//' ; i--);
strncpy(Path,FullPath,i+1);
Path[i+1]=0;
std::string path, filename;
return(1);
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::SelectFileForLoad(HWND Parent, char* Title, const char* Mask, char* FileName)
{
OPENFILENAME ofn;
char r;
char curdir[MAX_PATH];
char fname[MAX_PATH];
fname[0]=0;
if (!FileName[0])
{
GetCurrentDirectory(MAX_PATH,curdir);
path = NLMISC::CPath::getCurrentPath();
}
else
{
ExtractPath(FileName,curdir);
if (!curdir[0])
path = NLMISC::CFile::getPath(FileName);
if (path.empty())
{
GetCurrentDirectory(MAX_PATH,curdir);
path = NLMISC::CPath::getCurrentPath();
}
ExtractFileName(FileName,fname);
filename = NLMISC::CFile::getFilename(FileName);
}
memset(&ofn,0,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof ( OPENFILENAME );
ofn.hwndOwner = Parent;
ofn.hInstance = GetModuleHandle(NULL);
ofn.lpstrFilter = Mask;
ofn.lpstrCustomFilter = NULL;
ofn.nFilterIndex = 0;
ofn.lpstrFile = fname;
ofn.nMaxFile = 500;
ofn.lpstrTitle = Title;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_OVERWRITEPROMPT;
ofn.lpstrDefExt = "*";
ofn.lpstrInitialDir = curdir;
r=GetOpenFileName ( &ofn );
strcpy(FileName,fname);
return(r);
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::SelectFileForSave(HWND Parent, char* Title, const char* Mask, char* FileName)
{
OPENFILENAME ofn;
char r;
char curdir[MAX_PATH];
char fname[MAX_PATH];
fname[0]=0;
if (!FileName[0])
{
GetCurrentDirectory(MAX_PATH,curdir);
}
else
{
ExtractPath(FileName,curdir);
if (!curdir[0])
{
GetCurrentDirectory(MAX_PATH,curdir);
}
ExtractFileName(FileName,fname);
}
// copy path and filename to temporary buffers
_tcscpy_s(curdir, MAX_PATH, utf8ToTStr(path));
_tcscpy_s(fname, MAX_PATH, utf8ToTStr(filename));
OPENFILENAME ofn;
memset(&ofn,0,sizeof(OPENFILENAME));
ofn.lStructSize = sizeof ( OPENFILENAME );
ofn.hwndOwner = Parent;
@ -126,201 +65,40 @@ ULONG CNelExport::SelectFileForSave(HWND Parent, char* Title, const char* Mask,
ofn.nMaxFile = 500;
ofn.lpstrTitle = Title;
ofn.Flags = OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_OVERWRITEPROMPT;
ofn.lpstrDefExt = "*";
ofn.lpstrDefExt = _T("*");
ofn.lpstrInitialDir = curdir;
r=GetSaveFileName ( &ofn );
strcpy(FileName,fname);
return(r);
BOOL r = GetSaveFileName ( &ofn );
FileName = tStrToUtf8(fname);
return r;
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::SelectDir(HWND Parent, char* Title, char* Path)
ULONG CNelExport::SelectDir(HWND Parent, TCHAR* Title, std::string &Path)
{
BROWSEINFO bi;
char str[MAX_PATH];
ITEMIDLIST* pidl;
TCHAR str[MAX_PATH];
_tcscpy_s(str, MAX_PATH, utf8ToTStr(Path));
BROWSEINFO bi;
bi.hwndOwner=Parent;
bi.pidlRoot=NULL;
bi.pszDisplayName=Path;
bi.pszDisplayName=str;
bi.lpszTitle=Title;
bi.ulFlags=0;
bi.lpfn=0;
bi.lParam=0;
bi.iImage=0;
pidl=SHBrowseForFolder(&bi);
ITEMIDLIST* pidl = SHBrowseForFolder(&bi);
if (!SHGetPathFromIDList(pidl,str) )
{
return(0);
return 0;
}
strcpy(Path,str);
return(1);
Path = tStrToUtf8(str);
return 1;
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::FileExists(const char* FileName)
{
FILE *file;
if ( !strcmp(FileName,"") ) return(0);
file=fopen(FileName,"rb");
if (!file) return(0);
fclose(file);
return(1);
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::GetFileSize(char* FileName)
{
FILE *file;
unsigned long fsize;
file=fopen(FileName,"rb");
if (!file) return(0);
fseek(file,0,SEEK_END);
fsize=ftell(file);
fclose(file);
return(fsize);
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::ProcessDir(char* Dir, const char* Mask, unsigned long flag, ULONG Fnct(char* FileName) )
{
char ToFound[MAX_PATH];
char FullDir[MAX_PATH];
char str[MAX_PATH];
HANDLE h;
WIN32_FIND_DATA fi;
BOOL r;
GetFullPathName(Dir,MAX_PATH,FullDir,NULL);
// --- Directory
if (flag)
{
strcpy(ToFound,Dir);
if ( ToFound[strlen(ToFound)-1]!='\\')
strcat(ToFound,"\\");
strcat(ToFound,"*.*");
h=FindFirstFile(ToFound,&fi);
if (h!=INVALID_HANDLE_VALUE)
{
r=1;
while(r)
{
if ( strcmp(fi.cFileName,".") && strcmp(fi.cFileName,"..") )
{
if (
fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
!(fi.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
)
{
strcpy(str,Dir);
if ( str[strlen(str)-1]!='\\' ) strcat(str,"\\");
strcat(str,fi.cFileName);
if ( !ProcessDir(str,Mask,flag,Fnct) ) return(0);
}
}
r=FindNextFile(h,&fi);
}
FindClose(h);
}
}
// --- Files
strcpy(ToFound,Dir);
if ( ToFound[strlen(ToFound)-1]!='\\') strcat(ToFound,"\\");
strcat(ToFound,Mask);
h=FindFirstFile(ToFound,&fi);
if (h!=INVALID_HANDLE_VALUE)
{
r=1;
while(r)
{
if ( strcmp(fi.cFileName,".") && strcmp(fi.cFileName,"..") )
{
if ( !(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strcpy(str,FullDir);
if ( str[strlen(str)-1]!='\\' ) strcat(str,"\\");
strcat(str,fi.cFileName);
::strupr(str);
if ( !Fnct(str) ) return(0);
}
}
r=FindNextFile(h,&fi);
}
FindClose(h);
}
return(1);
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::CleanFileName(char* FileName)
{
char str[MAX_PATH];
unsigned long i,j,found;
j=0;
for(i=0 ; i<strlen(FileName) ; i++)
{
found=0;
if (FileName[i]=='\\' && i!=0 && FileName[i-1]!='\\') { str[j]='\\'; j++; found=1; }
if (FileName[i]=='/' && i!=0 && FileName[i-1]!='/') { str[j]='/'; j++; found=1; }
if (!found) { str[j]=FileName[i]; j++; }
}
return(1);
}
//--------------------------------------------------------------------------------------------------------------
ULONG CNelExport::CreateBAKFile(char* FileName)
{
FILE *fin,*fout;
unsigned long fsize;
char *block;
char str[MAX_PATH];
if ( !FileExists(FileName) )
{
return(1);
}
fin=fopen(FileName,"rb");
if (!fin)
{
//SetError("CreateBAKFile, unable to open %s",FileName);
return(0);
}
fsize=GetFileSize(FileName);
if (!fsize)
{
//SetError("CreateBAKFile, unable to get file size for %s",FileName);
return(0);
}
block=(char*)calloc(1,fsize);
if (!block)
{
//SetError("CreateBAKFile, not enough memory");
return(0);
}
fread(block,1,fsize,fin);
fclose(fin);
strcpy(str,FileName);
str[strlen(str)-1]='K';
str[strlen(str)-2]='A';
str[strlen(str)-3]='B';
fout=fopen(str,"w+b");
if (!fout)
{
//SetError("CreateBAKFile, unable to open %s",str);
return(0);
}
fwrite(block,1,fsize,fout);
fclose(fout);
return(1);
}

View file

@ -62,7 +62,8 @@ INT_PTR CALLBACK CalculatingDialogCallback (
(((uint32)TimeLeft)/60)%60,
(((uint32)TimeLeft))%60 );
if (pClass->bCancelCalculation)
_tcscpy (temp, _T("INTERRUPTED - Finishing current object..."));
_tcscpy_s (temp, 256, _T("INTERRUPTED - Finishing current object..."));
SendMessage (GetDlgItem (hwndDlg, IDC_STATICTIMELEFT), WM_SETTEXT, 0, (LPARAM)temp);
SendMessage (GetDlgItem (hwndDlg, IDC_BUTTONCANCEL), WM_PAINT, 0, 0);
}

View file

@ -34,6 +34,10 @@
using namespace NLMISC;
using namespace NL3D;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
static Class_ID DefNoteTrackClassID(NOTETRACK_CLASS_ID, 0);
#define BOOL_CONTROL_CLASS_ID 0x984b8d27

View file

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

View file

@ -20,7 +20,7 @@
#include <set>
#include <vector>
#include <iterator>
#include "nel/misc/line.h"
#include "nel/misc/polygon.h"

View file

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

View file

@ -1,6 +1,10 @@
#include "stdafx.h"
#include "editpat.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define DBGWELD_DUMPx

View file

@ -133,7 +133,10 @@ void SetBankPathName (const std::string& path)
HKEY hKey;
if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS)
{
RegSetValueEx(hKey, "Bank Path", 0, REG_SZ, (LPBYTE)path.c_str(), path.length()+1);
TCHAR buffer[MAX_PATH];
_tcscpy_s(buffer, MAX_PATH, utf8ToTStr(path));
RegSetValueEx(hKey, _T("Bank Path"), 0, REG_SZ, (LPBYTE)buffer, (_tcslen(buffer)+1)*sizeof(TCHAR));
RegCloseKey (hKey);
}
}
@ -1972,7 +1975,7 @@ IOResult RPatchMesh::Load(ILoad *iload)
for (i=0; i<nSize; i++)
{
bool bBinded;
typeBind nType;
uint /* typeBind */ nType;
uint nEdge;
uint nPatch;
uint nBefore;
@ -2113,7 +2116,7 @@ IOResult RPatchMesh::Save(ISave *isave)
uint nAfter=getUIVertex (i).Binding.nAfter;
uint nAfter2=getUIVertex (i).Binding.nAfter2;
uint nT=getUIVertex (i).Binding.nT;
typeBind nType=(typeBind)getUIVertex (i).Binding.nType;
uint /* typeBind */ nType=(uint /* typeBind */)getUIVertex (i).Binding.nType;
uint nPrimVert=getUIVertex (i).Binding.nPrimVert;
isave->Write(&bBinded, sizeof (bool), &nb);

Some files were not shown because too many files have changed in this diff Show more