Merge with develop

This commit is contained in:
kervala 2016-11-20 14:51:11 +01:00
parent e529295ca4
commit 4d96978674
372 changed files with 1824 additions and 1777 deletions

View file

@ -18,6 +18,7 @@ FIND_PATH(MAXSDK_DIR
PATHS PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk" "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk" "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
@ -36,7 +37,7 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
) )
IF(TARGET_X64) IF(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib) SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release)
ELSE() ELSE()
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib) SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
ENDIF() ENDIF()
@ -73,8 +74,26 @@ if(MAXSDK_FOUND)
${MAXSDK_MAXUTIL_LIBRARY} ${MAXSDK_MAXUTIL_LIBRARY}
${MAXSDK_MAXSCRIPT_LIBRARY} ${MAXSDK_MAXSCRIPT_LIBRARY}
${MAXSDK_PARAMBLK2_LIBRARY} ${MAXSDK_PARAMBLK2_LIBRARY}
${MAXSDK_BMM_LIBRARY} ) ${MAXSDK_BMM_LIBRARY})
# parse maxversion.h to determine SDK version
IF(EXISTS "${MAXSDK_DIR}/include/maxversion.h")
FILE(STRINGS "${MAXSDK_DIR}/include/maxversion.h" LINES REGEX "#define MAX_PRODUCT_YEAR_NUMBER ([0-9]+)")
STRING(REGEX REPLACE ".+MAX_PRODUCT_YEAR_NUMBER ([0-9]+)" "\\1" MAXSDK_VERSION "${LINES}")
UNSET(LINES)
ELSE()
SET(MAXSDK_VERSION "Unknown")
ENDIF()
MESSAGE(STATUS "Found 3dsmax version ${MAXSDK_VERSION} in ${MAXSDK_DIR}")
# 3ds Max 2013 and later are always Unicode
IF(MAXSDK_VERSION VERSION_GREATER 2012)
SET(MAXSDK_DEFINITIONS -DUNICODE -D_UNICODE)
ELSE()
SET(MAXSDK_DEFINITIONS)
ENDIF()
ELSE() ELSE()
set(MAXSDK_LIBRARIES) set(MAXSDK_LIBRARIES)
ENDIF() ENDIF()

View file

@ -367,7 +367,7 @@ ENDMACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
MACRO(ADD_PLATFORM_FLAGS _FLAGS) MACRO(ADD_PLATFORM_FLAGS _FLAGS)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}")
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}")
ENDMACRO(ADD_PLATFORM_FLAGS) ENDMACRO()
MACRO(NL_SETUP_BUILD) MACRO(NL_SETUP_BUILD)
@ -390,9 +390,13 @@ MACRO(NL_SETUP_BUILD)
ENDIF() ENDIF()
ENDIF() ENDIF()
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) IF(CMAKE_CXX_LIBRARY_ARCHITECTURE)
SET(HOST_CPU ${CMAKE_CXX_LIBRARY_ARCHITECTURE})
ELSE()
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
ENDIF()
IF(HOST_CPU MATCHES "(amd|AMD)64") IF(HOST_CPU MATCHES "(amd|AMD|x86_)64")
SET(HOST_CPU "x86_64") SET(HOST_CPU "x86_64")
ELSEIF(HOST_CPU MATCHES "i.86") ELSEIF(HOST_CPU MATCHES "i.86")
SET(HOST_CPU "x86") SET(HOST_CPU "x86")
@ -402,10 +406,10 @@ MACRO(NL_SETUP_BUILD)
# If not specified, use the same CPU as host # If not specified, use the same CPU as host
IF(NOT TARGET_CPU) IF(NOT TARGET_CPU)
SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR}) SET(TARGET_CPU ${HOST_CPU})
ENDIF() ENDIF()
IF(TARGET_CPU MATCHES "(amd|AMD)64") IF(TARGET_CPU MATCHES "(amd|AMD|x86_)64")
SET(TARGET_CPU "x86_64") SET(TARGET_CPU "x86_64")
ELSEIF(TARGET_CPU MATCHES "i.86") ELSEIF(TARGET_CPU MATCHES "i.86")
SET(TARGET_CPU "x86") SET(TARGET_CPU "x86")
@ -413,7 +417,7 @@ MACRO(NL_SETUP_BUILD)
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON) SET(CLANG ON)
MESSAGE(STATUS "Using Clang compiler") MESSAGE(STATUS "Using Clang ${CMAKE_CXX_COMPILER_VERSION} compiler")
ENDIF() ENDIF()
IF(CMAKE_GENERATOR MATCHES "Xcode") IF(CMAKE_GENERATOR MATCHES "Xcode")
@ -474,6 +478,9 @@ MACRO(NL_SETUP_BUILD)
SET(TARGET_X86 1) SET(TARGET_X86 1)
ELSEIF(TARGET_CPU STREQUAL "x86") ELSEIF(TARGET_CPU STREQUAL "x86")
SET(TARGET_X86 1) SET(TARGET_X86 1)
ELSEIF(TARGET_CPU STREQUAL "arm64")
SET(TARGET_ARM 1)
SET(TARGET_ARM64 1)
ELSEIF(TARGET_CPU STREQUAL "armv7s") ELSEIF(TARGET_CPU STREQUAL "armv7s")
SET(TARGET_ARM 1) SET(TARGET_ARM 1)
SET(TARGET_ARMV7S 1) SET(TARGET_ARMV7S 1)
@ -493,6 +500,10 @@ MACRO(NL_SETUP_BUILD)
ENDIF() ENDIF()
IF(TARGET_ARM) IF(TARGET_ARM)
IF(TARGET_ARM64)
ADD_PLATFORM_FLAGS("-DHAVE_ARM64")
ENDIF()
IF(TARGET_ARMV7S) IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S") ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S")
ENDIF() ENDIF()
@ -541,10 +552,6 @@ MACRO(NL_SETUP_BUILD)
ENDIF() ENDIF()
IF(MSVC) IF(MSVC)
IF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11)
SET(MSVC11 ON)
ENDIF()
# Ignore default include paths # Ignore default include paths
ADD_PLATFORM_FLAGS("/X") ADD_PLATFORM_FLAGS("/X")
@ -555,31 +562,31 @@ MACRO(NL_SETUP_BUILD)
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC12) ELSEIF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2013, but custom optimizations don't exist # /Ox is working with VC++ 2013, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC11) ELSEIF(MSVC11)
ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2012, but custom optimizations don't exist # /Ox is working with VC++ 2012, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC10) ELSEIF(MSVC10)
ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") ADD_PLATFORM_FLAGS("/Gy-")
# /Ox is working with VC++ 2010, but custom optimizations don't exist # /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC90) ELSEIF(MSVC90)
ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") ADD_PLATFORM_FLAGS("/Gy-")
# don't use a /O[012x] flag if you want custom optimizations # don't use a /O[012x] flag if you want custom optimizations
SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}") SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC80) ELSEIF(MSVC80)
ADD_PLATFORM_FLAGS("/Gy- /Wp64 /Zm1000") ADD_PLATFORM_FLAGS("/Gy- /Wp64")
# don't use a /O[012x] flag if you want custom optimizations # don't use a /O[012x] flag if you want custom optimizations
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
@ -588,16 +595,19 @@ MACRO(NL_SETUP_BUILD)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF() ENDIF()
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /wd4250") ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WIN32 /DWIN32 /D_WINDOWS /wd4250")
# huge PCH
ADD_PLATFORM_FLAGS("/Zm1000")
IF(TARGET_X64) IF(TARGET_X64)
# Fix a bug with Intellisense # Fix a bug with Intellisense
ADD_PLATFORM_FLAGS("/D_WIN64") ADD_PLATFORM_FLAGS("/D_WIN64")
# Fix a compilation error for some big C++ files # Fix a compilation error for some big C++ files
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} /bigobj") ADD_PLATFORM_FLAGS("/bigobj")
ELSE() ELSE()
# Allows 32 bits applications to use 3 GB of RAM # Allows 32 bits applications to use 3 GB of RAM
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE") ADD_PLATFORM_LINKFLAGS("/LARGEADDRESSAWARE")
ENDIF() ENDIF()
# Exceptions are only set for C++ # Exceptions are only set for C++
@ -840,6 +850,9 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("-D_REENTRANT -fno-strict-aliasing") ADD_PLATFORM_FLAGS("-D_REENTRANT -fno-strict-aliasing")
# hardening
ADD_PLATFORM_FLAGS("-D_FORTIFY_SOURCE=2")
IF(NOT WITH_LOW_MEMORY) IF(NOT WITH_LOW_MEMORY)
ADD_PLATFORM_FLAGS("-pipe") ADD_PLATFORM_FLAGS("-pipe")
ENDIF() ENDIF()
@ -850,6 +863,12 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_WARNINGS) IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused") ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused")
ELSE()
# Check wrong formats in printf-like functions
ADD_PLATFORM_FLAGS("-Wformat -Werror=format-security")
# Don't display invalid or unused command lines arguments by default (often too verbose)
ADD_PLATFORM_FLAGS("-Wno-invalid-command-line-argument -Wno-unused-command-line-argument")
ENDIF() ENDIF()
IF(ANDROID) IF(ANDROID)
@ -859,7 +878,7 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("-Wa,--noexecstack") ADD_PLATFORM_FLAGS("-Wa,--noexecstack")
IF(TARGET_ARM) IF(TARGET_ARM)
ADD_PLATFORM_FLAGS("-fpic -fstack-protector") ADD_PLATFORM_FLAGS("-fpic")
ADD_PLATFORM_FLAGS("-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__") ADD_PLATFORM_FLAGS("-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__")
IF(TARGET_ARMV7) IF(TARGET_ARMV7)
@ -871,24 +890,20 @@ MACRO(NL_SETUP_BUILD)
SET(TARGET_THUMB ON) SET(TARGET_THUMB ON)
IF(TARGET_THUMB) IF(TARGET_THUMB)
ADD_PLATFORM_FLAGS("-mthumb -fno-strict-aliasing -finline-limit=64") ADD_PLATFORM_FLAGS("-mthumb -finline-limit=64")
SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -marm") SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -marm")
ELSE() ELSE()
ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300") ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300")
SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing")
ENDIF() ENDIF()
ELSEIF(TARGET_X86) ELSEIF(TARGET_X86)
# Optimizations for Intel Atom # Optimizations for Intel Atom
ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops") ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops")
ADD_PLATFORM_FLAGS("-fstack-protector -funswitch-loops -finline-limit=300") ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing")
SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing")
ELSEIF(TARGET_MIPS) ELSEIF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fno-strict-aliasing") ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300") SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300")
ENDIF() ENDIF()
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -L${PLATFORM_ROOT}/usr/lib") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -L${PLATFORM_ROOT}/usr/lib")
ENDIF() ENDIF()
@ -897,16 +912,22 @@ MACRO(NL_SETUP_BUILD)
ENDIF() ENDIF()
# Fix "relocation R_X86_64_32 against.." error on x64 platforms # Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW) IF(NOT MINGW)
ADD_PLATFORM_FLAGS("-fPIC") ADD_PLATFORM_FLAGS("-fPIC")
ENDIF() ENDIF()
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
# hardening
ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4")
IF(NOT APPLE) IF(NOT APPLE)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed")
ENDIF() ENDIF()
# hardening
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now")
IF(WITH_SYMBOLS) IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g") SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g")
ELSE() ELSE()
@ -920,7 +941,7 @@ MACRO(NL_SETUP_BUILD)
SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}") SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}")
ENDIF() ENDIF()
ENDMACRO(NL_SETUP_BUILD) ENDMACRO()
MACRO(NL_SETUP_BUILD_FLAGS) MACRO(NL_SETUP_BUILD_FLAGS)
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE) SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)

View file

@ -84,7 +84,7 @@ public:
void setTextureFile (const char* file); void setTextureFile (const char* file);
/** /**
* Add a coarse mesh in the manager. If an error occured, it returns CantAddCoarseMesh. * Add a coarse mesh in the manager. If an error occurred, it returns CantAddCoarseMesh.
* \param vBuffer the VertexBuffer pre-transformed / Colored. Size MUST be numVertices*NL3D_COARSEMESH_VERTEX_FORMAT_MGR * \param vBuffer the VertexBuffer pre-transformed / Colored. Size MUST be numVertices*NL3D_COARSEMESH_VERTEX_FORMAT_MGR
* \param indexBuffer containing triangles that will be inserted. * \param indexBuffer containing triangles that will be inserted.
* \return false if the mesh can't be added to this pass BECAUSE OF TOO MANY VERTICES or TOO MANY PRIMITIVES reason * \return false if the mesh can't be added to this pass BECAUSE OF TOO MANY VERTICES or TOO MANY PRIMITIVES reason

View file

@ -716,7 +716,7 @@ private:
bool _RefineMode; bool _RefineMode;
float _FarTransition; float _FarTransition;
uint _TileMaxSubdivision; uint _TileMaxSubdivision;
// For VertexProgram. true if change has occured in threshold since the last render(). // For VertexProgram. true if change has occurred in threshold since the last render().
float _VPThresholdChange; float _VPThresholdChange;
/// \name VertexBuffer mgt. /// \name VertexBuffer mgt.

View file

@ -92,9 +92,9 @@ public:
void setWorldMatrix (const NLMISC::CMatrix &WM); void setWorldMatrix (const NLMISC::CMatrix &WM);
void setName (std::string &name) { _Name = name; } void setName (const std::string &name) { _Name = name; }
std::string getName () { return _Name; } std::string getName () const { return _Name; }
void open (bool opened) { _Opened = opened; } void open (bool opened) { _Opened = opened; }
bool isOpened () { return _Opened; } bool isOpened () { return _Opened; }

View file

@ -24,6 +24,8 @@
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "nel/misc/traits_nl.h" #include "nel/misc/traits_nl.h"
#include <iterator>
namespace NL3D { namespace NL3D {
/* /*
@ -480,7 +482,11 @@ void CPSValueGradientFunc<T>::setValuesUnpacked(const T *valueTab, uint32 numVal
_MaxValue = _MinValue = valueTab[0]; _MaxValue = _MinValue = valueTab[0];
_NbValues = (numValues - 1) * nbStages; _NbValues = (numValues - 1) * nbStages;
_Tab.resize(_NbValues + 1); _Tab.resize(_NbValues + 1);
#ifdef NL_COMP_VC14
std::copy(valueTab, valueTab + _NbValues + 1, stdext::make_checked_array_iterator(&_Tab[0], _Tab.size()));
#else
std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]); std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]);
#endif
} }

View file

@ -336,7 +336,7 @@ protected:
* should not be called directly. Call CPSLocated::resize instead * should not be called directly. Call CPSLocated::resize instead
*/ */
virtual void resize(uint32 size); virtual void resize(uint32 size);
virtual void bounceOccured(uint32 index, TAnimationTime timeToNextSimStep); virtual void bounceOccurred(uint32 index, TAnimationTime timeToNextSimStep);
void updateMaxCountVect(); void updateMaxCountVect();

View file

@ -66,14 +66,14 @@ class CParticleSystem;
/// This structure helps to perform the collision step, by telling which collisionner is the nearest if there are several candidate /// This structure helps to perform the collision step, by telling which collisionner is the nearest if there are several candidate
/// a distance of -1 indicates that no collisions occured /// a distance of -1 indicates that no collisions occurred
struct CPSCollisionInfo struct CPSCollisionInfo
{ {
CPSCollisionInfo *Next; CPSCollisionInfo *Next;
float Dist; // Distance to the nearest collider, or -1 if not collision occured float Dist; // Distance to the nearest collider, or -1 if not collision occurred
NLMISC::CVector NewPos; NLMISC::CVector NewPos;
NLMISC::CVector NewSpeed; // The speed of particle after a collision occured. After the updated of collision it is swapped with the post-collision speed NLMISC::CVector NewSpeed; // The speed of particle after a collision occurred. After the updated of collision it is swapped with the post-collision speed
CPSZone *CollisionZone; // The zone on which the bounce occured, can be useful to check the behaviour in case of collision CPSZone *CollisionZone; // The zone on which the bounce occurred, can be useful to check the behaviour in case of collision
uint32 Index; uint32 Index;
CPSCollisionInfo() CPSCollisionInfo()
{ {
@ -906,10 +906,10 @@ protected:
*/ */
virtual void resize(uint32 size) = 0; virtual void resize(uint32 size) = 0;
/** a bounce occured, so some action could be done. The default behaviour does nothing /** a bounce occurred, so some action could be done. The default behaviour does nothing
* \param index the index of the element that bounced * \param index the index of the element that bounced
*/ */
virtual void bounceOccured(uint32 /* index */, TAnimationTime /* timeToNextsimStep */) {} virtual void bounceOccurred(uint32 /* index */, TAnimationTime /* timeToNextsimStep */) {}
/** show an drawing to represent the object, and in red if it is selected /** show an drawing to represent the object, and in red if it is selected
* \param tab : a table of 2 * nbSeg vector. only the x and y coordinates are used * \param tab : a table of 2 * nbSeg vector. only the x and y coordinates are used

View file

@ -120,7 +120,7 @@ protected:
/** /**
* This set speed of a located so that it looks like bouncing on a surface * This set speed of a located so that it looks like bouncing on a surface
* \param locatedIndex the index * \param locatedIndex the index
* \param bouncePoint the position where the collision occured * \param bouncePoint the position where the collision occurred
* \param surfNormal the normal of the surface at the collision point (this must be a unit vector) * \param surfNormal the normal of the surface at the collision point (this must be a unit vector)
* \elasticity 1 = full bounce, 0 = no bounce (contact) * \elasticity 1 = full bounce, 0 = no bounce (contact)
* \ellapsedTime the time ellapsed * \ellapsedTime the time ellapsed

View file

@ -79,7 +79,7 @@ public:
/** Set the userPos (relative to the height map coordinates). This is needed because a height map can't be used with large surface (such as a sea). /** Set the userPos (relative to the height map coordinates). This is needed because a height map can't be used with large surface (such as a sea).
* As a consequence, the height map is only valid below the user (e.g from user.x - 0.5 * size to user.x + 0.5 *size). * As a consequence, the height map is only valid below the user (e.g from user.x - 0.5 * size to user.x + 0.5 *size).
* When setPos is called, and if a move has occured, new area of the height field are set to 0 * When setPos is called, and if a move has occurred, new area of the height field are set to 0
* The pos set will be taken in account when buffers have been swapped (e.g when the propagation time as ellapsed) * The pos set will be taken in account when buffers have been swapped (e.g when the propagation time as ellapsed)
*/ */
void setUserPos(sint x, sint y); void setUserPos(sint x, sint y);

View file

@ -90,7 +90,7 @@ namespace NLGUI
virtual std::string luaWhat() const throw() {return NLMISC::toString("LUAError: %s", what());} virtual std::string luaWhat() const throw() {return NLMISC::toString("LUAError: %s", what());}
}; };
// A parse error occured // A parse error occurred
class ELuaParseError : public ELuaError class ELuaParseError : public ELuaError
{ {
public: public:
@ -117,7 +117,7 @@ namespace NLGUI
std::string _Reason; std::string _Reason;
}; };
// A execution error occured // A execution error occurred
class ELuaExecuteError : public ELuaError class ELuaExecuteError : public ELuaError
{ {
public: public:
@ -128,7 +128,7 @@ namespace NLGUI
virtual std::string luaWhat() const throw() {return NLMISC::toString("ELuaExecuteError: %s", what());} virtual std::string luaWhat() const throw() {return NLMISC::toString("ELuaExecuteError: %s", what());}
}; };
// A bad cast occured when using lua_checkcast // A bad cast occurred when using lua_checkcast
class ELuaBadCast : public ELuaError class ELuaBadCast : public ELuaError
{ {
public: public:

View file

@ -49,13 +49,13 @@ public:
* This file will try to open the file ligo class description file (XML) using the LigoClass as file name. * This file will try to open the file ligo class description file (XML) using the LigoClass as file name.
* It will try first to load directly the file and then to lookup the file in NLMISC::CPath. * It will try first to load directly the file and then to lookup the file in NLMISC::CPath.
*/ */
bool readConfigFile (const char *fileName, bool parsePrimitiveComboContent); bool readConfigFile (const std::string &fileName, bool parsePrimitiveComboContent);
/** /**
* This file will read the file ligo class description file (XML) using the LigoClass as file name. * This file will read the file ligo class description file (XML) using the LigoClass as file name.
* It will try first to load directly the file and then to lookup the file in NLMISC::CPath. * It will try first to load directly the file and then to lookup the file in NLMISC::CPath.
*/ */
bool readPrimitiveClass (const char *fileName, bool parsePrimitiveComboContent); bool readPrimitiveClass (const std::string &fileName, bool parsePrimitiveComboContent);
bool reloadIndexFile(const std::string &indexFileName = std::string()); bool reloadIndexFile(const std::string &indexFileName = std::string());
@ -100,7 +100,7 @@ public:
/// Build a standard human readable alias string /// Build a standard human readable alias string
std::string aliasToString(uint32 fullAlias); std::string aliasToString(uint32 fullAlias);
/// Read a standard human readable alias string /// Read a standard human readable alias string
uint32 aliasFromString(std::string fullAlias); uint32 aliasFromString(const std::string &fullAlias);
// Get a primitive class // Get a primitive class

View file

@ -286,6 +286,15 @@ inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(
#define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8()) #define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8())
#define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) #define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str())
// macros helper to convert UTF-8 std::string and TCHAR*
#ifdef _UNICODE
#define tStrToUtf8(str) (ucstring((ucchar*)(LPCWSTR)str).toUtf8())
#define utf8ToTStr(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str())
#else
#define tStrToUtf8(str) ((LPCSTR)str)
#define utf8ToTStr(str) (str.c_str())
#endif
// wrapper for fopen to be able to open files with an UTF-8 filename // wrapper for fopen to be able to open files with an UTF-8 filename
FILE* nlfopen(const std::string &filename, const std::string &mode); FILE* nlfopen(const std::string &filename, const std::string &mode);

View file

@ -46,7 +46,7 @@ public:
double getSamplingPeriod() const { return _SamplingPeriod; } double getSamplingPeriod() const { return _SamplingPeriod; }
// Reset smoother. The next returned position will be the exact position of mouse (no smoothing with previous position is done) // Reset smoother. The next returned position will be the exact position of mouse (no smoothing with previous position is done)
void reset(); void reset();
// \return trueif no sampling has occured since last resetor construction // \return trueif no sampling has occurred since last resetor construction
bool isReseted() const { return !_Init; } bool isReseted() const { return !_Init; }
// Sample pos, and return smoothed position // Sample pos, and return smoothed position
CVector2f samplePos(const CVector2f &wantedPos, double date); CVector2f samplePos(const CVector2f &wantedPos, double date);

View file

@ -29,7 +29,7 @@ struct CHashKey
CHashKey (const unsigned char Message_Digest[20]) CHashKey (const unsigned char Message_Digest[20])
{ {
HashKeyString = ""; HashKeyString.clear();
for(sint i = 0; i < 20 ; ++i) for(sint i = 0; i < 20 ; ++i)
{ {
HashKeyString += Message_Digest[i]; HashKeyString += Message_Digest[i];
@ -45,7 +45,7 @@ struct CHashKey
} }
else if (str.size() == 40) else if (str.size() == 40)
{ {
HashKeyString = ""; HashKeyString.clear();
for(uint i = 0; i < str.size(); i+=2) for(uint i = 0; i < str.size(); i+=2)
{ {
uint8 val; uint8 val;

View file

@ -81,7 +81,7 @@ public:
} }
//nldebug("active, leave sleep, test assert"); //nldebug("active, leave sleep, test assert");
// If this assert occured, it means that a checked part of the code was // If this assert occurred, it means that a checked part of the code was
// to slow and then I decided to assert to display the problem. // to slow and then I decided to assert to display the problem.
nlassert(!(_Control==ACTIVE && _Counter==lastCounter)); nlassert(!(_Control==ACTIVE && _Counter==lastCounter));
} }

View file

@ -159,7 +159,7 @@ public:
/** Force to send data pending in the send queue now. If all the data could not be sent immediately, /** Force to send data pending in the send queue now. If all the data could not be sent immediately,
* the returned nbBytesRemaining value is non-zero. * the returned nbBytesRemaining value is non-zero.
* \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt.
* \returns False if an error has occured (e.g. the remote host is disconnected). * \returns False if an error has occurred (e.g. the remote host is disconnected).
* To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString()
*/ */
bool flush( uint *nbBytesRemaining=NULL ) { return _BufSock->flush( nbBytesRemaining ); } bool flush( uint *nbBytesRemaining=NULL ) { return _BufSock->flush( nbBytesRemaining ); }

View file

@ -235,7 +235,7 @@ public:
* the returned nbBytesRemaining value is non-zero. * the returned nbBytesRemaining value is non-zero.
* \param destid The identifier of the destination connection. * \param destid The identifier of the destination connection.
* \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt.
* \returns False if an error has occured (e.g. the remote host is disconnected). * \returns False if an error has occurred (e.g. the remote host is disconnected).
* To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString()
*/ */
bool flush( TSockId destid, uint *nbBytesRemaining=NULL ); bool flush( TSockId destid, uint *nbBytesRemaining=NULL );

View file

@ -84,7 +84,7 @@ protected:
///@name Sending data ///@name Sending data
//@{ //@{
/// Update the network sending (call this method evenly). Returns false if an error occured. /// Update the network sending (call this method evenly). Returns false if an error occurred.
bool update(); bool update();
/** Sets the time flush trigger (in millisecond). When this time is elapsed, /** Sets the time flush trigger (in millisecond). When this time is elapsed,
@ -101,7 +101,7 @@ protected:
* (see CNonBlockingBufSock), if all the data could not be sent immediately, * (see CNonBlockingBufSock), if all the data could not be sent immediately,
* the returned nbBytesRemaining value is non-zero. * the returned nbBytesRemaining value is non-zero.
* \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt.
* \returns False if an error has occured (e.g. the remote host is disconnected). * \returns False if an error has occurred (e.g. the remote host is disconnected).
* To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString()
*/ */
bool flush( uint *nbBytesRemaining=NULL ); bool flush( uint *nbBytesRemaining=NULL );
@ -170,7 +170,7 @@ protected:
} }
/** Pushes a buffer to the send queue and update, /** Pushes a buffer to the send queue and update,
* or returns false if the socket is not physically connected the or an error occured during sending * or returns false if the socket is not physically connected the or an error occurred during sending
*/ */
bool pushBuffer( const NLMISC::CMemStream& buffer ) bool pushBuffer( const NLMISC::CMemStream& buffer )
{ {

View file

@ -553,7 +553,7 @@ static void cbPacsAnswer (CMessage &msgin, TSockId from, CCallbackNetBase &netba
client->getPositionSpeedCallback (id, position, speed); client->getPositionSpeedCallback (id, position, speed);
} }
else else
NLMISC::nlError ("Pacs client: unkown sub message string"); NLMISC::nlError ("Pacs client: unknown sub message string");
// Next message ? // Next message ?
msgin.serial (again); msgin.serial (again);

View file

@ -121,7 +121,7 @@ public:
/// Releases the network engine /// Releases the network engine
static void releaseNetwork(); static void releaseNetwork();
/** Returns the code of the last error that has occured. /** Returns the code of the last error that has occurred.
* Note: This code is platform-dependant. On Unix, it is errno; on Windows it is the Winsock error code. * Note: This code is platform-dependant. On Unix, it is errno; on Windows it is the Winsock error code.
* See also errorString() * See also errorString()
*/ */

View file

@ -52,7 +52,7 @@ public:
static const char *getStringUniTime (NLMISC::TTime ut); static const char *getStringUniTime (NLMISC::TTime ut);
/** You need to call this function before calling getUniTime or an assert will occured. /** You need to call this function before calling getUniTime or an assert will occurred.
* This function will connect to the time service and synchronize your computer. * This function will connect to the time service and synchronize your computer.
* This function assumes that all services run on server that are time synchronized with NTP for example. * This function assumes that all services run on server that are time synchronized with NTP for example.
* If addr is NULL, the function will connect to the Time Service via the Naming Service. In this case, * If addr is NULL, the function will connect to the Time Service via the Naming Service. In this case,
@ -87,11 +87,11 @@ public:
*/ */
static void simulate() { nlstop; _Simulate = true; } static void simulate() { nlstop; _Simulate = true; }
static bool Sync; // true if the synchronization occured static bool Sync; // true if the synchronization occurred
private: private:
static NLMISC::TTime _SyncUniTime; // time in millisecond when the universal time received static NLMISC::TTime _SyncUniTime; // time in millisecond when the universal time received
static NLMISC::TTime _SyncLocalTime; // time in millisecond when the syncro with universal time occured static NLMISC::TTime _SyncLocalTime; // time in millisecond when the syncro with universal time occurred
// If true, do not synchronize // If true, do not synchronize
static bool _Simulate; static bool _Simulate;

View file

@ -282,7 +282,7 @@ private:
// Free world image pointers // Free world image pointers
void freeWorldImage (CPrimitiveWorldImage *worldImage); void freeWorldImage (CPrimitiveWorldImage *worldImage);
// Called by CMovePrimitive when a change occured on the primitive BB // Called by CMovePrimitive when a change occurred on the primitive BB
void changed (CMovePrimitive* primitive, uint8 worldImage); void changed (CMovePrimitive* primitive, uint8 worldImage);
// Remove the collisionable primitive from the modified list // Remove the collisionable primitive from the modified list

View file

@ -319,7 +319,7 @@ void CCluster::serial (NLMISC::IStream&f)
// write the env fx name // write the env fx name
std::string envFxName = CStringMapper::unmap(_EnvironmentFxId); std::string envFxName = CStringMapper::unmap(_EnvironmentFxId);
if (envFxName == "no fx") if (envFxName == "no fx")
envFxName = ""; envFxName.clear();
f.serial(envFxName); f.serial(envFxName);
} }

View file

@ -1265,7 +1265,7 @@ bool CDriverD3D::init (uintptr_t windowIcon, emptyProc exitFunc)
if (error != ERROR_CLASS_ALREADY_EXISTS) if (error != ERROR_CLASS_ALREADY_EXISTS)
{ {
nlwarning("CDriverD3D::init: Can't register window class %s (error code %i)", _WindowClass.c_str(), (sint)error); nlwarning("CDriverD3D::init: Can't register window class %s (error code %i)", _WindowClass.c_str(), (sint)error);
_WindowClass = ""; _WindowClass.clear();
return false; return false;
} }
} }

View file

@ -568,7 +568,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
if (_PixelProgram) if (_PixelProgram)
{ {
#ifdef NL_DEBUG_D3D #ifdef NL_DEBUG_D3D
// Check, should not occured // Check, should not occur
nlassertex (_PixelShader, ("STOP : no pixel shader available. Can't render this material.")); nlassertex (_PixelShader, ("STOP : no pixel shader available. Can't render this material."));
#endif // NL_DEBUG_D3D #endif // NL_DEBUG_D3D

View file

@ -62,7 +62,7 @@ void CD3DShaderFX::setName (const char *name)
bool CD3DShaderFX::loadShaderFile (const char *filename) bool CD3DShaderFX::loadShaderFile (const char *filename)
{ {
_Text = ""; _Text.clear();
// Lookup // Lookup
string _filename = NLMISC::CPath::lookup(filename, false, true, true); string _filename = NLMISC::CPath::lookup(filename, false, true, true);
if (!_filename.empty()) if (!_filename.empty())

View file

@ -270,7 +270,7 @@ uint getPixelFormatSize (D3DFORMAT destFormat)
case D3DFMT_DXT3: bits=8; break; case D3DFMT_DXT3: bits=8; break;
case D3DFMT_DXT4: bits=8; break; case D3DFMT_DXT4: bits=8; break;
case D3DFMT_DXT5: bits=8; break; case D3DFMT_DXT5: bits=8; break;
default: nlstop; break; // unkown pixel format default: nlstop; break; // unknown pixel format
} }
return bits; return bits;
} }

View file

@ -109,7 +109,7 @@ void dumpWriteMask(uint mask, std::string &out)
H_AUTO_D3D(dumpWriteMask) H_AUTO_D3D(dumpWriteMask)
if (mask == 0xf) if (mask == 0xf)
{ {
out = ""; out.clear();
return; return;
} }
out = "."; out = ".";
@ -126,7 +126,7 @@ void dumpSwizzle(const CVPSwizzle &swz, std::string &out)
H_AUTO_D3D(dumpSwizzle) H_AUTO_D3D(dumpSwizzle)
if (swz.isIdentity()) if (swz.isIdentity())
{ {
out = ""; out.clear();
return; return;
} }
out = "."; out = ".";

View file

@ -491,7 +491,7 @@ void CDriverGL::showCursor(bool b)
} }
else else
{ {
_CurrName = ""; _CurrName.clear();
} }
// update current hardware icon to avoid to have the plain arrow // update current hardware icon to avoid to have the plain arrow

View file

@ -1270,7 +1270,7 @@ static void ARBVertexProgramDumpWriteMask(uint mask, std::string &out)
H_AUTO_OGL(ARBVertexProgramDumpWriteMask) H_AUTO_OGL(ARBVertexProgramDumpWriteMask)
if (mask == 0xf) if (mask == 0xf)
{ {
out = ""; out.clear();
return; return;
} }
out = "."; out = ".";
@ -1286,7 +1286,7 @@ static void ARBVertexProgramDumpSwizzle(const CVPSwizzle &swz, std::string &out)
H_AUTO_OGL(ARBVertexProgramDumpSwizzle) H_AUTO_OGL(ARBVertexProgramDumpSwizzle)
if (swz.isIdentity()) if (swz.isIdentity())
{ {
out = ""; out.clear();
return; return;
} }
out = "."; out = ".";

View file

@ -626,7 +626,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server)
} }
case SelectionClear: case SelectionClear:
_SelectionOwned = false; _SelectionOwned = false;
_CopiedString = ""; _CopiedString.clear();
break; break;
case SelectionNotify: case SelectionNotify:
{ {

View file

@ -262,8 +262,8 @@ void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius, std::s
{ {
NL3D_HAUTO_LOAD_LANDSCAPE; NL3D_HAUTO_LOAD_LANDSCAPE;
zoneRemoved= ""; zoneRemoved.clear();
zoneAdded= ""; zoneAdded.clear();
CZoneManager::SZoneManagerWork Work; CZoneManager::SZoneManagerWork Work;
// Check if new zone must be added to landscape // Check if new zone must be added to landscape
if (_ZoneManager.isWorkComplete(Work)) if (_ZoneManager.isWorkComplete(Work))

View file

@ -1101,7 +1101,11 @@ bool CMeshGeom::retrieveTriangles(std::vector<uint32> &indices) const
else else
{ {
// std::copy will convert from 16 bits index to 32 bit index // std::copy will convert from 16 bits index to 32 bit index
std::copy((uint16 *) iba.getPtr(), ((uint16 *) iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx*3]); #ifdef NL_COMP_VC14
std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), stdext::make_checked_array_iterator(&indices[triIdx * 3], indices.size() - triIdx * 3));
#else
std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx * 3]);
#endif
} }
// next // next
triIdx+= pb.getNumIndexes()/3; triIdx+= pb.getNumIndexes()/3;

View file

@ -242,11 +242,11 @@ void CPortal::serial (NLMISC::IStream& f)
{ {
std::string occName = CStringMapper::unmap(_OcclusionModelId); std::string occName = CStringMapper::unmap(_OcclusionModelId);
if (occName == "no occlusion") if (occName == "no occlusion")
occName = ""; occName.clear();
f.serial(occName); f.serial(occName);
occName = CStringMapper::unmap(_OpenOcclusionModelId); occName = CStringMapper::unmap(_OpenOcclusionModelId);
if (occName == "no occlusion") if (occName == "no occlusion")
occName = ""; occName.clear();
f.serial(occName); f.serial(occName);
} }
} }

View file

@ -1901,9 +1901,9 @@ void CPSEmitter::resize(uint32 size)
} }
///========================================================================== ///==========================================================================
void CPSEmitter::bounceOccured(uint32 index, TAnimationTime timeToNextSimStep) void CPSEmitter::bounceOccurred(uint32 index, TAnimationTime timeToNextSimStep)
{ {
NL_PS_FUNC(CPSEmitter_bounceOccured) NL_PS_FUNC(CPSEmitter_bounceOccurred)
// TODO : avoid duplication with deleteElement // TODO : avoid duplication with deleteElement
if (_EmittedType && _EmissionType == CPSEmitter::onBounce) if (_EmittedType && _EmissionType == CPSEmitter::onBounce)
{ {
@ -2797,7 +2797,7 @@ void CPSEmitter::doEmitOnce(uint firstInstanceIndex)
startPos = _Owner->getParametricInfos()[k].Pos; startPos = _Owner->getParametricInfos()[k].Pos;
} }
float currTime = _Owner->getTime()[k]; float currTime = _Owner->getTime()[k];
_Owner->getTime()[k] = 0.f; // when emit occured, time was 0 _Owner->getTime()[k] = 0.f; // when emit occurred, time was 0
sint32 nbToGenerate = (sint32) (emitLOD * *numToEmitPtr); sint32 nbToGenerate = (sint32) (emitLOD * *numToEmitPtr);
if (nbToGenerate > 0) if (nbToGenerate > 0)
{ {
@ -2830,7 +2830,7 @@ void CPSEmitter::doEmitOnce(uint firstInstanceIndex)
startPos = _Owner->getParametricInfos()[k].Pos; startPos = _Owner->getParametricInfos()[k].Pos;
} }
float currTime = _Owner->getTime()[k]; float currTime = _Owner->getTime()[k];
_Owner->getTime()[k] = 0.f; // when emit occured, time was 0 _Owner->getTime()[k] = 0.f; // when emit occurred, time was 0
processEmitConsistent(startPos, k, nbToGenerate, _Owner->getAgeInSeconds(k) / CParticleSystem::RealEllapsedTimeRatio); processEmitConsistent(startPos, k, nbToGenerate, _Owner->getAgeInSeconds(k) / CParticleSystem::RealEllapsedTimeRatio);
// restore time & pos // restore time & pos
_Owner->getTime()[k] = currTime; _Owner->getTime()[k] = currTime;

View file

@ -1004,7 +1004,7 @@ void CPSLocated::postNewElement(const NLMISC::CVector &pos,
const CPSCollisionInfo &ci = _Collisions[indexInEmitter]; const CPSCollisionInfo &ci = _Collisions[indexInEmitter];
if (ci.Dist != -1.f) if (ci.Dist != -1.f)
{ {
// a collision occured, check time from collision to next time step // a collision occurred, check time from collision to next time step
if ((emitterLocated.getPos()[indexInEmitter] - ci.NewPos) * (pos - ci.NewPos) > 0.f) return; // discard emit that are farther than the collision if ((emitterLocated.getPos()[indexInEmitter] - ci.NewPos) * (pos - ci.NewPos) > 0.f) return; // discard emit that are farther than the collision
} }
} }
@ -1839,10 +1839,10 @@ void CPSLocated::updateCollisions()
{ {
_Pos[currCollision->Index] = currCollision->NewPos; _Pos[currCollision->Index] = currCollision->NewPos;
std::swap(_Speed[currCollision->Index], currCollision->NewSpeed); // keep speed because may be needed when removing particles std::swap(_Speed[currCollision->Index], currCollision->NewSpeed); // keep speed because may be needed when removing particles
// notify each located bindable that a bounce occured ... // notify each located bindable that a bounce occurred ...
for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it) for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
{ {
(*it)->bounceOccured(currCollision->Index, computeDateFromCollisionToNextSimStep(currCollision->Index, getAgeInSeconds(currCollision->Index))); (*it)->bounceOccurred(currCollision->Index, computeDateFromCollisionToNextSimStep(currCollision->Index, getAgeInSeconds(currCollision->Index)));
} }
if (currCollision->CollisionZone->getCollisionBehaviour() == CPSZone::destroy) if (currCollision->CollisionZone->getCollisionBehaviour() == CPSZone::destroy)
{ {
@ -1878,13 +1878,13 @@ void CPSLocated::updateCollisions()
// if particle is too old, check whether it died before the collision // if particle is too old, check whether it died before the collision
_Pos[currCollision->Index] = currCollision->NewPos; _Pos[currCollision->Index] = currCollision->NewPos;
std::swap(_Speed[currCollision->Index], currCollision->NewSpeed); std::swap(_Speed[currCollision->Index], currCollision->NewSpeed);
// notify each located bindable that a bounce occured ... // notify each located bindable that a bounce occurred ...
if (!_LocatedBoundCont.empty()) if (!_LocatedBoundCont.empty())
{ {
TAnimationTime timeFromcollisionToNextSimStep = computeDateFromCollisionToNextSimStep(currCollision->Index, getAgeInSeconds(currCollision->Index)); TAnimationTime timeFromcollisionToNextSimStep = computeDateFromCollisionToNextSimStep(currCollision->Index, getAgeInSeconds(currCollision->Index));
for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it) for (TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it)
{ {
(*it)->bounceOccured(currCollision->Index, timeFromcollisionToNextSimStep); (*it)->bounceOccurred(currCollision->Index, timeFromcollisionToNextSimStep);
} }
} }
if (currCollision->CollisionZone->getCollisionBehaviour() == CPSZone::destroy) if (currCollision->CollisionZone->getCollisionBehaviour() == CPSZone::destroy)
@ -2190,7 +2190,7 @@ void CPSLocated::removeOldParticles()
TAnimationTime timeUntilNextSimStep; TAnimationTime timeUntilNextSimStep;
if (_Collisions[*it].Dist == -1.f) if (_Collisions[*it].Dist == -1.f)
{ {
// no collision occured // no collision occurred
if (_Time[*it] > 1.f) if (_Time[*it] > 1.f)
{ {
@ -2213,18 +2213,18 @@ void CPSLocated::removeOldParticles()
} }
else else
{ {
// a collision occured before particle died, so pos is already good // a collision occurred before particle died, so pos is already good
if (_LifeScheme) if (_LifeScheme)
{ {
timeUntilNextSimStep = computeDateFromCollisionToNextSimStep(*it, _Time[*it] / _TimeIncrement[*it]); timeUntilNextSimStep = computeDateFromCollisionToNextSimStep(*it, _Time[*it] / _TimeIncrement[*it]);
// compute age of particle when collision occured // compute age of particle when collision occurred
_Time[*it] -= timeUntilNextSimStep * _TimeIncrement[*it]; _Time[*it] -= timeUntilNextSimStep * _TimeIncrement[*it];
NLMISC::clamp(_Time[*it], 0.f, 1.f); // avoid imprecisions NLMISC::clamp(_Time[*it], 0.f, 1.f); // avoid imprecisions
} }
else else
{ {
timeUntilNextSimStep = computeDateFromCollisionToNextSimStep(*it, _Time[*it] * _InitialLife); timeUntilNextSimStep = computeDateFromCollisionToNextSimStep(*it, _Time[*it] * _InitialLife);
// compute age of particle when collision occured // compute age of particle when collision occurred
_Time[*it] -= timeUntilNextSimStep / (_InitialLife == 0.f ? 1.f : _InitialLife); _Time[*it] -= timeUntilNextSimStep / (_InitialLife == 0.f ? 1.f : _InitialLife);
NLMISC::clamp(_Time[*it], 0.f, 1.f); // avoid imprecisions NLMISC::clamp(_Time[*it], 0.f, 1.f); // avoid imprecisions
} }

View file

@ -1113,6 +1113,9 @@ void CPSConstraintMesh::getShapesNames(std::string *shapesNames) const
{ {
const_cast<CPSConstraintMesh *>(this)->update(); const_cast<CPSConstraintMesh *>(this)->update();
} }
#ifdef NL_COMP_VC14
std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), stdext::make_unchecked_array_iterator(shapesNames));
#else
std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), shapesNames); std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), shapesNames);
} }

View file

@ -1463,7 +1463,11 @@ void CPSRibbon::setShape(const CVector *shape, uint32 nbPointsInShape, bool brac
///================================================================================================================== ///==================================================================================================================
void CPSRibbon::getShape(CVector *shape) const void CPSRibbon::getShape(CVector *shape) const
{ {
NL_PS_FUNC(CPSRibbon_getShape) NL_PS_FUNC(CPSRibbon_getShape);
#ifdef NL_COMP_VC14
std::copy(_Shape.begin(), _Shape.end(), stdext::make_unchecked_array_iterator(shape));
#else
std::copy(_Shape.begin(), _Shape.end(), shape); std::copy(_Shape.begin(), _Shape.end(), shape);
} }

View file

@ -34,6 +34,7 @@
#include <functional> #include <functional>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
#include <iterator>
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"

View file

@ -2530,7 +2530,7 @@ void CTessFace::refreshTesselationGeometry()
// *************************************************************************** // ***************************************************************************
bool CTessFace::updateBindEdge(CTessFace *&edgeFace, bool &splitWanted) bool CTessFace::updateBindEdge(CTessFace *&edgeFace, bool &splitWanted)
{ {
// Return true, when the bind should be Ok, or if a split has occured. // Return true, when the bind should be Ok, or if a split has occurred.
// Return false only if pointers are updated, without splits. // Return false only if pointers are updated, without splits.
if(edgeFace==NULL) if(edgeFace==NULL)

View file

@ -134,7 +134,7 @@ void CTileBank::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
nlassert (f.isReading()); nlassert (f.isReading());
// Reset _AbsPath // Reset _AbsPath
_AbsPath=""; _AbsPath.clear();
// Remove diffuse and additive in transition // Remove diffuse and additive in transition
uint tileCount=(uint)getTileCount (); uint tileCount=(uint)getTileCount ();
@ -782,7 +782,7 @@ void CTile::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
_Flags=0; _Flags=0;
// Initialize alpha name // Initialize alpha name
_BitmapName[alpha]=""; _BitmapName[alpha].clear();
// Read free flag // Read free flag
f.serial (tmp); f.serial (tmp);
@ -804,7 +804,7 @@ void CTile::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
// *************************************************************************** // ***************************************************************************
void CTile::clearTile (CTile::TBitmap type) void CTile::clearTile (CTile::TBitmap type)
{ {
_BitmapName[type]=""; _BitmapName[type].clear();
} }
@ -1521,7 +1521,7 @@ void CTileSet::setDisplacement (TDisplacement displacement, const std::string& f
// *************************************************************************** // ***************************************************************************
void CTileSet::cleanUnusedData () void CTileSet::cleanUnusedData ()
{ {
_Name=""; _Name.clear();
_ChildName.clear(); _ChildName.clear();
_Border128[0].reset (); _Border128[0].reset ();
_Border128[1].reset (); _Border128[1].reset ();
@ -1853,14 +1853,12 @@ CTileNoise::CTileNoise ()
{ {
// Not loaded // Not loaded
_TileNoiseMap=NULL; _TileNoiseMap=NULL;
_FileName="";
} }
// *************************************************************************** // ***************************************************************************
CTileNoise::CTileNoise (const CTileNoise &src) CTileNoise::CTileNoise (const CTileNoise &src)
{ {
// Default ctor // Default ctor
_TileNoiseMap=NULL; _TileNoiseMap=NULL;
_FileName="";
// Copy // Copy
*this=src; *this=src;
@ -1932,7 +1930,7 @@ void CTileNoise::reset()
} }
// Erase filename // Erase filename
_FileName=""; _FileName.clear();
} }
// *************************************************************************** // ***************************************************************************

View file

@ -885,7 +885,7 @@ void CVertexBuffer::serialHeader(NLMISC::IStream &f)
if(f.isReading()) if(f.isReading())
{ {
_PreferredMemory = RAMPreferred; _PreferredMemory = RAMPreferred;
_Name = ""; _Name.clear();
} }
} }
} }

View file

@ -1110,7 +1110,7 @@ static void dumpWriteMask(uint mask, std::string &out)
{ {
if (mask == 0xf) if (mask == 0xf)
{ {
out = ""; out.clear();
return; return;
} }
out = "."; out = ".";
@ -1125,7 +1125,7 @@ static void dumpSwizzle(const CVPSwizzle &swz, std::string &out)
{ {
if (swz.isIdentity()) if (swz.isIdentity())
{ {
out = ""; out.clear();
return; return;
} }
out = "."; out = ".";

View file

@ -305,7 +305,11 @@ void CWaterHeightMap::makeCpy(uint buffer, uint dX, uint dY, uint sX, uint sY,
{ {
if (dest < src) if (dest < src)
{ {
#ifdef NL_COMP_VC14
std::copy(src, src + width, stdext::make_unchecked_array_iterator(dest));
#else
std::copy(src, src + width, dest); std::copy(src, src + width, dest);
#endif
} }
else else
{ {

View file

@ -170,7 +170,7 @@ bool CZoneManager::isWorkComplete (CZoneManager::SZoneManagerWork &rWork)
rWork.NameZoneAdded = ite->ZoneToAddName; rWork.NameZoneAdded = ite->ZoneToAddName;
rWork.ZoneRemoved = false; rWork.ZoneRemoved = false;
rWork.IdZoneToRemove = 0; rWork.IdZoneToRemove = 0;
rWork.NameZoneRemoved = ""; rWork.NameZoneRemoved.clear();
rWork.Zone = const_cast<CZone*>(ite->Zone); rWork.Zone = const_cast<CZone*>(ite->Zone);
_LoadedZones.push_back (ite->ZoneToAddId); _LoadedZones.push_back (ite->ZoneToAddId);
@ -187,7 +187,7 @@ bool CZoneManager::isWorkComplete (CZoneManager::SZoneManagerWork &rWork)
{ {
_RemovingZone = false; _RemovingZone = false;
rWork.ZoneAdded = false; rWork.ZoneAdded = false;
rWork.NameZoneAdded = ""; rWork.NameZoneAdded.clear();
rWork.ZoneRemoved = true; rWork.ZoneRemoved = true;
rWork.IdZoneToRemove = _IdZoneToRemove; rWork.IdZoneToRemove = _IdZoneToRemove;
rWork.NameZoneRemoved = getZoneNameFromId(_IdZoneToRemove); rWork.NameZoneRemoved = getZoneNameFromId(_IdZoneToRemove);

View file

@ -498,7 +498,7 @@ void CFormDfn::CEntry::setDfn (CFormLoader &loader, const char *filename)
void CFormDfn::CEntry::setDfnPointer () void CFormDfn::CEntry::setDfnPointer ()
{ {
TypeElement = EntryVirtualDfn; TypeElement = EntryVirtualDfn;
Filename = ""; Filename.clear();
Type = NULL; Type = NULL;
Dfn = NULL; Dfn = NULL;
} }

View file

@ -1512,7 +1512,7 @@ const char* CFormElm::tokenize (const char *name, string &str, uint &/* errorInd
return name+1; return name+1;
} }
str = ""; str.clear();
while ( (*name != '.') && (*name != '[') && (*name != ']') && (*name != 0) ) while ( (*name != '.') && (*name != '[') && (*name != ']') && (*name != 0) )
{ {
// Add a char // Add a char
@ -2066,7 +2066,7 @@ void CFormElmStruct::getFormName (std::string &result, const CFormElm *child) co
// Reset the result // Reset the result
if (child == NULL) if (child == NULL)
{ {
result = ""; result.clear();
result.reserve (50); result.reserve (50);
} }
@ -2723,7 +2723,7 @@ void CFormElmArray::getFormName (std::string &result, const CFormElm *child) con
// Reset the result // Reset the result
if (child == NULL) if (child == NULL)
{ {
result = ""; result.clear();
result.reserve (50); result.reserve (50);
} }
@ -3067,7 +3067,7 @@ void CFormElmAtom::getFormName (std::string &result, const CFormElm *child) cons
{ {
// Must be NULL // Must be NULL
nlassert (child == NULL); nlassert (child == NULL);
result = ""; result.clear();
result.reserve (50); result.reserve (50);
// Get parent form name // Get parent form name

View file

@ -159,7 +159,7 @@ void CFileHeader::read (xmlNodePtr root)
} }
// Look for the comment node // Look for the comment node
Comments = ""; Comments.clear();
xmlNodePtr node = CIXml::getFirstChildNode (root, "COMMENTS"); xmlNodePtr node = CIXml::getFirstChildNode (root, "COMMENTS");
if (node) if (node)
{ {
@ -181,7 +181,7 @@ void CFileHeader::read (xmlNodePtr root)
} }
// Look for the log node // Look for the log node
Log = ""; Log.clear();
node = CIXml::getFirstChildNode (root, "LOG"); node = CIXml::getFirstChildNode (root, "LOG");
if (node) if (node)
{ {

View file

@ -185,7 +185,7 @@ void CType::read (xmlNodePtr root)
xmlFree ((void*)value); xmlFree ((void*)value);
} }
else else
Default = ""; Default.clear();
// Read Min // Read Min
value = (const char*)xmlGetProp (root, (xmlChar*)"Min"); value = (const char*)xmlGetProp (root, (xmlChar*)"Min");
@ -197,7 +197,7 @@ void CType::read (xmlNodePtr root)
xmlFree ((void*)value); xmlFree ((void*)value);
} }
else else
Min = ""; Min.clear();
// Read Max // Read Max
value = (const char*)xmlGetProp (root, (xmlChar*)"Max"); value = (const char*)xmlGetProp (root, (xmlChar*)"Max");
@ -209,7 +209,7 @@ void CType::read (xmlNodePtr root)
xmlFree ((void*)value); xmlFree ((void*)value);
} }
else else
Max = ""; Max.clear();
// Read Increment // Read Increment
value = (const char*)xmlGetProp (root, (xmlChar*)"Increment"); value = (const char*)xmlGetProp (root, (xmlChar*)"Increment");
@ -221,7 +221,7 @@ void CType::read (xmlNodePtr root)
xmlFree ((void*)value); xmlFree ((void*)value);
} }
else else
Increment = ""; Increment.clear();
// Read the definitions // Read the definitions
uint childrenCount = CIXml::countChildren (root, "DEFINITION"); uint childrenCount = CIXml::countChildren (root, "DEFINITION");
@ -465,7 +465,7 @@ uint getNextToken (const char *startString, string &token, uint &offset)
offset += 9; offset += 9;
return NL_TOKEN_NAME; return NL_TOKEN_NAME;
} }
token = ""; token.clear();
while (startString[offset]) while (startString[offset])
{ {
if (startString[offset] == '\\') if (startString[offset] == '\\')

View file

@ -1768,7 +1768,7 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupEditBox::clearAllEditBox() void CGroupEditBox::clearAllEditBox()
{ {
_InputString = ""; _InputString.clear();
_CursorPos = 0; _CursorPos = 0;
_CursorAtPreviousLineEnd = false; _CursorAtPreviousLineEnd = false;
if (!_ViewText) return; if (!_ViewText) return;

View file

@ -2089,10 +2089,10 @@ namespace NLGUI
templateName = value[MY_HTML_TEXTAREA_Z_INPUT_TMPL]; templateName = value[MY_HTML_TEXTAREA_Z_INPUT_TMPL];
// Get the string name // Get the string name
_TextAreaName = ""; _TextAreaName.clear();
_TextAreaRow = 1; _TextAreaRow = 1;
_TextAreaCols = 10; _TextAreaCols = 10;
_TextAreaContent = ""; _TextAreaContent.clear();
_TextAreaMaxLength = 1024; _TextAreaMaxLength = 1024;
if (present[MY_HTML_TEXTAREA_NAME] && value[MY_HTML_TEXTAREA_NAME]) if (present[MY_HTML_TEXTAREA_NAME] && value[MY_HTML_TEXTAREA_NAME])
_TextAreaName = value[MY_HTML_TEXTAREA_NAME]; _TextAreaName = value[MY_HTML_TEXTAREA_NAME];
@ -2112,7 +2112,7 @@ namespace NLGUI
if(!_TitlePrefix.empty()) if(!_TitlePrefix.empty())
_TitleString = _TitlePrefix + " - "; _TitleString = _TitlePrefix + " - ";
else else
_TitleString = ""; _TitleString.clear();
_Title = true; _Title = true;
} }
break; break;
@ -2144,10 +2144,10 @@ namespace NLGUI
endParagraph(); endParagraph();
break; break;
case HTML_OBJECT: case HTML_OBJECT:
_ObjectType = ""; _ObjectType.clear();
_ObjectData = ""; _ObjectData.clear();
_ObjectMD5Sum = ""; _ObjectMD5Sum.clear();
_ObjectAction = ""; _ObjectAction.clear();
if (present[HTML_OBJECT_TYPE] && value[HTML_OBJECT_TYPE]) if (present[HTML_OBJECT_TYPE] && value[HTML_OBJECT_TYPE])
_ObjectType = value[HTML_OBJECT_TYPE]; _ObjectType = value[HTML_OBJECT_TYPE];
if (present[HTML_OBJECT_DATA] && value[HTML_OBJECT_DATA]) if (present[HTML_OBJECT_DATA] && value[HTML_OBJECT_DATA])
@ -2369,7 +2369,7 @@ namespace NLGUI
{ {
endParagraph(); endParagraph();
} }
_DivName = ""; _DivName.clear();
popIfNotEmpty (_Divs); popIfNotEmpty (_Divs);
popIfNotEmpty (_BlockLevelElement); popIfNotEmpty (_BlockLevelElement);
break; break;
@ -2614,7 +2614,7 @@ namespace NLGUI
{ {
CLuaManager::getInstance().executeLuaScript("\nlocal __ALLREADYDL__=true\n"+_ObjectScript, true); CLuaManager::getInstance().executeLuaScript("\nlocal __ALLREADYDL__=true\n"+_ObjectScript, true);
} }
_ObjectScript = ""; _ObjectScript.clear();
} }
} }
_Object = false; _Object = false;
@ -2632,7 +2632,7 @@ namespace NLGUI
{ {
// we receive an embeded lua script // we receive an embeded lua script
_ParsingLua = _TrustedDomain; // Only parse lua if TrustedDomain _ParsingLua = _TrustedDomain; // Only parse lua if TrustedDomain
_LuaScript = ""; _LuaScript.clear();
} }
} }
@ -2687,8 +2687,6 @@ namespace NLGUI
_LI = false; _LI = false;
_SelectOption = false; _SelectOption = false;
_GroupListAdaptor = NULL; _GroupListAdaptor = NULL;
_DocumentUrl = "";
_DocumentDomain = "";
_UrlFragment.clear(); _UrlFragment.clear();
_RefreshUrl.clear(); _RefreshUrl.clear();
_NextRefreshTime = 0.0; _NextRefreshTime = 0.0;
@ -2741,7 +2739,6 @@ namespace NLGUI
DefaultCheckBoxBitmapOver = "checkbox_over.tga"; DefaultCheckBoxBitmapOver = "checkbox_over.tga";
DefaultRadioButtonBitmapNormal = "w_radiobutton.png"; DefaultRadioButtonBitmapNormal = "w_radiobutton.png";
DefaultRadioButtonBitmapPushed = "w_radiobutton_pushed.png"; DefaultRadioButtonBitmapPushed = "w_radiobutton_pushed.png";
DefaultRadioButtonBitmapOver = "";
DefaultBackgroundBitmapView = "bg"; DefaultBackgroundBitmapView = "bg";
clearContext(); clearContext();
@ -5825,7 +5822,7 @@ namespace NLGUI
if (it->second == "monospace") if (it->second == "monospace")
style.FontFamily = "monospace"; style.FontFamily = "monospace";
else else
style.FontFamily = ""; style.FontFamily.clear();
} }
else else
if (it->first == "font-weight") if (it->first == "font-weight")

View file

@ -363,7 +363,7 @@ namespace NLGUI
uint32 i; uint32 i;
if( fromString( value, i ) ) if( fromString( value, i ) )
_TextId = i; _TextId = i;
_HardText = ""; _HardText.clear();
onTextChanged(); onTextChanged();
return; return;
} }

View file

@ -266,7 +266,7 @@ namespace NLGUI
else else
if (stricmp((char*)cur->name, "action") == 0) if (stricmp((char*)cur->name, "action") == 0)
{ {
string strId, strAh, strParams, strCond, strTexture=""; string strId, strAh, strParams, strCond, strTexture;
ucstring ucstrName; ucstring ucstrName;
if (id) strId = (const char*)id; if (id) strId = (const char*)id;
@ -1077,7 +1077,7 @@ namespace NLGUI
for (uint32 i = 0; i < pCurGSM->_Lines.size(); ++i) for (uint32 i = 0; i < pCurGSM->_Lines.size(); ++i)
if (sRest == pCurGSM->_Lines[i].Id) if (sRest == pCurGSM->_Lines[i].Id)
return pCurGSM->_Lines[i].ViewText; return pCurGSM->_Lines[i].ViewText;
sRest = ""; sRest.clear();
} }
else // no a lot of token left else // no a lot of token left
{ {

View file

@ -337,7 +337,7 @@ namespace NLGUI
if( fromString( value, i ) ) if( fromString( value, i ) )
{ {
_TextId = i; _TextId = i;
_HardText = ""; _HardText.clear();
} }
onTextChanged(); onTextChanged();
return; return;

View file

@ -765,7 +765,7 @@ namespace NLGUI
rVR.getTextureSizeFromId(id, _XExtend, dummy); rVR.getTextureSizeFromId(id, _XExtend, dummy);
else else
// if not found, reset, to avoid errors // if not found, reset, to avoid errors
_ArboXExtend= ""; _ArboXExtend.clear();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View file

@ -1031,12 +1031,12 @@ namespace NLGUI
if (posid > 0) if (posid > 0)
idTmp = idTmp.substr (0, posid); idTmp = idTmp.substr (0, posid);
else else
idTmp = ""; idTmp.clear();
if (poslid > 0) if (poslid > 0)
lidTmp = lidTmp.substr (0, poslid); lidTmp = lidTmp.substr (0, poslid);
else else
lidTmp = ""; lidTmp.clear();
} }
return true; return true;
} }

View file

@ -665,7 +665,7 @@ namespace NLGUI
if (strchr(ptr, '#') != NULL) if (strchr(ptr, '#') != NULL)
{ {
string LastProp = ptr.str(); string LastProp = ptr.str();
string NewProp =""; string NewProp;
string RepProp; string RepProp;
while (LastProp.size() > 0) while (LastProp.size() > 0)
@ -709,7 +709,7 @@ namespace NLGUI
else else
{ {
NewProp += LastProp; NewProp += LastProp;
LastProp = ""; LastProp.clear();
} }
} }
xmlSetProp(node,props->name, (const xmlChar*)NewProp.c_str()); xmlSetProp(node,props->name, (const xmlChar*)NewProp.c_str());

View file

@ -39,7 +39,7 @@ CLigoConfig::CLigoConfig()
// *************************************************************************** // ***************************************************************************
bool CLigoConfig::readConfigFile (const char *fileName, bool parsePrimitiveComboContent) bool CLigoConfig::readConfigFile (const std::string &fileName, bool parsePrimitiveComboContent)
{ {
// The CF // The CF
CConfigFile cf; CConfigFile cf;
@ -73,7 +73,7 @@ bool CLigoConfig::readConfigFile (const char *fileName, bool parsePrimitiveCombo
// *************************************************************************** // ***************************************************************************
bool CLigoConfig::readPrimitiveClass (const char *_fileName, bool parsePrimitiveComboContent) bool CLigoConfig::readPrimitiveClass (const std::string &_fileName, bool parsePrimitiveComboContent)
{ {
// File exist ? // File exist ?
string filename = _fileName; string filename = _fileName;
@ -785,7 +785,7 @@ std::string CLigoConfig::aliasToString(uint32 fullAlias)
} }
uint32 CLigoConfig::aliasFromString(std::string fullAlias) uint32 CLigoConfig::aliasFromString(const std::string &fullAlias)
{ {
uint32 staticPart; uint32 staticPart;
uint32 dynPart; uint32 dynPart;

View file

@ -1240,7 +1240,7 @@ const IPrimitive *IPrimitive::getPrimitive (const std::string &absoluteOrRelativ
if (indexStr==string::npos) if (indexStr==string::npos)
{ {
childName=path; childName=path;
path=""; path.clear();
} }
else else
{ {
@ -1664,7 +1664,7 @@ bool IPrimitive::read (xmlNodePtr xmlNode, const char *filename, uint version, C
if (commentNode) if (commentNode)
{ {
if (!CIXml::getContentString(_UnparsedProperties, commentNode)) if (!CIXml::getContentString(_UnparsedProperties, commentNode))
_UnparsedProperties = ""; _UnparsedProperties.clear();
} }
// Read the expanded flag // Read the expanded flag

View file

@ -183,8 +183,8 @@ bool CPrimitiveClass::read (xmlNodePtr primitiveNode,
// init default parameters // init default parameters
AutoInit = false; AutoInit = false;
Deletable = true; Deletable = true;
FileExtension = ""; FileExtension.clear();
FileType = ""; FileType.clear();
Collision = false; Collision = false;
LinkBrothers = false; LinkBrothers = false;
ShowArrow = true; ShowArrow = true;
@ -351,16 +351,16 @@ bool CPrimitiveClass::read (xmlNodePtr primitiveNode,
parameter.WidgetHeight = (uint)temp; parameter.WidgetHeight = (uint)temp;
// Read the file extension // Read the file extension
parameter.FileExtension = ""; parameter.FileExtension.clear();
CIXml::getPropertyString (parameter.FileExtension, paramNode, "FILE_EXTENSION"); CIXml::getPropertyString (parameter.FileExtension, paramNode, "FILE_EXTENSION");
parameter.FileExtension = toLower(parameter.FileExtension); parameter.FileExtension = toLower(parameter.FileExtension);
// Autonaming preference // Autonaming preference
parameter.Autoname = ""; parameter.Autoname.clear();
CIXml::getPropertyString (parameter.Autoname, paramNode, "AUTONAME"); CIXml::getPropertyString (parameter.Autoname, paramNode, "AUTONAME");
// Read the file extension // Read the file extension
parameter.Folder = ""; parameter.Folder.clear();
CIXml::getPropertyString (parameter.Folder, paramNode, "FOLDER"); CIXml::getPropertyString (parameter.Folder, paramNode, "FOLDER");
parameter.Folder = toLower(parameter.Folder); parameter.Folder = toLower(parameter.Folder);
@ -650,7 +650,7 @@ void CPrimitiveClass::CParameter::CConstStringValue::getPrimitivesForPrimPath (s
bool CPrimitiveClass::CParameter::translateAutoname (std::string &result, const IPrimitive &primitive, const CPrimitiveClass &primitiveClass) const bool CPrimitiveClass::CParameter::translateAutoname (std::string &result, const IPrimitive &primitive, const CPrimitiveClass &primitiveClass) const
{ {
result = ""; result.clear();
string::size_type strBegin = 0; string::size_type strBegin = 0;
string::size_type strEnd = 0; string::size_type strEnd = 0;
while (strBegin != Autoname.size()) while (strBegin != Autoname.size())
@ -745,7 +745,7 @@ bool CPrimitiveClass::CParameter::translateAutoname (std::string &result, const
bool CPrimitiveClass::CParameter::getDefaultValue (std::string &result, const IPrimitive &primitive, const CPrimitiveClass &primitiveClass, std::string *fromWhere) const bool CPrimitiveClass::CParameter::getDefaultValue (std::string &result, const IPrimitive &primitive, const CPrimitiveClass &primitiveClass, std::string *fromWhere) const
{ {
result = ""; result.clear();
if (!Autoname.empty()) if (!Autoname.empty())
{ {
if (fromWhere) if (fromWhere)

View file

@ -88,7 +88,7 @@ void CZoneBankElement::convertSize()
} }
fromString(sTmp, _SizeX); fromString(sTmp, _SizeX);
++i; sTmp = ""; ++i; sTmp.clear();
for (; i < sizeString.size(); ++i) for (; i < sizeString.size(); ++i)
{ {
sTmp += sizeString[i]; sTmp += sizeString[i];

View file

@ -453,7 +453,7 @@ public:
string shortExc, longExc, subject; string shortExc, longExc, subject;
string addr, ext; string addr, ext;
ULONG_PTR skipNFirst = 0; ULONG_PTR skipNFirst = 0;
_Reason = ""; _Reason.clear();
if (m_pexp == NULL) if (m_pexp == NULL)
{ {
@ -491,25 +491,25 @@ public:
case EXCEPTION_STACK_OVERFLOW : shortExc="Stack Overflow"; longExc="Stack overflow. Can occur during errant recursion, or when a function creates a particularly large array on the stack"; break; case EXCEPTION_STACK_OVERFLOW : shortExc="Stack Overflow"; longExc="Stack overflow. Can occur during errant recursion, or when a function creates a particularly large array on the stack"; break;
case EXCEPTION_INVALID_DISPOSITION : shortExc="Invalid Disposition"; longExc="Whatever number the exception filter returned, it wasn't a value the OS knows about"; break; case EXCEPTION_INVALID_DISPOSITION : shortExc="Invalid Disposition"; longExc="Whatever number the exception filter returned, it wasn't a value the OS knows about"; break;
case EXCEPTION_GUARD_PAGE : shortExc="Guard Page"; longExc="Memory Allocated as PAGE_GUARD by VirtualAlloc() has been accessed"; break; case EXCEPTION_GUARD_PAGE : shortExc="Guard Page"; longExc="Memory Allocated as PAGE_GUARD by VirtualAlloc() has been accessed"; break;
case EXCEPTION_INVALID_HANDLE : shortExc="Invalid Handle"; longExc=""; break; case EXCEPTION_INVALID_HANDLE : shortExc="Invalid Handle"; longExc.clear(); break;
case CONTROL_C_EXIT : shortExc="Control-C"; longExc="Lets the debugger know the user hit Ctrl-C. Seemingly for console apps only"; break; case CONTROL_C_EXIT : shortExc="Control-C"; longExc="Lets the debugger know the user hit Ctrl-C. Seemingly for console apps only"; break;
case STATUS_NO_MEMORY : shortExc="No Memory"; longExc="Called by HeapAlloc() if you specify HEAP_GENERATE_EXCEPTIONS and there is no memory or heap corruption"; case STATUS_NO_MEMORY : shortExc="No Memory"; longExc="Called by HeapAlloc() if you specify HEAP_GENERATE_EXCEPTIONS and there is no memory or heap corruption";
ext = ", unable to allocate "; ext = ", unable to allocate ";
ext += toString ("%d bytes", m_pexp->ExceptionRecord->ExceptionInformation [0]); ext += toString ("%d bytes", m_pexp->ExceptionRecord->ExceptionInformation [0]);
break; break;
case STATUS_WAIT_0 : shortExc="Wait 0"; longExc=""; break; case STATUS_WAIT_0 : shortExc="Wait 0"; longExc.clear(); break;
case STATUS_ABANDONED_WAIT_0 : shortExc="Abandoned Wait 0"; longExc=""; break; case STATUS_ABANDONED_WAIT_0 : shortExc="Abandoned Wait 0"; longExc.clear(); break;
case STATUS_USER_APC : shortExc="User APC"; longExc="A user APC was delivered to the current thread before the specified Timeout interval expired"; break; case STATUS_USER_APC : shortExc="User APC"; longExc="A user APC was delivered to the current thread before the specified Timeout interval expired"; break;
case STATUS_TIMEOUT : shortExc="Timeout"; longExc=""; break; case STATUS_TIMEOUT : shortExc="Timeout"; longExc.clear(); break;
case STATUS_PENDING : shortExc="Pending"; longExc=""; break; case STATUS_PENDING : shortExc="Pending"; longExc.clear(); break;
case STATUS_SEGMENT_NOTIFICATION : shortExc="Segment Notification"; longExc=""; break; case STATUS_SEGMENT_NOTIFICATION : shortExc="Segment Notification"; longExc.clear(); break;
case STATUS_FLOAT_MULTIPLE_FAULTS : shortExc="Float Multiple Faults"; longExc=""; break; case STATUS_FLOAT_MULTIPLE_FAULTS : shortExc="Float Multiple Faults"; longExc.clear(); break;
case STATUS_FLOAT_MULTIPLE_TRAPS : shortExc="Float Multiple Traps"; longExc=""; break; case STATUS_FLOAT_MULTIPLE_TRAPS : shortExc="Float Multiple Traps"; longExc.clear(); break;
#ifdef NL_COMP_VC6 #ifdef NL_COMP_VC6
case STATUS_ILLEGAL_VLM_REFERENCE : shortExc="Illegal VLM Reference"; longExc=""; break; case STATUS_ILLEGAL_VLM_REFERENCE : shortExc="Illegal VLM Reference"; longExc.clear(); break;
#endif #endif
case 0xE06D7363 : shortExc="Microsoft C++ Exception"; longExc="Microsoft C++ Exception"; break; // cpp exception case 0xE06D7363 : shortExc="Microsoft C++ Exception"; longExc="Microsoft C++ Exception"; break; // cpp exception
case 0xACE0ACE : shortExc=""; longExc=""; case 0xACE0ACE : shortExc.clear(); longExc.clear();
if (m_pexp->ExceptionRecord->NumberParameters == 1) if (m_pexp->ExceptionRecord->NumberParameters == 1)
skipNFirst = m_pexp->ExceptionRecord->ExceptionInformation [0]; skipNFirst = m_pexp->ExceptionRecord->ExceptionInformation [0];
break; // just want the stack break; // just want the stack
@ -824,7 +824,7 @@ public:
// replace param with the value of the stack for this param // replace param with the value of the stack for this param
string parse = str; string parse = str;
str = ""; str.clear();
uint pos2 = 0; uint pos2 = 0;
sint stop = 0; sint stop = 0;
@ -943,7 +943,7 @@ public:
str += tmp; str += tmp;
} }
str += parse[i]; str += parse[i];
type = ""; type.clear();
} }
else else
{ {
@ -1442,7 +1442,7 @@ std::string formatErrorMessage(int errorCode)
NULL NULL
); );
// empty buffer, an error occured // empty buffer, an error occurred
if (len == 0) return toString("FormatMessage returned error %d", getLastError()); if (len == 0) return toString("FormatMessage returned error %d", getLastError());
// convert wchar_t* to std::string // convert wchar_t* to std::string

View file

@ -255,7 +255,7 @@ void CLibrary::freeLibrary()
_PureNelLibrary = NULL; _PureNelLibrary = NULL;
_LibHandle = NULL; _LibHandle = NULL;
_Ownership = false; _Ownership = false;
_LibFileName = ""; _LibFileName.clear();
} }
} }

View file

@ -587,10 +587,10 @@ void CEntityIdTranslator::getEntityIdInfo (const CEntityId &eid, ucstring &entit
if (it == RegisteredEntities.end ()) if (it == RegisteredEntities.end ())
{ {
nlwarning ("EIT: %s is not registered in CEntityIdTranslator", reid.toString().c_str()); nlwarning ("EIT: %s is not registered in CEntityIdTranslator", reid.toString().c_str());
entityName = ""; entityName.clear();
entitySlot = -1; entitySlot = -1;
uid = std::numeric_limits<uint32>::max(); uid = std::numeric_limits<uint32>::max();
userName = ""; userName.clear();
online = false; online = false;
} }
else else

View file

@ -550,7 +550,6 @@ uint CIFile::getDbgStreamSize() const
COFile::COFile() : IStream(false) COFile::COFile() : IStream(false)
{ {
_F=NULL; _F=NULL;
_FileName = "";
} }
// ====================================================================================================== // ======================================================================================================

View file

@ -67,7 +67,6 @@ CIXml::CIXml () : IStream (true /* Input mode */)
_CurrentNode = NULL; _CurrentNode = NULL;
_PushBegin = false; _PushBegin = false;
_AttribPresent = false; _AttribPresent = false;
_ErrorString = "";
_TryBinaryMode = false; _TryBinaryMode = false;
_BinaryStream = NULL; _BinaryStream = NULL;
} }
@ -82,7 +81,6 @@ CIXml::CIXml (bool tryBinaryMode) : IStream (true /* Input mode */)
_CurrentNode = NULL; _CurrentNode = NULL;
_PushBegin = false; _PushBegin = false;
_AttribPresent = false; _AttribPresent = false;
_ErrorString = "";
_TryBinaryMode = tryBinaryMode; _TryBinaryMode = tryBinaryMode;
_BinaryStream = NULL; _BinaryStream = NULL;
} }
@ -116,7 +114,7 @@ void CIXml::release ()
_CurrentNode = NULL; _CurrentNode = NULL;
_PushBegin = false; _PushBegin = false;
_AttribPresent = false; _AttribPresent = false;
_ErrorString = ""; _ErrorString.clear();
resetPtrTable(); resetPtrTable();
} }
@ -195,7 +193,7 @@ bool CIXml::init (IStream &stream)
} }
// Set error handler // Set error handler
_ErrorString = ""; _ErrorString.clear();
xmlSetGenericErrorFunc (this, xmlGenericErrorFuncRead); xmlSetGenericErrorFunc (this, xmlGenericErrorFuncRead);
// Ask to get debug info // Ask to get debug info
@ -319,7 +317,7 @@ void CIXml::serialSeparatedBufferIn ( string &value, bool checkSeparator )
// If no more node, empty string // If no more node, empty string
if (_CurrentNode == NULL) if (_CurrentNode == NULL)
{ {
value = ""; value.clear();
_ContentStringIndex = 0; _ContentStringIndex = 0;
_ContentString.erase (); _ContentString.erase ();
return; return;

View file

@ -377,11 +377,11 @@ void CLog::displayRawString (const char *str)
{ {
localargs.Date = 0; localargs.Date = 0;
localargs.LogType = CLog::LOG_NO; localargs.LogType = CLog::LOG_NO;
localargs.ProcessName = ""; localargs.ProcessName.clear();
localargs.ThreadId = 0; localargs.ThreadId = 0;
localargs.FileName = NULL; localargs.FileName = NULL;
localargs.Line = -1; localargs.Line = -1;
localargs.CallstackAndLog = ""; localargs.CallstackAndLog.clear();
TempString = str; TempString = str;
} }
@ -397,11 +397,11 @@ void CLog::displayRawString (const char *str)
{ {
localargs.Date = 0; localargs.Date = 0;
localargs.LogType = CLog::LOG_NO; localargs.LogType = CLog::LOG_NO;
localargs.ProcessName = ""; localargs.ProcessName.clear();
localargs.ThreadId = 0; localargs.ThreadId = 0;
localargs.FileName = NULL; localargs.FileName = NULL;
localargs.Line = -1; localargs.Line = -1;
localargs.CallstackAndLog = ""; localargs.CallstackAndLog.clear();
disp = str; disp = str;
args = &localargs; args = &localargs;

View file

@ -85,7 +85,7 @@ static string getFuncInfo (DWORD_TYPE funcAddr, DWORD_TYPE stackAddr)
// replace param with the value of the stack for this param // replace param with the value of the stack for this param
string parse = str; string parse = str;
str = ""; str.clear();
uint pos = 0; uint pos = 0;
sint stop = 0; sint stop = 0;

View file

@ -134,7 +134,7 @@ COXml::COXml () : IStream (false /* Output mode */)
_CurrentNode = NULL; _CurrentNode = NULL;
// Content string // Content string
_ContentString = ""; _ContentString.clear();
// Push begin // Push begin
_PushBegin = false; _PushBegin = false;
@ -160,7 +160,7 @@ bool COXml::init (IStream *stream, const char *version)
if (!stream->isReading()) if (!stream->isReading())
{ {
// Set error handler // Set error handler
_ErrorString = ""; _ErrorString.clear();
xmlSetGenericErrorFunc (this, xmlGenericErrorFuncWrite); xmlSetGenericErrorFunc (this, xmlGenericErrorFuncWrite);
// Set XML mode // Set XML mode
@ -179,7 +179,7 @@ bool COXml::init (IStream *stream, const char *version)
_CurrentNode = NULL; _CurrentNode = NULL;
// Content string // Content string
_ContentString = ""; _ContentString.clear();
// Push begin // Push begin
_PushBegin = false; _PushBegin = false;

View file

@ -33,8 +33,7 @@ CStringMapper CStringMapper::_GlobalMapper;
// **************************************************************************** // ****************************************************************************
CStringMapper::CStringMapper() CStringMapper::CStringMapper()
{ {
_EmptyId = new string; _EmptyId = new string();
*_EmptyId = "";
} }
// **************************************************************************** // ****************************************************************************

View file

@ -1525,7 +1525,7 @@ NLMISC_CATEGORISED_DYNVARIABLE(nel, string, AvailableHDSpace, "Hard drive space
if (get) if (get)
{ {
*pointer = (CSystemInfo::availableHDSpace(location)); *pointer = (CSystemInfo::availableHDSpace(location));
location = ""; location.clear();
} }
else else
{ {

View file

@ -37,7 +37,7 @@ CTaskManager::CTaskManager() : _RunningTask (""), _TaskQueue (""), _DoneTaskQueu
_IsTaskRunning = false; _IsTaskRunning = false;
_ThreadRunning = true; _ThreadRunning = true;
CSynchronized<string>::CAccessor currentTask(&_RunningTask); CSynchronized<string>::CAccessor currentTask(&_RunningTask);
currentTask.value () = ""; currentTask.value ().clear();
_Thread = IThread::create(this); _Thread = IThread::create(this);
_Thread->start(); _Thread->start();
_ChangePriorityCallback = NULL; _ChangePriorityCallback = NULL;
@ -111,7 +111,7 @@ void CTaskManager::run(void)
CSynchronized<string>::CAccessor currentTask(&_RunningTask); CSynchronized<string>::CAccessor currentTask(&_RunningTask);
CSynchronized<deque<string> >::CAccessor doneTask(&_DoneTaskQueue); CSynchronized<deque<string> >::CAccessor doneTask(&_DoneTaskQueue);
doneTask.value().push_front (currentTask.value ()); doneTask.value().push_front (currentTask.value ());
currentTask.value () = ""; currentTask.value ().clear();
if (doneTask.value().size () > NLMISC_DONE_TASK_SIZE) if (doneTask.value().size () > NLMISC_DONE_TASK_SIZE)
doneTask.value().resize (NLMISC_DONE_TASK_SIZE); doneTask.value().resize (NLMISC_DONE_TASK_SIZE);
} }

View file

@ -156,7 +156,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
string str; string str;
while (*pos2 != '\0') while (*pos2 != '\0')
{ {
str = ""; str.clear();
// get the string // get the string
while (*pos2 != '\0' && *pos2 != '\n') while (*pos2 != '\0' && *pos2 != '\n')

View file

@ -381,7 +381,7 @@ void serviceGetView (uint32 rid, const string &rawvarpath, TAdminViewResult &ans
if (CCommandRegistry::getInstance().isNamedCommandHandler(varpath.Destination[0].first)) if (CCommandRegistry::getInstance().isNamedCommandHandler(varpath.Destination[0].first))
{ {
varpath.Destination[0].first += "."+varpath.Destination[0].second; varpath.Destination[0].first += "."+varpath.Destination[0].second;
varpath.Destination[0].second = ""; varpath.Destination[0].second.clear();
} }
if (varpath.isFinal()) if (varpath.isFinal())

View file

@ -84,7 +84,7 @@ CBufSock::~CBufSock()
delete Sock; // the socket disconnects automatically if needed delete Sock; // the socket disconnects automatically if needed
// destroy the structur to be sure that other people will not access to this anymore // destroy the structur to be sure that other people will not access to this anymore
AuthorizedCallback = ""; AuthorizedCallback.clear();
Sock = NULL; Sock = NULL;
_KnowConnected = false; _KnowConnected = false;
_LastFlushTime = 0; _LastFlushTime = 0;
@ -131,7 +131,7 @@ string stringFromVectorPart( const vector<uint8>& v, uint32 pos, uint32 len )
* (see CNonBlockingBufSock), if all the data could not be sent immediately, * (see CNonBlockingBufSock), if all the data could not be sent immediately,
* the returned nbBytesRemaining value is non-zero. * the returned nbBytesRemaining value is non-zero.
* \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt. * \param nbBytesRemaining If the pointer is not NULL, the method sets the number of bytes still pending after the flush attempt.
* \returns False if an error has occured (e.g. the remote host is disconnected). * \returns False if an error has occurred (e.g. the remote host is disconnected).
* To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString() * To retrieve the reason of the error, call CSock::getLastError() and/or CSock::errorString()
* *
* Note: this method works with both blocking and non-blocking sockets * Note: this method works with both blocking and non-blocking sockets
@ -270,7 +270,7 @@ void CBufSock::setTimeFlushTrigger( sint32 ms )
/* /*
* Update the network sending (call this method evenly). Returns false if an error occured. * Update the network sending (call this method evenly). Returns false if an error occurred.
*/ */
bool CBufSock::update() bool CBufSock::update()
{ {

View file

@ -127,7 +127,7 @@ string CLoginClient::authenticate(const string &loginServiceAddr, const ucstring
string CLoginClient::authenticateBegin(const string &loginServiceAddr, const ucstring &login, const string &cpassword, const string &application) string CLoginClient::authenticateBegin(const string &loginServiceAddr, const ucstring &login, const string &cpassword, const string &application)
{ {
VerifyLoginPasswordReason = ""; VerifyLoginPasswordReason.clear();
VerifyLoginPassword = false; VerifyLoginPassword = false;
// S01: connect to the LS // S01: connect to the LS
@ -355,7 +355,7 @@ string CLoginClient::selectShardBegin(sint32 shardId)
{ {
nlassert(_LSCallbackClient != 0 && _LSCallbackClient->connected()); nlassert(_LSCallbackClient != 0 && _LSCallbackClient->connected());
ShardChooseShardReason = ""; ShardChooseShardReason.clear();
ShardChooseShard = false; ShardChooseShard = false;
if (ShardList.empty()) if (ShardList.empty())

View file

@ -157,7 +157,7 @@ void cbWSChooseShard (CMessage &msgin, const std::string &/* serviceName */, TSe
// add it to the awaiting client // add it to the awaiting client
nlinfo ("LS: New cookie %s (name '%s' priv '%s' extended '%s' instance %u slot %u) inserted in the pending user list (awaiting new client)", cookie.toString().c_str(), userName.c_str(), userPriv.c_str(), userExtended.c_str(), instanceId, charSlot); nlinfo ("LS: New cookie %s (name '%s' priv '%s' extended '%s' instance %u slot %u) inserted in the pending user list (awaiting new client)", cookie.toString().c_str(), userName.c_str(), userPriv.c_str(), userExtended.c_str(), instanceId, charSlot);
PendingUsers.push_back (CPendingUser (cookie, userName, userPriv, userExtended, instanceId, charSlot)); PendingUsers.push_back (CPendingUser (cookie, userName, userPriv, userExtended, instanceId, charSlot));
reason = ""; reason.clear();
// callback if needed // callback if needed
if (NewCookieCallback != NULL) if (NewCookieCallback != NULL)
@ -233,7 +233,7 @@ void cbShardValidation (CMessage &msgin, TSockId from, CCallbackNetBase &netbase
// if the cookie is not valid and we accept them, clear the error // if the cookie is not valid and we accept them, clear the error
if(AcceptInvalidCookie && !reason.empty()) if(AcceptInvalidCookie && !reason.empty())
{ {
reason = ""; reason.clear();
cookie.set (rand(), rand(), rand()); cookie.set (rand(), rand(), rand());
} }
@ -425,7 +425,8 @@ void CLoginServer::addNewCookieCallback(TNewCookieCallback newCookieCb)
string CLoginServer::isValidCookie (const CLoginCookie &lc, string &userName, string &userPriv, string &userExtended, uint32 &instanceId, uint32 &charSlot) string CLoginServer::isValidCookie (const CLoginCookie &lc, string &userName, string &userPriv, string &userExtended, uint32 &instanceId, uint32 &charSlot)
{ {
userName = userPriv = ""; userName.clear();
userPriv.clear();
if (!AcceptInvalidCookie && !lc.isValid()) if (!AcceptInvalidCookie && !lc.isValid())
return "The cookie is invalid"; return "The cookie is invalid";

View file

@ -159,7 +159,7 @@ void CMessageRecorder::recordNext( sint64 updatecounter, TNetworkEvent event, TS
void CMessageRecorder::stopRecord() void CMessageRecorder::stopRecord()
{ {
_File.close(); _File.close();
_Filename = ""; _Filename.clear();
} }
@ -395,7 +395,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add
void CMessageRecorder::stopReplay() void CMessageRecorder::stopReplay()
{ {
_File.close(); _File.close();
_Filename = ""; _Filename.clear();
} }

View file

@ -1453,7 +1453,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
} }
if (dispName.empty()) if (dispName.empty())
str = ""; str.clear();
else else
str = dispName + ": "; str = dispName + ": ";

View file

@ -149,7 +149,7 @@ void CSock::releaseNetwork()
} }
/* Returns the code of the last error that has occured. /* Returns the code of the last error that has occurred.
* Note: This code is platform-dependant. On Unix, it is errno; on Windows it is the Winsock error code. * Note: This code is platform-dependant. On Unix, it is errno; on Windows it is the Winsock error code.
* See also errorString() * See also errorString()
*/ */

View file

@ -167,7 +167,7 @@ void CVarPath::decode ()
if (val == "=") if (val == "=")
{ {
srv += val + RawVarPath.substr (TokenPos); srv += val + RawVarPath.substr (TokenPos);
var = ""; var.clear();
} }
else else
var = RawVarPath.substr (TokenPos); var = RawVarPath.substr (TokenPos);

View file

@ -631,7 +631,7 @@ bool computeRetriever(CCollisionMeshBuild &cmb, CLocalRetriever &lr, CVector &tr
{ {
nlwarning("Edge issues reported !!"); nlwarning("Edge issues reported !!");
uint i; uint i;
error = ""; error.clear();
for (i=0; i<errors.size(); ++i) for (i=0; i<errors.size(); ++i)
error += errors[i]+"\n"; error += errors[i]+"\n";
return false; return false;

View file

@ -43,7 +43,7 @@ Doc:
// Collisionnable primitives // Collisionnable primitives
Each primitive must be moved first with the move() method. Each primitive must be moved first with the move() method.
Their moves are evaluate all at once. All the collisions found are time sorted in a time orderin table (_TimeOT). Their moves are evaluate all at once. All the collisions found are time sorted in a time orderin table (_TimeOT).
While the table is not empty, the first collision occured in time is solved and While the table is not empty, the first collision occurred in time is solved and
If a collision is found, reaction() is called. If a collision is found, reaction() is called.

View file

@ -1770,7 +1770,7 @@ void CAudioMixerUser::update()
str += tmp; str += tmp;
} }
nldebug((string("Status1: ")+str).c_str()); nldebug((string("Status1: ")+str).c_str());
str = ""; str.clear();
for (i=_NbTracks/2; i<_NbTracks; ++i) for (i=_NbTracks/2; i<_NbTracks; ++i)
{ {
sprintf(tmp, "[%2u]%8p ", i, _Tracks[i]->getSource()); sprintf(tmp, "[%2u]%8p ", i, _Tracks[i]->getSource());

View file

@ -160,7 +160,7 @@ void CContextSound::init()
uint contextArgIndex[SoundContextNbArgs]; uint contextArgIndex[SoundContextNbArgs];
bool useRandom = false; bool useRandom = false;
bool parseArg = false; bool parseArg = false;
_BaseName = ""; _BaseName.clear();
//nldebug("Init the context sound %s", _PatternName.c_str()); //nldebug("Init the context sound %s", _PatternName.c_str());
@ -190,7 +190,7 @@ void CContextSound::init()
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/)); nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
fromString(index, contextArgIndex[nbJoker++]); fromString(index, contextArgIndex[nbJoker++]);
parseArg = false; parseArg = false;
index = ""; index.clear();
} }
} }
else if (*first == 'r') else if (*first == 'r')

View file

@ -563,15 +563,15 @@ void CSoundDriverDSound::initDevice(const std::string &device, ISoundDriver::TSo
switch (hr) switch (hr)
{ {
case DSERR_BUFFERLOST: case DSERR_BUFFERLOST:
throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_BUFFERLOST"); throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_BUFFERLOST");
case DSERR_INVALIDCALL: case DSERR_INVALIDCALL:
throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_INVALIDCALL"); throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_INVALIDCALL");
case DSERR_INVALIDPARAM: case DSERR_INVALIDPARAM:
throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_INVALIDPARAM"); throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_INVALIDPARAM");
case DSERR_PRIOLEVELNEEDED: case DSERR_PRIOLEVELNEEDED:
throw ESoundDriver("Failed to lock the DirectSound primary buffer : DSERR_PRIOLEVELNEEDED"); throw ESoundDriver("Failed to lock the DirectSound primary buffer: DSERR_PRIOLEVELNEEDED");
default: default:
throw ESoundDriver("Failed to lock the DirectSound primary buffer : unkown error"); throw ESoundDriver("Failed to lock the DirectSound primary buffer: unknown error");
} }
} }

View file

@ -92,7 +92,7 @@ CSound *CSound::createSound(const std::string &filename, NLGEORGES::UFormElm& fo
} }
else else
{ {
nlassertex(false, ("SoundType unsuported : %s", dfnName.c_str())); nlassertex(false, ("SoundType unsupported: %s", dfnName.c_str()));
} }
} }

View file

@ -271,7 +271,7 @@ int main (int argc, char **argv)
bool _256=(type==CTileBank::_256x256); bool _256=(type==CTileBank::_256x256);
// Diffuse bitmap filled ? // Diffuse bitmap filled ?
if (pTile->getRelativeFileName (CTile::diffuse)!="") if (!pTile->getRelativeFileName (CTile::diffuse).empty())
{ {
// File exist ? // File exist ?
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::diffuse), false); string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::diffuse), false);
@ -302,7 +302,7 @@ int main (int argc, char **argv)
} }
// Additive bitmap filled ? // Additive bitmap filled ?
if (pTile->getRelativeFileName (CTile::additive)!="") if (!pTile->getRelativeFileName (CTile::additive).empty())
{ {
// File exist ? // File exist ?
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::additive), false); string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::additive), false);
@ -333,7 +333,7 @@ int main (int argc, char **argv)
} }
// Alpha bitmap filled ? // Alpha bitmap filled ?
if (pTile->getRelativeFileName (CTile::alpha)!="") if (!pTile->getRelativeFileName (CTile::alpha).empty())
{ {
// File exist ? // File exist ?
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::alpha), false); string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::alpha), false);

View file

@ -175,7 +175,6 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
if (ITemp != NULL) if (ITemp != NULL)
{ {
SDispCS dcsTemp; SDispCS dcsTemp;
dcsTemp.Name = "";
for (sint32 i = 0; i < (1+nNbPlus); ++i) for (sint32 i = 0; i < (1+nNbPlus); ++i)
dcsTemp.Name += " "; dcsTemp.Name += " ";
dcsTemp.Name += nameIG; dcsTemp.Name += nameIG;

View file

@ -227,7 +227,7 @@ int main(int argc, char* argv[])
CGlobalRetriever *globalRetriever= NULL; CGlobalRetriever *globalRetriever= NULL;
uint32 grFileDate= 0; uint32 grFileDate= 0;
uint32 rbankFileDate= 0; uint32 rbankFileDate= 0;
if( grFile!="" && rbankFile!="" ) if( !grFile.empty() && !rbankFile.empty())
{ {
CIFile fin; CIFile fin;
// serial the retrieverBank. Exception if not found. // serial the retrieverBank. Exception if not found.

View file

@ -20,6 +20,8 @@ NL_DEFAULT_PROPS(ligoscape_utility "MAX Plugin: Ligoscape Utility")
NL_ADD_RUNTIME_FLAGS(ligoscape_utility) NL_ADD_RUNTIME_FLAGS(ligoscape_utility)
NL_ADD_LIB_SUFFIX(ligoscape_utility) NL_ADD_LIB_SUFFIX(ligoscape_utility)
ADD_DEFINITIONS(${MAXSDK_DEFINITIONS})
INSTALL(TARGETS ligoscape_utility RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) INSTALL(TARGETS ligoscape_utility RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
INSTALL(FILES ligoscript.txt DESTINATION maxplugin/docs) INSTALL(FILES ligoscript.txt DESTINATION maxplugin/docs)
INSTALL(DIRECTORY scripts/ INSTALL(DIRECTORY scripts/

View file

@ -46,7 +46,7 @@ NeLLigoGetErrorZoneTemplate code_array vertex_id_array message_array error_index
Get the export errors after a call to NeLLigoExportZoneTemplate. Get the export errors after a call to NeLLigoExportZoneTemplate.
code_array is an integer array with the error code. (2 for OpenedEdge, 4 for InvalidVertexList, 5 for NotInserted) code_array is an integer array with the error code. (2 for OpenedEdge, 4 for InvalidVertexList, 5 for NotInserted)
vertex_id_array is an integer array with the id of the vertex where an error occured. vertex_id_array is an integer array with the id of the vertex where an error occurred.
message_array is a string array with the error message for the vertices message_array is a string array with the error message for the vertices
error_index is the id of the error buffer (1 ~ 9) error_index is the id of the error buffer (1 ~ 9)

View file

@ -124,17 +124,17 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di
if (hModule) if (hModule)
{ {
// Get the path // Get the path
char sModulePath[256]; TCHAR sModulePath[256];
int res=GetModuleFileName(hModule, sModulePath, 256); int res=GetModuleFileName(hModule, sModulePath, 256);
// Success ? // Success ?
if (res) if (res)
{ {
// Path // Path
char sDrive[256]; TCHAR sDrive[256];
char sDir[256]; TCHAR sDir[256];
_splitpath (sModulePath, sDrive, sDir, NULL, NULL); _tsplitpath (sModulePath, sDrive, sDir, NULL, NULL);
_makepath (sModulePath, sDrive, sDir, "ligoscape", ".cfg"); _tmakepath (sModulePath, sDrive, sDir, _T("ligoscape"), _T(".cfg"));
try try
{ {
@ -144,7 +144,7 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di
// ok // ok
return true; return true;
} }
catch (Exception& e) catch (const Exception& e)
{ {
// Print an error message // Print an error message
char msg[512]; char msg[512];
@ -160,22 +160,22 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di
// *************************************************************************** // ***************************************************************************
void CMaxToLigo::errorMessage (const char *msg, const char *title, Interface& it, bool dialog) void CMaxToLigo::errorMessage(const std::string &msg, const std::string &title, Interface& it, bool dialog)
{ {
// Text or dialog ? // Text or dialog ?
if (dialog) if (dialog)
{ {
// Dialog message // Dialog message
MessageBox (it.GetMAXHWnd(), msg, title, MB_OK|MB_ICONEXCLAMATION); MessageBox (it.GetMAXHWnd(), utf8ToTStr(msg), utf8ToTStr(title), MB_OK|MB_ICONEXCLAMATION);
} }
else else
{ {
// Text message // Text message
mprintf ((string(msg) + "\n").c_str()); mprintf (utf8ToTStr(msg + "\n"));
} }
// Output in log // Output in log
nlwarning ("LIGO ERROR : %s", msg); nlwarning ("LIGO ERROR : %s", msg.c_str());
} }
// *************************************************************************** // ***************************************************************************

View file

@ -70,7 +70,7 @@ public:
* \param it if a max interface * \param it if a max interface
* \param dialog is true to see the message in a dilog, false to see it in the script window. * \param dialog is true to see the message in a dilog, false to see it in the script window.
*/ */
static void errorMessage (const char *msg, const char *title, Interface& it, bool dialog); static void errorMessage (const std::string &msg, const std::string &title, Interface& it, bool dialog);
}; };
} }

View file

@ -137,7 +137,7 @@ Value* export_material_cf (Value** arg_list, int count)
check_arg_count(export_material, 4, count); check_arg_count(export_material, 4, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoExportMaterial [Object] [Filename] [CheckOnly] [Error in dialog]"; TCHAR *message = _T("NeLLigoExportMaterial [Object] [Filename] [CheckOnly] [Error in dialog]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], String, message); type_check(arg_list[1], String, message);
type_check(arg_list[2], Boolean, message); type_check(arg_list[2], Boolean, message);
@ -306,7 +306,7 @@ Value* export_transition_cf (Value** arg_list, int count)
check_arg_count(export_transition, 6, count); check_arg_count(export_transition, 6, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoExportTransition [Object array (count=9)] [Output filename] [First material filename] [Second material filename] [CheckOnly] [Error in dialog]"; TCHAR *message = _T("NeLLigoExportTransition [Object array (count=9)] [Output filename] [First material filename] [Second material filename] [CheckOnly] [Error in dialog]");
type_check(arg_list[0], Array, message); type_check(arg_list[0], Array, message);
type_check(arg_list[1], String, message); type_check(arg_list[1], String, message);
type_check(arg_list[2], String, message); type_check(arg_list[2], String, message);
@ -326,8 +326,8 @@ Value* export_transition_cf (Value** arg_list, int count)
// The second arg // The second arg
string matFilename[2]; string matFilename[2];
matFilename[0] = arg_list[2]->to_string(); matFilename[0] = tStrToUtf8(arg_list[2]->to_string());
matFilename[1] = arg_list[3]->to_string(); matFilename[1] = tStrToUtf8(arg_list[3]->to_string());
// The third arg // The third arg
bool checkOnly = (arg_list[4]->to_bool() != FALSE); bool checkOnly = (arg_list[4]->to_bool() != FALSE);
@ -427,7 +427,7 @@ Value* export_transition_cf (Value** arg_list, int count)
// Serial // Serial
materials[mat].serial (inputXml); materials[mat].serial (inputXml);
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[2048]; char tmp[2048];
@ -541,7 +541,7 @@ Value* export_transition_cf (Value** arg_list, int count)
ok = false; ok = false;
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[512]; char tmp[512];
@ -595,7 +595,7 @@ Value* get_error_zone_template_cf (Value** arg_list, int count)
check_arg_count(get_error_zone_template, 4, count); check_arg_count(get_error_zone_template, 4, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoGetErrorZoneTemplate [Array error codes] [Array vertex id] [Array messages] [Error index]"; TCHAR *message = _T("NeLLigoGetErrorZoneTemplate [Array error codes] [Array vertex id] [Array messages] [Error index]");
type_check(arg_list[0], Array, message); type_check(arg_list[0], Array, message);
type_check(arg_list[1], Array, message); type_check(arg_list[1], Array, message);
type_check(arg_list[2], Array, message); type_check(arg_list[2], Array, message);
@ -637,7 +637,7 @@ Value* get_error_zone_template_cf (Value** arg_list, int count)
vertexId->append (Integer::intern (id+1)); vertexId->append (Integer::intern (id+1));
// Append messages // Append messages
messages->append (new String("[LIGO DEBUG] Opened edge")); messages->append (new String(_T("[LIGO DEBUG] Opened edge")));
} }
// Return the main error message // Return the main error message
@ -687,7 +687,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count)
check_arg_count(check_zone_with_template, 3, count); check_arg_count(check_zone_with_template, 3, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoCheckZoneWithMaterial [Object] [Material filename] [Error in dialog]"; TCHAR *message = _T("NeLLigoCheckZoneWithMaterial [Object] [Material filename] [Error in dialog]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], String, message); type_check(arg_list[1], String, message);
type_check(arg_list[2], Boolean, message); type_check(arg_list[2], Boolean, message);
@ -700,7 +700,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = arg_list[1]->to_string(); string fileName = tStrToUtf8(arg_list[1]->to_string());
// The fourth arg // The fourth arg
bool errorInDialog = (arg_list[2]->to_bool() != FALSE); bool errorInDialog = (arg_list[2]->to_bool() != FALSE);
@ -778,7 +778,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count)
CMaxToLigo::errorMessage (tmp, "NeL Ligo check zone", *MAXScript_interface, errorInDialog); CMaxToLigo::errorMessage (tmp, "NeL Ligo check zone", *MAXScript_interface, errorInDialog);
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[512]; char tmp[512];
@ -820,7 +820,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count)
check_arg_count(check_zone_with_template, 4, count); check_arg_count(check_zone_with_template, 4, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoCheckZoneWithTransition [Object] [Transition filename] [Transition number: 0~8] [Error in dialog]"; TCHAR *message = _T("NeLLigoCheckZoneWithTransition [Object] [Transition filename] [Transition number: 0~8] [Error in dialog]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], String, message); type_check(arg_list[1], String, message);
type_check(arg_list[2], Integer, message); type_check(arg_list[2], Integer, message);
@ -834,7 +834,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = arg_list[1]->to_string(); string fileName = tStrToUtf8(arg_list[1]->to_string());
// The second arg // The second arg
int transitionNumber = arg_list[2]->to_int(); int transitionNumber = arg_list[2]->to_int();
@ -901,7 +901,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count)
CMaxToLigo::errorMessage (tmp, "NeL Ligo check zone", *MAXScript_interface, errorInDialog); CMaxToLigo::errorMessage (tmp, "NeL Ligo check zone", *MAXScript_interface, errorInDialog);
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[512]; char tmp[512];
@ -987,7 +987,7 @@ Value* export_zone_cf (Value** arg_list, int count)
check_arg_count(check_zone_with_template, 5, count); check_arg_count(check_zone_with_template, 5, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoExportZone [Object] [Ligozone filename] [Category Array] [Error in dialog] [Snapshot]"; TCHAR *message = _T("NeLLigoExportZone [Object] [Ligozone filename] [Category Array] [Error in dialog] [Snapshot]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], String, message); type_check(arg_list[1], String, message);
type_check(arg_list[2], Array, message); type_check(arg_list[2], Array, message);
@ -1002,7 +1002,7 @@ Value* export_zone_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = arg_list[1]->to_string(); string fileName = tStrToUtf8(arg_list[1]->to_string());
// The thrid arg // The thrid arg
Array *array = (Array*)arg_list[2]; Array *array = (Array*)arg_list[2];
@ -1047,8 +1047,8 @@ Value* export_zone_cf (Value** arg_list, int count)
type_check (cell->get(2), String, message); type_check (cell->get(2), String, message);
// Get the strings // Get the strings
categories[i].first = cell->get(1)->to_string(); categories[i].first = tStrToUtf8(cell->get(1)->to_string());
categories[i].second = cell->get(2)->to_string(); categories[i].second = tStrToUtf8(cell->get(2)->to_string());
} }
// Get a Object pointer // Get a Object pointer
@ -1313,7 +1313,7 @@ Value* export_zone_cf (Value** arg_list, int count)
CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog); CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog);
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[512]; char tmp[512];
@ -1324,7 +1324,7 @@ Value* export_zone_cf (Value** arg_list, int count)
} }
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[512]; char tmp[512];
@ -1362,14 +1362,14 @@ Value* get_error_string_cf (Value** arg_list, int count)
check_arg_count(get_error_string, 1, count); check_arg_count(get_error_string, 1, count);
// Checks arg // Checks arg
char *message = "NeLLigoGetErrorString [error code]"; TCHAR *message = _T("NeLLigoGetErrorString [error code]");
type_check(arg_list[0], Integer, message); type_check(arg_list[0], Integer, message);
// The first arg // The first arg
int errorCode = arg_list[0]->to_int()-1; int errorCode = arg_list[0]->to_int()-1;
// Error code // Error code
return new String ((char*)CLigoError::getStringError ((CLigoError::TError)errorCode)); return new String (utf8ToTStr(CLigoError::getStringError ((CLigoError::TError)errorCode)));
} }
// *************************************************************************** // ***************************************************************************
@ -1380,14 +1380,14 @@ Value* set_directory_cf (Value** arg_list, int count)
check_arg_count(set_directory, 1, count); check_arg_count(set_directory, 1, count);
// Checks arg // Checks arg
char *message = "NeLLigoDirectory [path]"; TCHAR *message = _T("NeLLigoDirectory [path]");
type_check(arg_list[0], String, message); type_check(arg_list[0], String, message);
// The first arg // The first arg
const char *dir = arg_list[0]->to_string(); const std::string dir = tStrToUtf8(arg_list[0]->to_string());
// Set the directory // Set the directory
return (chdir (dir)==0)?&true_value:&false_value; return (chdir (dir.c_str())==0)?&true_value:&false_value;
} }
// *************************************************************************** // ***************************************************************************
@ -1398,7 +1398,7 @@ Value* get_zone_mask_cf (Value** arg_list, int count)
check_arg_count(check_zone_with_template, 5, count); check_arg_count(check_zone_with_template, 5, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoGetZoneMask [Object] [Mask Array] [Width Array] [Height Array] [Error in dialog]"; TCHAR *message = _T("NeLLigoGetZoneMask [Object] [Mask Array] [Width Array] [Height Array] [Error in dialog]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], Array, message); type_check(arg_list[1], Array, message);
type_check(arg_list[2], Array, message); type_check(arg_list[2], Array, message);
@ -1558,7 +1558,7 @@ Value* get_zone_size_cf (Value** arg_list, int count)
check_arg_count(check_zone_with_template, 6, count); check_arg_count(check_zone_with_template, 6, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoGetZoneMask [Object] [minx Array] [maxy Array] [miny Array] [maxy Array] [Error in dialog]"; TCHAR *message = _T("NeLLigoGetZoneMask [Object] [minx Array] [maxy Array] [miny Array] [maxy Array] [Error in dialog]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], Array, message); type_check(arg_list[1], Array, message);
type_check(arg_list[2], Array, message); type_check(arg_list[2], Array, message);
@ -1835,7 +1835,7 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c
CMaxToLigo::errorMessage ("Can't initialise opengl offscreen renderer", "NeL Ligo check zone", *MAXScript_interface, errorInDialog); CMaxToLigo::errorMessage ("Can't initialise opengl offscreen renderer", "NeL Ligo check zone", *MAXScript_interface, errorInDialog);
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error // Error
char tmp[512]; char tmp[512];
@ -1859,7 +1859,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
check_arg_count(NeLLigoMakeSnapShot, 7, count); check_arg_count(NeLLigoMakeSnapShot, 7, count);
// Check to see if the arguments match up to what we expect // Check to see if the arguments match up to what we expect
char *message = "NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]"; TCHAR *message = _T("NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]");
type_check(arg_list[0], MAXNode, message); type_check(arg_list[0], MAXNode, message);
type_check(arg_list[1], String, message); type_check(arg_list[1], String, message);
type_check(arg_list[2], Integer, message); type_check(arg_list[2], Integer, message);
@ -1876,7 +1876,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// The second arg // The second arg
string fileName = arg_list[1]->to_string(); string fileName = tStrToUtf8(arg_list[1]->to_string());
// The thrid arg // The thrid arg
int xMin = arg_list[2]->to_int(); int xMin = arg_list[2]->to_int();
@ -2042,7 +2042,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog); CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog);
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[512]; char tmp[512];
@ -2068,7 +2068,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
} }
} }
} }
catch (Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
char tmp[512]; char tmp[512];

View file

@ -81,12 +81,12 @@ void CAnimationSetDlg::OnAddAnimation ()
if (instance != 0xffffffff) if (instance != 0xffffffff)
{ {
// Create a dialog // Create a dialog
static char BASED_CODE szFilter[] = static TCHAR BASED_CODE szFilter[] =
"NeL Animation Files (*.anim)\0*.anim\0" _T("NeL Animation Files (*.anim)\0*.anim\0")
"All Files (*.*)\0*.*\0\0"; _T("All Files (*.*)\0*.*\0\0");
// Filename buffer // Filename buffer
char buffer[65535]; TCHAR buffer[65535];
buffer[0]=0; buffer[0]=0;
OPENFILENAME openFile; OPENFILENAME openFile;
@ -98,7 +98,7 @@ void CAnimationSetDlg::OnAddAnimation ()
openFile.lpstrFile = buffer; openFile.lpstrFile = buffer;
openFile.nMaxFile = 65535; openFile.nMaxFile = 65535;
openFile.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING|OFN_EXPLORER; openFile.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING|OFN_EXPLORER;
openFile.lpstrDefExt = "*.anim"; openFile.lpstrDefExt = _T("*.anim");
if (GetOpenFileName(&openFile)) if (GetOpenFileName(&openFile))
@ -107,7 +107,7 @@ void CAnimationSetDlg::OnAddAnimation ()
try try
{ {
// Filename pointer // Filename pointer
char *c=buffer; TCHAR *c=buffer;
// Read the path // Read the path
CString path = buffer; CString path = buffer;
@ -117,7 +117,7 @@ void CAnimationSetDlg::OnAddAnimation ()
c[path.GetLength()+1]=0; c[path.GetLength()+1]=0;
// Path is empty // Path is empty
path = ""; path.Empty();
} }
else else
{ {
@ -132,8 +132,8 @@ void CAnimationSetDlg::OnAddAnimation ()
while (*c) while (*c)
{ {
// File name // File name
char filename[256]; TCHAR filename[256];
char *ptr=filename; TCHAR *ptr=filename;
// Read a file name // Read a file name
while (*c) while (*c)
@ -147,7 +147,7 @@ void CAnimationSetDlg::OnAddAnimation ()
CString name = path + filename; CString name = path + filename;
// Load the animation // Load the animation
_ObjView->loadAnimation (name, instance); _ObjView->loadAnimation (tStrToUtf8(name), instance);
// Touch the channel mixer // Touch the channel mixer
_ObjView->reinitChannels (); _ObjView->reinitChannels ();
@ -156,9 +156,9 @@ void CAnimationSetDlg::OnAddAnimation ()
refresh (TRUE); refresh (TRUE);
} }
} }
catch (Exception& e) catch (const Exception& e)
{ {
MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -173,8 +173,8 @@ void CAnimationSetDlg::OnAddSkelWt()
if (instance != CB_ERR) if (instance != CB_ERR)
{ {
// TODO: Add your control notification handler code here // TODO: Add your control notification handler code here
static char BASED_CODE szFilter[] = "NeL Skeleton Weight Template Files (*.swt)|*.swt|All Files (*.*)|*.*||"; static TCHAR BASED_CODE szFilter[] = _T("NeL Skeleton Weight Template Files (*.swt)|*.swt|All Files (*.*)|*.*||");
CFileDialog fileDlg( TRUE, ".swt", "*.swt", OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); CFileDialog fileDlg( TRUE, _T(".swt"), _T("*.swt"), OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter);
if (fileDlg.DoModal()==IDOK) if (fileDlg.DoModal()==IDOK)
{ {
// Open the file // Open the file
@ -188,7 +188,7 @@ void CAnimationSetDlg::OnAddSkelWt()
CString filename=fileDlg.GetNextPathName(pos); CString filename=fileDlg.GetNextPathName(pos);
// Load the animation // Load the animation
_ObjView->loadSWT (filename, instance); _ObjView->loadSWT (tStrToUtf8(filename), instance);
// Touch the channel mixer // Touch the channel mixer
_ObjView->reinitChannels (); _ObjView->reinitChannels ();
@ -197,9 +197,9 @@ void CAnimationSetDlg::OnAddSkelWt()
refresh (TRUE); refresh (TRUE);
} }
} }
catch (Exception& e) catch (const Exception& e)
{ {
MessageBox (e.what(), "NeL object viewer", MB_OK|MB_ICONEXCLAMATION); MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -233,9 +233,8 @@ void CAnimationSetDlg::refresh (BOOL update)
uint i; uint i;
for (i=0; i<_ObjView->getNumInstance (); i++) for (i=0; i<_ObjView->getNumInstance (); i++)
{ {
char name[512]; std::string name = NLMISC::CFile::getFilenameWithoutExtension(_ObjView->getInstance(i)->Saved.ShapeFilename);
_splitpath (_ObjView->getInstance (i)->Saved.ShapeFilename.c_str(), NULL, NULL, name, NULL); EditedObject.InsertString (-1, utf8ToTStr(name));
EditedObject.InsertString (-1, name);
} }
// Get edited object // Get edited object
@ -270,7 +269,7 @@ void CAnimationSetDlg::refresh (BOOL update)
CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name)); CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name));
// Insert an intem // Insert an intem
HTREEITEM item=Tree.InsertItem (name); HTREEITEM item=Tree.InsertItem(utf8ToTStr(name));
Tree.SetItemData (item, i); Tree.SetItemData (item, i);
nlassert (item!=NULL); nlassert (item!=NULL);
@ -281,7 +280,7 @@ void CAnimationSetDlg::refresh (BOOL update)
while (ite!=setString.end()) while (ite!=setString.end())
{ {
// Add this string // Add this string
HTREEITEM newItem = Tree.InsertItem (ite->c_str(), item); HTREEITEM newItem = Tree.InsertItem (utf8ToTStr(*ite), item);
Tree.SetItemData (newItem, 0xffffffff); Tree.SetItemData (newItem, 0xffffffff);
// Get the track // Get the track
@ -296,20 +295,17 @@ void CAnimationSetDlg::refresh (BOOL update)
keyTrack->getKeysInRange (track->getBeginTime ()-1, track->getEndTime ()+1, keys); keyTrack->getKeysInRange (track->getBeginTime ()-1, track->getEndTime ()+1, keys);
// Print track info // Print track info
char name[512]; name = toString("%s (%f - %f) %u keys", typeid(*track).name(), track->getBeginTime(), track->getEndTime(), (uint32)keys.size());
_snprintf (name, 512, "%s (%f - %f) %d keys", typeid(*track).name(), track->getBeginTime (), track->getEndTime (), keys.size());
HTREEITEM keyItem = Tree.InsertItem (name, newItem);
Tree.SetItemData (keyItem, 0xffffffff);
} }
else else
{ {
// Print track info // Print track info
char name[512]; name = toString("%s (%f - %f)", typeid(*track).name(), track->getBeginTime(), track->getEndTime());
_snprintf (name, 512, "%s (%f - %f)", typeid(*track).name(), track->getBeginTime (), track->getEndTime ());
HTREEITEM keyItem = Tree.InsertItem (name, newItem);
Tree.SetItemData (keyItem, 0xffffffff);
} }
HTREEITEM keyItem = Tree.InsertItem(utf8ToTStr(name), newItem);
Tree.SetItemData(keyItem, 0xffffffff);
ite++; ite++;
} }
} }
@ -325,7 +321,7 @@ void CAnimationSetDlg::refresh (BOOL update)
CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight (object->AnimationSet.getSkeletonWeightIdByName (name)); CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight (object->AnimationSet.getSkeletonWeightIdByName (name));
// Insert an intem // Insert an intem
HTREEITEM item=SkelTree.InsertItem (name); HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name));
nlassert (item!=NULL); nlassert (item!=NULL);
// Get number of node in this skeleton weight // Get number of node in this skeleton weight
@ -334,11 +330,10 @@ void CAnimationSetDlg::refresh (BOOL update)
// Add the nodein the tree // Add the nodein the tree
for (uint n=0; n<numNode; n++) for (uint n=0; n<numNode; n++)
{ {
char percent[512]; std::string percent = toString("%s (%f%%)", swt->getNodeName(n).c_str(), swt->getNodeWeight(n)*100);
sprintf (percent, "%s (%f%%)", swt->getNodeName (n).c_str(), swt->getNodeWeight(n)*100);
// Add this string // Add this string
SkelTree.InsertItem (percent, item); SkelTree.InsertItem (utf8ToTStr(percent), item);
} }
} }
@ -346,7 +341,7 @@ void CAnimationSetDlg::refresh (BOOL update)
for (i=0; i<object->Saved.PlayList.size(); i++) for (i=0; i<object->Saved.PlayList.size(); i++)
{ {
// Insert an intem // Insert an intem
int item=PlayList.InsertString (-1, object->Saved.PlayList[i].c_str()); int item=PlayList.InsertString (-1, utf8ToTStr(object->Saved.PlayList[i]));
nlassert (item!=LB_ERR); nlassert (item!=LB_ERR);
} }
} }
@ -372,9 +367,9 @@ void CAnimationSetDlg::refresh (BOOL update)
for (i=0; i<object->Saved.PlayList.size(); i++) for (i=0; i<object->Saved.PlayList.size(); i++)
{ {
// Insert an intem // Insert an intem
char text[512]; TCHAR text[512];
PlayList.GetText( i, text); PlayList.GetText( i, text);
object->Saved.PlayList[i] = text; object->Saved.PlayList[i] = tStrToUtf8(text);
} }
CDialog::UpdateData (update); CDialog::UpdateData (update);

View file

@ -355,7 +355,7 @@ void CAttribDlg::init(HBITMAP bitmap, sint x, sint y, CWnd *pParent)
for (uint k = 0; k < getNumScheme(); ++k) for (uint k = 0; k < getNumScheme(); ++k)
{ {
m_Scheme.InsertString(k, getSchemeName(k).c_str()); m_Scheme.InsertString(k, utf8ToTStr(getSchemeName(k)));
} }
@ -683,7 +683,7 @@ END_MESSAGE_MAP()
{ {
CString out; CString out;
out.Format("%g", Scheme->getValue(index) ); out.Format(_T("%g"), Scheme->getValue(index) );
dc->TextOut(x + 10, y + 4, out); dc->TextOut(x + 10, y + 4, out);
} }
CEditAttribDlg *newDialog(const std::string &id, IPSWrapperFloat *wrapper) CEditAttribDlg *newDialog(const std::string &id, IPSWrapperFloat *wrapper)
@ -896,7 +896,7 @@ END_MESSAGE_MAP()
{ {
CString out; CString out;
out.Format("%d", Scheme->getValue(index) ); out.Format(_T("%d"), Scheme->getValue(index) );
dc->TextOut(x + 10, y + 4, out); dc->TextOut(x + 10, y + 4, out);
} }
CEditAttribDlg *newDialog(const std::string &id, IPSWrapperUInt *wrapper) CEditAttribDlg *newDialog(const std::string &id, IPSWrapperUInt *wrapper)
@ -1085,7 +1085,7 @@ END_MESSAGE_MAP()
{ {
CString out; CString out;
out.Format("%d", Scheme->getValue(index) ); out.Format(_T("%d"), Scheme->getValue(index) );
dc->TextOut(x + 10, y + 4, out); dc->TextOut(x + 10, y + 4, out);
} }
CEditAttribDlg *newDialog(const std::string &id, IPSWrapper<sint32> *wrapper) CEditAttribDlg *newDialog(const std::string &id, IPSWrapper<sint32> *wrapper)

View file

@ -98,7 +98,7 @@ public:
} }
// init the operator list box // init the operator list box
static const char *ops[] = { "selectArg1", "selectArg2", "modulate", "add", "subtract" } ; static const TCHAR *ops[] = { _T("selectArg1"), _T("selectArg2"), _T("modulate"), _T("add"), _T("subtract") };
for (k = 0 ; k < (uint) NL3D::CPSBinOp::last ; ++k) for (k = 0 ; k < (uint) NL3D::CPSBinOp::last ; ++k)
{ {
// SchemeWrapper[k].S reference the atriobute maker being edited // SchemeWrapper[k].S reference the atriobute maker being edited

View file

@ -77,24 +77,24 @@ public:
/** validate a value against upper bound. (if an upper bound was set /** validate a value against upper bound. (if an upper bound was set
* \return NULL if ok or an error message * \return NULL if ok or an error message
*/ */
const char *validateUpperBound(T v) const TCHAR *validateUpperBound(T v)
{ {
if (!_UpperBoundEnabled) return NULL; if (!_UpperBoundEnabled) return NULL;
if (_UpperBoundExcluded && v < _UpperBound) return NULL; if (_UpperBoundExcluded && v < _UpperBound) return NULL;
if (!_UpperBoundExcluded && v <= _UpperBound) return NULL; if (!_UpperBoundExcluded && v <= _UpperBound) return NULL;
return "value too high"; return _T("value too high");
} }
/** validate a value against lower bound. (if an lower bound was set /** validate a value against lower bound. (if an lower bound was set
* \return NULL if ok or an error message * \return NULL if ok or an error message
*/ */
const char *validateLowerBound(T v) const TCHAR *validateLowerBound(T v)
{ {
if (!_LowerBoundEnabled) return NULL; if (!_LowerBoundEnabled) return NULL;
if (_LowerBoundExcluded && v > _LowerBound) return NULL; if (_LowerBoundExcluded && v > _LowerBound) return NULL;
if (!_LowerBoundExcluded && v >= _LowerBound) return NULL; if (!_LowerBoundExcluded && v >= _LowerBound) return NULL;
return "value too low"; return _T("value too low");
} }
/// copy this bound checker object to another one /// copy this bound checker object to another one

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