diff --git a/code/nel/include/nel/3d/animatable.h b/code/nel/include/nel/3d/animatable.h index 09297ab2b..6e4a7b39f 100644 --- a/code/nel/include/nel/3d/animatable.h +++ b/code/nel/include/nel/3d/animatable.h @@ -19,6 +19,8 @@ #include "nel/misc/types_nl.h" #include "nel/misc/bit_set.h" +#include "nel/misc/smart_ptr.h" + #include #include #include diff --git a/code/nel/include/nel/3d/animated_lightmap.h b/code/nel/include/nel/3d/animated_lightmap.h index 51f1c909e..b8b887d7a 100644 --- a/code/nel/include/nel/3d/animated_lightmap.h +++ b/code/nel/include/nel/3d/animated_lightmap.h @@ -21,13 +21,17 @@ #include "nel/misc/types_nl.h" #include "nel/misc/smart_ptr.h" #include "nel/3d/animatable.h" + #include "nel/3d/track.h" + #include namespace NL3D { +class CScene; + // *************************************************************************** /** * An animated lightmap diff --git a/code/nel/include/nel/3d/async_file_manager_3d.h b/code/nel/include/nel/3d/async_file_manager_3d.h index dede1b419..4e86f10b1 100644 --- a/code/nel/include/nel/3d/async_file_manager_3d.h +++ b/code/nel/include/nel/3d/async_file_manager_3d.h @@ -88,7 +88,7 @@ private: public: std::string MeshName; public: - CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver, const CVector &position, uint selectedTexture); + CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver, const NLMISC::CVector &position, uint selectedTexture); void run (void); void getName (std::string &result) const; }; @@ -122,7 +122,7 @@ private: CTextureFile *TextureFile; bool *Signal; public: - CTextureLoad(CTextureFile *textureFile, bool *psgn, const CVector &position) + CTextureLoad(CTextureFile *textureFile, bool *psgn, const NLMISC::CVector &position) : TextureFile(textureFile), Signal(psgn) { Position = position; diff --git a/code/nel/include/nel/3d/async_texture_manager.h b/code/nel/include/nel/3d/async_texture_manager.h index 8a848cb52..af27c3fde 100644 --- a/code/nel/include/nel/3d/async_texture_manager.h +++ b/code/nel/include/nel/3d/async_texture_manager.h @@ -152,7 +152,7 @@ private: struct CTextureLodToSort { CTextureLod *Lod; - CVector Position; + NLMISC::CVector Position; bool operator<(const CTextureLodToSort &other) const { return Lod->WeightWeight; diff --git a/code/nel/include/nel/3d/camera_col.h b/code/nel/include/nel/3d/camera_col.h index 9151b0a22..6b5a30517 100644 --- a/code/nel/include/nel/3d/camera_col.h +++ b/code/nel/include/nel/3d/camera_col.h @@ -20,6 +20,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/vector.h" #include "nel/misc/plane.h" +#include "nel/misc/aabbox.h" namespace NL3D { @@ -39,16 +40,16 @@ public: /** build the camera collision as a cone or a cylinder */ - void build(const CVector &start, const CVector &end, float radius, bool cone); + void build(const NLMISC::CVector &start, const NLMISC::CVector &end, float radius, bool cone); /** build the camera collision as a simple ray */ - void buildRay(const CVector &start, const CVector &end); + void buildRay(const NLMISC::CVector &start, const NLMISC::CVector &end); /** compute the intersection of the Camera Volume against the triangle, and minimize * minDist (actual square of distance) with min sqr distance of the poly. */ - void minimizeDistanceAgainstTri(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist); + void minimizeDistanceAgainstTri(const NLMISC::CVector &p0, const NLMISC::CVector &p1, const NLMISC::CVector &p2, float &sqrMinDist); /** Compute into this the camera collision 'other' mul by 'matrix' * NB: for cone Radius, suppose uniform scale, else will have strange result (a uniform scale is deduced) @@ -69,9 +70,9 @@ private: enum {MaxNPlanes=6}; // The start of the camera raycast - CVector _Start; + NLMISC::CVector _Start; // The end of the camera raycast - CVector _End; + NLMISC::CVector _End; // The radius (at end only if cone) float _Radius; // cone or cylinder? @@ -83,8 +84,8 @@ private: NLMISC::CAABBox _BBox; // Temp Data for minimizeDistanceAgainstTri - CVector _ArrayIn[3+MaxNPlanes]; - CVector _ArrayOut[3+MaxNPlanes]; + NLMISC::CVector _ArrayIn[3+MaxNPlanes]; + NLMISC::CVector _ArrayOut[3+MaxNPlanes]; // The pyramid representing the camera collision volume. Nb: local to start for precision problems NLMISC::CPlane _Pyramid[MaxNPlanes]; @@ -97,10 +98,10 @@ private: float _MaxRadiusProj; float _OODeltaRadiusProj; float _RayLen; - CVector _RayNorm; + NLMISC::CVector _RayNorm; // simpler method for simple ray - void intersectRay(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist); + void intersectRay(const NLMISC::CVector &p0, const NLMISC::CVector &p1, const NLMISC::CVector &p2, float &sqrMinDist); }; diff --git a/code/nel/include/nel/3d/cloud_scape_user.h b/code/nel/include/nel/3d/cloud_scape_user.h index 15c926927..9e2a88376 100644 --- a/code/nel/include/nel/3d/cloud_scape_user.h +++ b/code/nel/include/nel/3d/cloud_scape_user.h @@ -22,6 +22,7 @@ namespace NL3D class UDriver; class UCamera; class CCloudScape; +class CScene; /// implementation of UWaterInstance methods class CCloudScapeUser : public UCloudScape diff --git a/code/nel/include/nel/3d/fasthls_modifier.h b/code/nel/include/nel/3d/fasthls_modifier.h index b5ec7ad82..de8f22a3d 100644 --- a/code/nel/include/nel/3d/fasthls_modifier.h +++ b/code/nel/include/nel/3d/fasthls_modifier.h @@ -48,7 +48,7 @@ public: static void releaseInstance(); /// convert a HLS (0..255) to a RGBA. - CRGBA convert(uint H, uint L, uint S); + NLMISC::CRGBA convert(uint H, uint L, uint S); /// convert a RGBA bitmap into another RGBA, with HLS decal (0..255, -255..+255, -255..+255). void convertRGBABitmap(NLMISC::CBitmap &dst, const NLMISC::CBitmap &src, uint8 dh, sint dl, sint ds); @@ -75,7 +75,7 @@ private: uint8 H,L,S,A; }; - CRGBA _HueTable[HueTableSize]; + NLMISC::CRGBA _HueTable[HueTableSize]; CHLSA _Color16ToHLS[65536]; /// Constructor diff --git a/code/nel/include/nel/3d/gpu_program_params.h b/code/nel/include/nel/3d/gpu_program_params.h index ce6b8b2f0..4615c58d9 100644 --- a/code/nel/include/nel/3d/gpu_program_params.h +++ b/code/nel/include/nel/3d/gpu_program_params.h @@ -27,7 +27,8 @@ #ifndef NL3D_GPU_PROGRAM_PARAMS_H #define NL3D_GPU_PROGRAM_PARAMS_H -#include + +#include "nel/misc/types_nl.h" // STL includes #include @@ -167,7 +168,7 @@ private: std::map m_MapName; // map from name to offset size_t m_First; size_t m_Last; - static const size_t s_End = -1; + static const size_t s_End; }; /* class CGPUProgramParams */ diff --git a/code/nel/include/nel/3d/ig_surface_light_build.h b/code/nel/include/nel/3d/ig_surface_light_build.h index e6b37b25c..77046dabb 100644 --- a/code/nel/include/nel/3d/ig_surface_light_build.h +++ b/code/nel/include/nel/3d/ig_surface_light_build.h @@ -26,6 +26,7 @@ namespace NL3D { + class CInstanceGroup; // *************************************************************************** /** @@ -106,14 +107,14 @@ public: public: /// Debug: build a colored Grid mesh of SunContribution. - void buildSunDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const CVector &deltaPos=CVector::Null); + void buildSunDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const NLMISC::CVector &deltaPos= NLMISC::CVector::Null); /// Debug: build a colored Grid mesh of PointLight. R= pointLight1 id. G= PointLight2 id. B= The multiplier used to show Ids. - void buildPLDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const CVector &deltaPos, const CInstanceGroup &igOut); + void buildPLDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const NLMISC::CVector &deltaPos, const CInstanceGroup &igOut); private: void addDebugMeshFaces(CMesh::CMeshBuild &meshBuild, CSurface &surface, uint vId0, - const std::vector &colors); + const std::vector &colors); }; diff --git a/code/nel/include/nel/3d/matrix_3x4.h b/code/nel/include/nel/3d/matrix_3x4.h index 45901c20e..7b8d6dcf6 100644 --- a/code/nel/include/nel/3d/matrix_3x4.h +++ b/code/nel/include/nel/3d/matrix_3x4.h @@ -47,7 +47,7 @@ public: float a31, a32, a33, a34; // Copy from a matrix. - void set(const CMatrix &mat) + void set(const NLMISC::CMatrix &mat) { const float *m =mat.get(); a11= m[0]; a12= m[4]; a13= m[8] ; a14= m[12]; @@ -57,14 +57,14 @@ public: // mulSetvector. NB: in should be different as v!! (else don't work). - void mulSetVector(const CVector &in, CVector &out) + void mulSetVector(const NLMISC::CVector &in, NLMISC::CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z); out.y= (a21*in.x + a22*in.y + a23*in.z); out.z= (a31*in.x + a32*in.y + a33*in.z); } // mulSetpoint. NB: in should be different as v!! (else don't work). - void mulSetPoint(const CVector &in, CVector &out) + void mulSetPoint(const NLMISC::CVector &in, NLMISC::CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z + a14); out.y= (a21*in.x + a22*in.y + a23*in.z + a24); @@ -73,14 +73,14 @@ public: // mulSetvector. NB: in should be different as v!! (else don't work). - void mulSetVector(const CVector &in, float scale, CVector &out) + void mulSetVector(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z) * scale; out.y= (a21*in.x + a22*in.y + a23*in.z) * scale; out.z= (a31*in.x + a32*in.y + a33*in.z) * scale; } // mulSetpoint. NB: in should be different as v!! (else don't work). - void mulSetPoint(const CVector &in, float scale, CVector &out) + void mulSetPoint(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z + a14) * scale; out.y= (a21*in.x + a22*in.y + a23*in.z + a24) * scale; @@ -89,14 +89,14 @@ public: // mulAddvector. NB: in should be different as v!! (else don't work). - void mulAddVector(const CVector &in, float scale, CVector &out) + void mulAddVector(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) { out.x+= (a11*in.x + a12*in.y + a13*in.z) * scale; out.y+= (a21*in.x + a22*in.y + a23*in.z) * scale; out.z+= (a31*in.x + a32*in.y + a33*in.z) * scale; } // mulAddpoint. NB: in should be different as v!! (else don't work). - void mulAddPoint(const CVector &in, float scale, CVector &out) + void mulAddPoint(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) { out.x+= (a11*in.x + a12*in.y + a13*in.z + a14) * scale; out.y+= (a21*in.x + a22*in.y + a23*in.z + a24) * scale; diff --git a/code/nel/include/nel/3d/meshvp_wind_tree.h b/code/nel/include/nel/3d/meshvp_wind_tree.h index e2c790d6d..d8e7598b7 100644 --- a/code/nel/include/nel/3d/meshvp_wind_tree.h +++ b/code/nel/include/nel/3d/meshvp_wind_tree.h @@ -124,7 +124,7 @@ private: double _LastSceneTime; // maximum amplitude vector for each level. Stored in mesh because same for all instances. - CVector _MaxDeltaPos[HrcDepth]; + NLMISC::CVector _MaxDeltaPos[HrcDepth]; float _MaxVertexMove; // MBR Cache diff --git a/code/nel/include/nel/3d/particle_system_manager.h b/code/nel/include/nel/3d/particle_system_manager.h index f48b17f1b..1e02963bb 100644 --- a/code/nel/include/nel/3d/particle_system_manager.h +++ b/code/nel/include/nel/3d/particle_system_manager.h @@ -87,7 +87,7 @@ private: { public: CParticleSystemModel *Model; - CMatrix OldAncestorMatOrRelPos; // last matrix of ancestor skeleton or relative matrix of ps to its ancestor (see flag below) + NLMISC::CMatrix OldAncestorMatOrRelPos; // last matrix of ancestor skeleton or relative matrix of ps to its ancestor (see flag below) bool IsRelMatrix; // gives usage of the field OldAncestorMatOrRelPos bool HasAncestorSkeleton; // has the system an ancestor skeleton ? public: diff --git a/code/nel/include/nel/3d/quad_grid.h b/code/nel/include/nel/3d/quad_grid.h index 12160b540..b03164520 100644 --- a/code/nel/include/nel/3d/quad_grid.h +++ b/code/nel/include/nel/3d/quad_grid.h @@ -654,7 +654,7 @@ template typename CQuadGrid::CIterator CQuadGrid::erase(typename if(!ptr->Selected) next= NULL; // delete the object. - _NodeBlockMemory.free(ptr); + _NodeBlockMemory.freeBlock(ptr); return CIterator((CNode*)next); diff --git a/code/nel/include/nel/3d/ray_mesh.h b/code/nel/include/nel/3d/ray_mesh.h index 80671a49c..70a25c2be 100644 --- a/code/nel/include/nel/3d/ray_mesh.h +++ b/code/nel/include/nel/3d/ray_mesh.h @@ -53,7 +53,7 @@ public: public: // Simple Definition of a mesh used to test against Ray - std::vector Vertices; + std::vector Vertices; std::vector Triangles; /// Empty? diff --git a/code/nel/include/nel/3d/render_trav.h b/code/nel/include/nel/3d/render_trav.h index 6e41d8282..41570c2ca 100644 --- a/code/nel/include/nel/3d/render_trav.h +++ b/code/nel/include/nel/3d/render_trav.h @@ -28,6 +28,8 @@ #include "nel/3d/shadow_map_manager.h" #include "nel/3d/u_scene.h" #include "nel/3d/vertex_program.h" +#include "nel/3d/transform.h" + #include diff --git a/code/nel/include/nel/3d/seg_remanence_shape.h b/code/nel/include/nel/3d/seg_remanence_shape.h index 6a1f2cb5e..80d54b6ca 100644 --- a/code/nel/include/nel/3d/seg_remanence_shape.h +++ b/code/nel/include/nel/3d/seg_remanence_shape.h @@ -22,7 +22,7 @@ #include "nel/misc/smart_ptr.h" #include "nel/misc/vector.h" #include "nel/misc/aabbox.h" - +#include "nel/misc/class_id.h" #include "nel/3d/texture.h" #include "nel/3d/shape.h" diff --git a/code/nel/include/nel/3d/shadow_map.h b/code/nel/include/nel/3d/shadow_map.h index aa4921594..84cc32af1 100644 --- a/code/nel/include/nel/3d/shadow_map.h +++ b/code/nel/include/nel/3d/shadow_map.h @@ -51,7 +51,7 @@ public: * The usage of this matrix is for UV projection: XYZ= WorldProjectionMatrix * UVW. * NB: Vj (ie for W) is mapped such that Vp means NearClip of the shadow and Vp+Vj means FarClip of the shadow */ - CMatrix LocalProjectionMatrix; + NLMISC::CMatrix LocalProjectionMatrix; /** Computed at shadow casting time. They are clipping planes used to clip receivers (mirror of the OBB). * Receivers may use them to clip sub received parts (as they which) @@ -63,7 +63,7 @@ public: /** Computed at shadow casting time. This is the LocalPos Bouding Box containing the shadow (AxisAligned). * \see generateClipInfoFromMatrix() */ - CAABBox LocalBoundingBox; + NLMISC::CAABBox LocalBoundingBox; // Filled by ShadowMapManager. This is the Last Frame Id we had update the texture. @@ -114,13 +114,13 @@ public: * driver->setupModelMatrix(localPosMatrix); * Then render his mesh. */ - void buildCasterCameraMatrix(const CVector &lightDir, const CMatrix &localPosMatrix, const CAABBox &bbShape, CMatrix &cameraMatrix); + void buildCasterCameraMatrix(const NLMISC::CVector &lightDir, const NLMISC::CMatrix &localPosMatrix, const NLMISC::CAABBox &bbShape, NLMISC::CMatrix &cameraMatrix); /** From the Camera matrix computed with buildCasterCameraMatrix, compute the LocalProjectionMatrix, which modify the * J axis according to backPoint and Shadow Depth. * NB: automatically calls the buildClipInfoFromMatrix() method */ - void buildProjectionInfos(const CMatrix &cameraMatrix, const CVector &backPoint, float shadowMaxDepth); + void buildProjectionInfos(const NLMISC::CMatrix &cameraMatrix, const NLMISC::CVector &backPoint, float shadowMaxDepth); /** The ShadowMap Caster can call this method after setting LocalProjectionMatrix. It computes auto the * LocalClipPlanes and LocalBoundingBox from it. NB: don't use it if you use buildProjectionInfos(). @@ -158,13 +158,13 @@ class CShadowMapProjector { public: CShadowMapProjector(); - void setWorldSpaceTextMat(const CMatrix &ws); - void applyToMaterial(const CMatrix &receiverWorldMatrix, CMaterial &material); + void setWorldSpaceTextMat(const NLMISC::CMatrix &ws); + void applyToMaterial(const NLMISC::CMatrix &receiverWorldMatrix, CMaterial &material); private: - CMatrix _WsTextMat; - CMatrix _XYZToUWVMatrix; - CMatrix _XYZToWUVMatrix; + NLMISC::CMatrix _WsTextMat; + NLMISC::CMatrix _XYZToUWVMatrix; + NLMISC::CMatrix _XYZToWUVMatrix; }; diff --git a/code/nel/include/nel/3d/shadow_map_manager.h b/code/nel/include/nel/3d/shadow_map_manager.h index d52c0fb03..8f8267492 100644 --- a/code/nel/include/nel/3d/shadow_map_manager.h +++ b/code/nel/include/nel/3d/shadow_map_manager.h @@ -29,7 +29,8 @@ namespace NL3D { -class CTransform; +class CTransform; +class CScene; // *************************************************************************** diff --git a/code/nel/include/nel/3d/shadow_skin.h b/code/nel/include/nel/3d/shadow_skin.h index 2b63a635d..7560e0c50 100644 --- a/code/nel/include/nel/3d/shadow_skin.h +++ b/code/nel/include/nel/3d/shadow_skin.h @@ -33,9 +33,9 @@ namespace NL3D class CShadowVertex { public: - CVector Vertex; - uint32 MatrixId; - void serial(NLMISC::IStream &f) + NLMISC::CVector Vertex; + uint32 MatrixId; + void serial(NLMISC::IStream &f) { (void)f.serialVersion(0); @@ -82,7 +82,7 @@ public: * if don't intersect, dist2D="nearest distance to the ray", and distZ=0 * \param computeDist2D if false and don't intersect, then return dist2D=FLT_MAX, and distZ=0 */ - bool getRayIntersection(const CMatrix &toRaySpace, class CSkeletonModel &skeleton, + bool getRayIntersection(const NLMISC::CMatrix &toRaySpace, class CSkeletonModel &skeleton, const std::vector &matrixInfluences, float &dist2D, float &distZ, bool computeDist2D); private: diff --git a/code/nel/include/nel/3d/stereo_hmd.h b/code/nel/include/nel/3d/stereo_hmd.h index 3276e78fe..69f8e60dd 100644 --- a/code/nel/include/nel/3d/stereo_hmd.h +++ b/code/nel/include/nel/3d/stereo_hmd.h @@ -54,7 +54,7 @@ public: virtual NLMISC::CQuat getOrientation() const = 0; /// Set the GUI reference - virtual void setInterfaceMatrix(const NL3D::CMatrix &matrix) = 0; + virtual void setInterfaceMatrix(const NLMISC::CMatrix &matrix) = 0; /// Get GUI center (1 = width, 1 = height, 0 = center) virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const = 0; diff --git a/code/nel/include/nel/3d/target_anim_ctrl.h b/code/nel/include/nel/3d/target_anim_ctrl.h index b2edf9f84..19aae3c20 100644 --- a/code/nel/include/nel/3d/target_anim_ctrl.h +++ b/code/nel/include/nel/3d/target_anim_ctrl.h @@ -44,16 +44,16 @@ public: public: /// Target controled or direction controled. Default to DirectionMode - TMode Mode; + TMode Mode; /// \name Target and Direction specific // @{ /// For TargetMode, the world Position of the target. - CVector WorldTarget; + NLMISC::CVector WorldTarget; /// For TargetMode only, the Pos of eyes relative to the bone controlled. Default to (0,0,0) - CVector EyePos; + NLMISC::CVector EyePos; /// For DirectionMode, the WorldRotation to apply to the bone. NB: modified in execute() if TargetMode - CQuat CurrentWorldDirection; + NLMISC::CQuat CurrentWorldDirection; // @} /// \name Common @@ -61,13 +61,13 @@ public: /** This enable or disable the ctrl. When disabled or enabled, the ctrl ensure * that the movement does not "pop", respecting MaxAngularVelocity. Default to true. */ - bool Enabled; + bool Enabled; /// This give The World Orientation when the Mesh is in bind Pos (default to "LookBack"). - CQuat DefaultWorldDirection; + NLMISC::CQuat DefaultWorldDirection; /// The Maximum angle of rotation that can be performed between the Default Direction and Current Direction. Default to Pi/3 - float MaxAngle; + float MaxAngle; /// The Maximum Angular Velocity the ctrl can perform. Default to 2*Pi per second. - float MaxAngularVelocity; + float MaxAngularVelocity; // @} @@ -77,19 +77,19 @@ public: virtual ~CTargetAnimCtrl(); /// Called at compute() time. - virtual void execute(CSkeletonModel *model, CBone *bone); + virtual void execute(CSkeletonModel *model, CBone *bone); private: /// The last rotation computed (in LocalSkeleton Space). Used to smooth transition - CQuat _LastLSRotation; + NLMISC::CQuat _LastLSRotation; /// This tells that a Enable/Disable transition is in progress. - bool _LastEnabled; - bool _EnableToDisableTransition; + bool _LastEnabled; + bool _EnableToDisableTransition; - CQuat getCurrentLSRotationFromBone(CSkeletonModel *model, CBone *bone); + NLMISC::CQuat getCurrentLSRotationFromBone(CSkeletonModel *model, CBone *bone); }; diff --git a/code/nel/include/nel/3d/texture_emboss.h b/code/nel/include/nel/3d/texture_emboss.h index a4c469a5c..cdab6d648 100644 --- a/code/nel/include/nel/3d/texture_emboss.h +++ b/code/nel/include/nel/3d/texture_emboss.h @@ -54,16 +54,16 @@ public: bool isSharingEnabled() const { return !_DisableSharing; } // set the ambiant/ diffuse color to be added to the embossed texture - void setAmbient(CRGBA ambient) { _Ambient = ambient; touch(); } - void setDiffuse(CRGBA diffuse) { _Diffuse = diffuse; touch(); } + void setAmbient(NLMISC::CRGBA ambient) { _Ambient = ambient; touch(); } + void setDiffuse(NLMISC::CRGBA diffuse) { _Diffuse = diffuse; touch(); } // Set the direction of light (usually should be normalized). The bitmap is in the x,y plane void setLightDir(const NLMISC::CVector &lightDir) { _LightDir = lightDir; touch(); } // set a factor for the slope void setSlopeFactor(float factor) { _SlopeFactor = factor; touch(); } // - CRGBA getAmbient() const { return _Ambient; } - CRGBA getDiffuse() const { return _Diffuse; } - const CVector &getLightDir() const { return _LightDir; } + NLMISC::CRGBA getAmbient() const { return _Ambient; } + NLMISC::CRGBA getDiffuse() const { return _Diffuse; } + const NLMISC::CVector &getLightDir() const { return _LightDir; } float getSlopeFactor() const { return _SlopeFactor; } @@ -75,8 +75,8 @@ protected: // inherited from ITexture. Generate this bumpmap pixels virtual void doGenerate(bool async = false); NLMISC::CSmartPtr _HeightMap; - CRGBA _Ambient; - CRGBA _Diffuse; + NLMISC::CRGBA _Ambient; + NLMISC::CRGBA _Diffuse; NLMISC::CVector _LightDir; bool _DisableSharing; float _SlopeFactor; diff --git a/code/nel/include/nel/3d/tile_bank.h b/code/nel/include/nel/3d/tile_bank.h index ec96afb64..1205c5940 100644 --- a/code/nel/include/nel/3d/tile_bank.h +++ b/code/nel/include/nel/3d/tile_bank.h @@ -140,7 +140,7 @@ public: private: void clearTile (CTile::TBitmap type); - void free () + void freeBlock () { nlassert ((_Flags&=NL3D_CTILE_FREE_FLAG)==0); _Flags|=NL3D_CTILE_FREE_FLAG; diff --git a/code/nel/include/nel/3d/u_transform.h b/code/nel/include/nel/3d/u_transform.h index 556be7908..66315fa40 100644 --- a/code/nel/include/nel/3d/u_transform.h +++ b/code/nel/include/nel/3d/u_transform.h @@ -32,6 +32,7 @@ using NLMISC::CQuat; class ILogicInfo; class CCluster; +class ITransformable; // *************************************************************************** /** diff --git a/code/nel/include/nel/3d/vegetable_light_ex.h b/code/nel/include/nel/3d/vegetable_light_ex.h index a513dbeab..d9c1f2f0b 100644 --- a/code/nel/include/nel/3d/vegetable_light_ex.h +++ b/code/nel/include/nel/3d/vegetable_light_ex.h @@ -48,7 +48,7 @@ public: /// PointLights. Used at CVegetableManager::updateLighting() to get current colors of pointLights. CPointLightNamed *PointLight[MaxNumLight]; /// Direction of the light. the direction to the instance should be precomputed. - CVector Direction[MaxNumLight]; + NLMISC::CVector Direction[MaxNumLight]; /// Factor to be multiplied by color of the light. Actually it is the attenuation factor. uint PointLightFactor[MaxNumLight]; diff --git a/code/nel/include/nel/3d/vertex_buffer_heap.h b/code/nel/include/nel/3d/vertex_buffer_heap.h index c87426f7b..009d72489 100644 --- a/code/nel/include/nel/3d/vertex_buffer_heap.h +++ b/code/nel/include/nel/3d/vertex_buffer_heap.h @@ -69,7 +69,7 @@ public: bool allocate(uint numVertices, uint &indexStart); /// free a subset of the VB. nlstop if subset not found... - void free(uint indexStart); + void freeBlock(uint indexStart); // @} diff --git a/code/nel/include/nel/3d/water_env_map.h b/code/nel/include/nel/3d/water_env_map.h index 50fca18ec..2282610d7 100644 --- a/code/nel/include/nel/3d/water_env_map.h +++ b/code/nel/include/nel/3d/water_env_map.h @@ -21,6 +21,7 @@ // #include "nel/3d/texture_cube.h" #include "nel/3d/texture_blank.h" +#include "nel/3d/animation_time.h" namespace NL3D diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 2f9220cda..4d96be1b5 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -502,7 +502,7 @@ namespace NLGUI const CEventDescriptorKey& getLastKeyEvent() const{ return lastKeyEvent; } - IParser* getParser() const{ return parser; } + IParser* getParser() const{ return _Parser; } /// Retrieves the Id of the currently selected widgets void getEditorSelection( std::vector< std::string > &selection ); @@ -536,7 +536,7 @@ namespace NLGUI CWidgetManager(); ~CWidgetManager(); - IParser *parser; + IParser *_Parser; static CWidgetManager *instance; std::vector< SMasterGroup > _MasterGroups; diff --git a/code/nel/src/ligo/ligo_error.h b/code/nel/include/nel/ligo/ligo_error.h similarity index 100% rename from code/nel/src/ligo/ligo_error.h rename to code/nel/include/nel/ligo/ligo_error.h diff --git a/code/nel/src/ligo/zone_template.h b/code/nel/include/nel/ligo/zone_template.h similarity index 100% rename from code/nel/src/ligo/zone_template.h rename to code/nel/include/nel/ligo/zone_template.h diff --git a/code/nel/include/nel/misc/big_file.h b/code/nel/include/nel/misc/big_file.h index 14851d69e..95fc09b41 100644 --- a/code/nel/include/nel/misc/big_file.h +++ b/code/nel/include/nel/misc/big_file.h @@ -112,7 +112,8 @@ public: // A BNP structure struct BNP { - BNP() : FileNames(NULL), ThreadFileId(0), CacheFileOnOpen(false), AlwaysOpened(false), InternalUse(false), OffsetFromBeginning(0) { } + BNP(); + ~BNP(); // FileName of the BNP. important to open it in getFile() (for other threads or if not always opened). std::string BigFileName; @@ -163,6 +164,7 @@ private: { public: CThreadFileArray(); + ~CThreadFileArray(); // Allocate a FileId for a BNP. uint32 allocate(); diff --git a/code/nel/include/nel/misc/block_memory.h b/code/nel/include/nel/misc/block_memory.h index 65fb36c46..912f92d1c 100644 --- a/code/nel/include/nel/misc/block_memory.h +++ b/code/nel/include/nel/misc/block_memory.h @@ -132,7 +132,7 @@ public: } /// delete an element allocated with this manager. dtor is called. NULL is tested. - void free(T* ptr) + void freeBlock(T* ptr) { if(!ptr) return; diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index f1c090c2b..c7c1369c5 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -690,10 +690,10 @@ inline int nlisprint(int c) #endif // Open an url in a browser -bool openURL (const char *url); +bool openURL (const std::string &url); // Open a document -bool openDoc (const char *document); +bool openDoc (const std::string &document); // AntiBug method that return an epsilon if x==0, else x inline float favoid0(float x) diff --git a/code/nel/include/nel/misc/contiguous_block_allocator.h b/code/nel/include/nel/misc/contiguous_block_allocator.h index 7a15d296d..43d6fac09 100644 --- a/code/nel/include/nel/misc/contiguous_block_allocator.h +++ b/code/nel/include/nel/misc/contiguous_block_allocator.h @@ -55,7 +55,7 @@ public: // allocated a block of n bytes void *alloc(uint numBytes); // deallocate a block - void free(void *block, uint numBytes); + void freeBlock(void *block, uint numBytes); // compute the total number of bytes allocated since init // NB : freed block are not subtracted from that total !! uint getNumAllocatedBytes() const { return _NumAllocatedBytes; } diff --git a/code/nel/include/nel/misc/debug.h b/code/nel/include/nel/misc/debug.h index 54e22880d..d01c85f1c 100644 --- a/code/nel/include/nel/misc/debug.h +++ b/code/nel/include/nel/misc/debug.h @@ -151,8 +151,8 @@ void setCrashAlreadyReported(bool state); * Note 2 : To show a warning under GCC, use #warning "Your warning here", * see nel/net/net_manager.h for an example on how to use these correctly. */ -#define NL_LOC_MSG __FILE__"("NL_MACRO_TO_STR(__LINE__)") : Message: " -#define NL_LOC_WRN __FILE__"("NL_MACRO_TO_STR(__LINE__)") : Warning Msg: " +#define NL_LOC_MSG __FILE__ "(" NL_MACRO_TO_STR(__LINE__) ") : Message: " +#define NL_LOC_WRN __FILE__ "(" NL_MACRO_TO_STR(__LINE__) ") : Warning Msg: " /** diff --git a/code/nel/include/nel/misc/fixed_size_allocator.h b/code/nel/include/nel/misc/fixed_size_allocator.h index 079c54bc0..ffc975250 100644 --- a/code/nel/include/nel/misc/fixed_size_allocator.h +++ b/code/nel/include/nel/misc/fixed_size_allocator.h @@ -45,7 +45,7 @@ public: /// alloc a block void *alloc(); /// destroy and dealloc a block - void free(void *block); + void freeBlock(void *block); // uint getNumBytesPerBlock() const { return _NumBytesPerBlock; } uint getNumBlockPerChunk() const { return _NumBlockPerChunk; } diff --git a/code/nel/include/nel/misc/heap_memory.h b/code/nel/include/nel/misc/heap_memory.h index cd1a4ab2b..0aeb3aec5 100644 --- a/code/nel/include/nel/misc/heap_memory.h +++ b/code/nel/include/nel/misc/heap_memory.h @@ -65,7 +65,7 @@ public: */ void *allocate(uint size); /// free a block allocated with alloate(). no-op if NULL. nlstop() if don't find this block. - void free(void *ptr); + void freeBlock(void *ptr); // ********************* diff --git a/code/nel/include/nel/misc/object_arena_allocator.h b/code/nel/include/nel/misc/object_arena_allocator.h index 6d318aca8..929721a64 100644 --- a/code/nel/include/nel/misc/object_arena_allocator.h +++ b/code/nel/include/nel/misc/object_arena_allocator.h @@ -49,7 +49,7 @@ public: */ void *alloc(uint size); // free an object that has previously been allocated with alloc. size should be remembered by the caller. - void free(void *); + void freeBlock(void *); // get the number of allocated objects uint getNumAllocatedBlocks() const; # ifdef NL_DEBUG @@ -82,7 +82,9 @@ private: // NL_USES_DEFAULT_ARENA_OBJECT_ALLOCATOR // for fast alloc # define NL_USES_DEFAULT_ARENA_OBJECT_ALLOCATOR \ void *operator new(size_t size) { return NLMISC::CObjectArenaAllocator::getDefaultAllocator().alloc((uint) size); }\ - void operator delete(void *block) { NLMISC::CObjectArenaAllocator::getDefaultAllocator().free(block); } + void *operator new(size_t size, int _BlockUse, char const* _FileName, int _LineNumber) { return NLMISC::CObjectArenaAllocator::getDefaultAllocator().alloc((uint) size); }\ + void operator delete(void *block) { NLMISC::CObjectArenaAllocator::getDefaultAllocator().freeBlock(block); }\ + void operator delete(void *block, int _BlockUse, char const* _FileName, int _LineNumber) { NLMISC::CObjectArenaAllocator::getDefaultAllocator().freeBlock(block); } } diff --git a/code/nel/include/nel/misc/pool_memory.h b/code/nel/include/nel/misc/pool_memory.h index def4125dc..1bd3dbda9 100644 --- a/code/nel/include/nel/misc/pool_memory.h +++ b/code/nel/include/nel/misc/pool_memory.h @@ -90,7 +90,7 @@ public: /* * Free all the elements allocated since last free(). Memory is kept for next allocations. */ - void free () + void freeBlock () { typename std::list< std::vector >::iterator ite=_BlockList.begin(); while (ite!=_BlockList.end()) diff --git a/code/nel/include/nel/misc/string_common.h b/code/nel/include/nel/misc/string_common.h index b8a12ad77..2839c2bfc 100644 --- a/code/nel/include/nel/misc/string_common.h +++ b/code/nel/include/nel/misc/string_common.h @@ -28,8 +28,8 @@ namespace NLMISC { // get a string and add \r before \n if necessary -std::string addSlashR (std::string str); -std::string removeSlashR (std::string str); +std::string addSlashR (const std::string &str); +std::string removeSlashR (const std::string &str); /** * \def MaxCStringSize diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 5f25387f5..4f9302260 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -386,17 +386,17 @@ typedef unsigned int uint; // at least 32bits (depend of processor) #include #include #include -inline void *aligned_malloc(size_t size, size_t alignment) { return _aligned_malloc(size, alignment); } -inline void aligned_free(void *ptr) { _aligned_free(ptr); } +#define aligned_malloc(size, alignment) _aligned_malloc(size, alignment) +#define aligned_free(ptr) _aligned_free(ptr) #elif defined(NL_OS_MAC) #include // under Mac OS X, malloc is already aligned for SSE and Altivec (16 bytes alignment) -inline void *aligned_malloc(size_t size, size_t /* alignment */) { return malloc(size); } -inline void aligned_free(void *ptr) { free(ptr); } +#define aligned_malloc(size, alignment) malloc(size) +#define aligned_free(ptr) free(ptr) #else #include -inline void *aligned_malloc(size_t size, size_t alignment) { return memalign(alignment, size); } -inline void aligned_free(void *ptr) { free(ptr); } +#define aligned_malloc(size, alignment) memalign(alignment, size) +#define aligned_free(ptr) free(ptr) #endif /* NL_COMP_ */ diff --git a/code/nel/include/nel/misc/win_tray.h b/code/nel/include/nel/misc/win_tray.h deleted file mode 100644 index 42b6d78e6..000000000 --- a/code/nel/include/nel/misc/win_tray.h +++ /dev/null @@ -1,15 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . diff --git a/code/nel/include/nel/net/service.h b/code/nel/include/nel/net/service.h index 8c7a52c63..02967d317 100644 --- a/code/nel/include/nel/net/service.h +++ b/code/nel/include/nel/net/service.h @@ -124,7 +124,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL scn->setArgs (lpCmdLine); \ createDebug(NULL,!scn->haveLongArg("nolog"));\ scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \ - sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__" "__TIME__); \ + sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \ delete scn; \ return retval; \ } @@ -139,7 +139,7 @@ int main(int argc, const char **argv) \ scn->setArgs (argc, argv); \ createDebug(NULL,!scn->haveLongArg("nolog"));\ scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \ - sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__" "__TIME__); \ + sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \ delete scn; \ return retval; \ } diff --git a/code/nel/src/3d/animation.cpp b/code/nel/src/3d/animation.cpp index a604d2bde..b33f337d2 100644 --- a/code/nel/src/3d/animation.cpp +++ b/code/nel/src/3d/animation.cpp @@ -30,6 +30,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/3d/animation_optimizer.cpp b/code/nel/src/3d/animation_optimizer.cpp index 726086f8b..9205fde39 100644 --- a/code/nel/src/3d/animation_optimizer.cpp +++ b/code/nel/src/3d/animation_optimizer.cpp @@ -29,6 +29,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/3d/cloud.cpp b/code/nel/src/3d/cloud.cpp index eb53589ce..bfd83ba80 100644 --- a/code/nel/src/3d/cloud.cpp +++ b/code/nel/src/3d/cloud.cpp @@ -25,6 +25,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { diff --git a/code/nel/src/3d/coarse_mesh_build.cpp b/code/nel/src/3d/coarse_mesh_build.cpp index 8a712a57f..fec5f0b3f 100644 --- a/code/nel/src/3d/coarse_mesh_build.cpp +++ b/code/nel/src/3d/coarse_mesh_build.cpp @@ -19,6 +19,7 @@ #include "nel/3d/coarse_mesh_build.h" #include "nel/3d/mesh.h" +#include "nel/3d/debug_vb.h" using namespace NLMISC; diff --git a/code/nel/src/3d/coarse_mesh_manager.cpp b/code/nel/src/3d/coarse_mesh_manager.cpp index f45ca7675..6ba8b3ec6 100644 --- a/code/nel/src/3d/coarse_mesh_manager.cpp +++ b/code/nel/src/3d/coarse_mesh_manager.cpp @@ -21,6 +21,8 @@ #include "nel/3d/texture_file.h" #include "nel/misc/hierarchical_timer.h" #include "nel/3d/clip_trav.h" +#include "nel/3d/debug_vb.h" + #include "nel/misc/fast_mem.h" diff --git a/code/nel/src/3d/computed_string.cpp b/code/nel/src/3d/computed_string.cpp index 1a9fefba5..6bc1be856 100644 --- a/code/nel/src/3d/computed_string.cpp +++ b/code/nel/src/3d/computed_string.cpp @@ -22,6 +22,7 @@ #include "nel/3d/material.h" #include "nel/3d/frustum.h" #include "nel/3d/viewport.h" +#include "nel/3d/debug_vb.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/debug.h" diff --git a/code/nel/src/3d/driver/direct3d/stddirect3d.h b/code/nel/src/3d/driver/direct3d/stddirect3d.h index c7b6f7f3e..366627b44 100644 --- a/code/nel/src/3d/driver/direct3d/stddirect3d.h +++ b/code/nel/src/3d/driver/direct3d/stddirect3d.h @@ -14,15 +14,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Default NeL includes -#include "nel/misc/types_nl.h" +#ifndef STDDIRECT3D_H +#define STDDIRECT3D_H -#ifdef NL_OS_WINDOWS -# define WIN32_LEAN_AND_MEAN -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #endif // System includes @@ -42,16 +41,14 @@ #include #include +// Default NeL includes +#include "nel/misc/types_nl.h" #ifdef NL_DEBUG // add Direct3D debug infos #define D3D_DEBUG_INFO #endif -// Directx includes -#include -#include - // NeL includes #include "nel/misc/common.h" #include "nel/misc/debug.h" @@ -59,3 +56,17 @@ #include "nel/misc/mem_stream.h" #include "nel/misc/time_nl.h" #include "nel/misc/command.h" + +#ifdef NL_OS_WINDOWS +# define WIN32_LEAN_AND_MEAN +# ifndef NL_COMP_MINGW +# define NOMINMAX +# endif +# include +#endif + +// Directx includes +#include +#include + +#endif diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 3f2dca9b6..80b424cba 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -36,6 +36,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 9d9143515..91a2fcab3 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -61,6 +61,9 @@ void (*nglGetProcAddress(const char *procName))() } #endif // NL_OS_WINDOWS +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif // *************************************************************************** // The exported function names diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp index 46804cce1..0d27166fc 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp @@ -33,6 +33,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp index 7b52e3225..a9b62b6b6 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp @@ -19,6 +19,10 @@ #include "driver_opengl.h" #include "nel/3d/light.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index e5375a49c..bf9845103 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -21,6 +21,10 @@ #include "nel/3d/texture_bump.h" #include "nel/3d/material.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp index 41575024c..392aa3f5d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp @@ -17,6 +17,10 @@ #include "stdopengl.h" #include "driver_opengl.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp index dd66328e9..67af0df64 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp @@ -38,6 +38,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index 8ec7a6bc8..5fd9e6416 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -22,6 +22,10 @@ // define it For Debug purpose only. Normal use is to hide this line //#define NL3D_GLSTATE_DISABLE_CACHE +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index a46f7ef12..95eaf8465 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -28,6 +28,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif //#define NEL_DUMP_UPLOAD_TIME diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp index f981ae3ba..bd945c1a1 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp @@ -21,6 +21,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp index 39f71d77a..ecadaaac2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp @@ -26,6 +26,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif @@ -1710,9 +1713,9 @@ void CDriverGL::resetVertexArrayRange() // After, Clear the 2 vertexArrayRange, if any. if(_AGPVertexArrayRange) - _AGPVertexArrayRange->free(); + _AGPVertexArrayRange->freeBlock(); if(_VRAMVertexArrayRange) - _VRAMVertexArrayRange->free(); + _VRAMVertexArrayRange->freeBlock(); } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 25c7da614..b625af7f2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -24,6 +24,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC @@ -163,7 +167,7 @@ uint CVertexArrayRangeNVidia::sizeAllocated() const // *************************************************************************** -void CVertexArrayRangeNVidia::free() +void CVertexArrayRangeNVidia::freeBlock() { H_AUTO_OGL(CVertexArrayRangeNVidia_free) // release the ptr. @@ -240,7 +244,7 @@ void *CVertexArrayRangeNVidia::allocateVB(uint32 size) void CVertexArrayRangeNVidia::freeVB(void *ptr) { H_AUTO_OGL(CVertexArrayRangeNVidia_freeVB) - _HeapMemory.free(ptr); + _HeapMemory.freeBlock(ptr); } @@ -541,7 +545,7 @@ uint CVertexArrayRangeATI::sizeAllocated() const return _VertexArraySize; } // *************************************************************************** -void CVertexArrayRangeATI::free() +void CVertexArrayRangeATI::freeBlock() { H_AUTO_OGL(CVertexArrayRangeATI_free) // release the ptr. @@ -619,7 +623,7 @@ void *CVertexArrayRangeATI::allocateVB(uint32 size) void CVertexArrayRangeATI::freeVB(void *ptr) { H_AUTO_OGL(CVertexArrayRangeATI_freeVB) - _HeapMemory.free(ptr); + _HeapMemory.freeBlock(ptr); } @@ -849,7 +853,7 @@ bool CVertexArrayRangeMapObjectATI::allocate(uint32 size, CVertexBuffer::TPrefer } // *************************************************************************** -void CVertexArrayRangeMapObjectATI::free() +void CVertexArrayRangeMapObjectATI::freeBlock() { H_AUTO_OGL(CVertexArrayRangeMapObjectATI_free) _SizeAllocated = 0; @@ -1201,7 +1205,7 @@ bool CVertexArrayRangeARB::allocate(uint32 size, CVertexBuffer::TPreferredMemory } // *************************************************************************** -void CVertexArrayRangeARB::free() +void CVertexArrayRangeARB::freeBlock() { H_AUTO_OGL(CVertexArrayRangeARB_free) _SizeAllocated = 0; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h index 1ec64ccf2..302ff0de8 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h @@ -57,7 +57,7 @@ public: /// allocate a vertex array space. false if error. client must free before re-allocate. virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType)= 0; /// free this space. - virtual void free()= 0; + virtual void freeBlock()= 0; /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb) =0; /// return the size allocated. 0 if not allocated or failure @@ -141,7 +141,7 @@ public: /// allocate a vertex array sapce. false if error. must free before re-allocate. virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure @@ -258,7 +258,7 @@ public: /// allocate a vertex array sapce. false if error. must free before re-allocate. virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure @@ -367,7 +367,7 @@ public: */ virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure @@ -480,7 +480,7 @@ public: */ virtual bool allocate(uint32 size, CVertexBuffer::TPreferredMemory vbType); /// free this space. - virtual void free(); + virtual void freeBlock(); /// create a IVertexBufferHardGL virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb); /// return the size allocated. 0 if not allocated or failure diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index c2e37ac89..e9ac4814a 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -28,6 +28,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + //#define DEBUG_SETUP_EXT_VERTEX_SHADER namespace NL3D { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 4469550b3..9fe51ea1d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -44,6 +44,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/stdopengl.h b/code/nel/src/3d/driver/opengl/stdopengl.h index 3066a778a..28ed25fc9 100644 --- a/code/nel/src/3d/driver/opengl/stdopengl.h +++ b/code/nel/src/3d/driver/opengl/stdopengl.h @@ -17,7 +17,12 @@ #ifndef STDOPENGL_H #define STDOPENGL_H -#include "nel/misc/types_nl.h" +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif #include #include @@ -35,6 +40,8 @@ #include #include +#include "nel/misc/types_nl.h" + #ifdef NL_OS_WINDOWS # define WIN32_LEAN_AND_MEAN # ifndef NL_COMP_MINGW diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index b55ad5865..898c9f001 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -26,6 +26,9 @@ #include #include "nel/misc/debug.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index 812bb52a9..b236223b7 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -33,6 +33,8 @@ #include "nel/3d/water_env_map_user.h" #include "nel/3d/water_pool_manager.h" #include "nel/3d/u_camera.h" +#include "nel/3d/debug_vb.h" + #include "nel/misc/hierarchical_timer.h" #include "nel/misc/event_emitter.h" diff --git a/code/nel/src/3d/flare_model.cpp b/code/nel/src/3d/flare_model.cpp index f964a9102..c48e754cf 100644 --- a/code/nel/src/3d/flare_model.cpp +++ b/code/nel/src/3d/flare_model.cpp @@ -26,8 +26,9 @@ #include "nel/3d/occlusion_query.h" #include "nel/3d/mesh.h" #include "nel/3d/viewport.h" -#include "nel/misc/common.h" +#include "nel/3d/debug_vb.h" +#include "nel/misc/common.h" namespace NL3D { diff --git a/code/nel/src/3d/gpu_program_params.cpp b/code/nel/src/3d/gpu_program_params.cpp index 9e84865be..f46ba8713 100644 --- a/code/nel/src/3d/gpu_program_params.cpp +++ b/code/nel/src/3d/gpu_program_params.cpp @@ -26,7 +26,6 @@ */ #include "std3d.h" -#include "nel/misc/types_nl.h" #include "nel/3d/gpu_program_params.h" // STL includes @@ -44,14 +43,14 @@ using namespace std; namespace NL3D { +const size_t CGPUProgramParams::s_End = -1; + CGPUProgramParams::CGPUProgramParams() : m_First(s_End), m_Last(s_End) { - } CGPUProgramParams::~CGPUProgramParams() { - } void CGPUProgramParams::copy(CGPUProgramParams *params) diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index e3658dd88..b54bffa28 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -3216,37 +3216,37 @@ void CLandscape::deleteTessFace(CTessFace *f) // for refine() mgt, must remove from refine priority list, or from the temp rootTessFaceToUpdate list. f->unlinkInPList(); - TessFaceAllocator.free(f); + TessFaceAllocator.freeBlock(f); } // *************************************************************************** void CLandscape::deleteTessVertex(CTessVertex *v) { - TessVertexAllocator.free(v); + TessVertexAllocator.freeBlock(v); } // *************************************************************************** void CLandscape::deleteTessNearVertex(CTessNearVertex *v) { - TessNearVertexAllocator.free(v); + TessNearVertexAllocator.freeBlock(v); } // *************************************************************************** void CLandscape::deleteTessFarVertex(CTessFarVertex *v) { - TessFarVertexAllocator.free(v); + TessFarVertexAllocator.freeBlock(v); } // *************************************************************************** void CLandscape::deleteTileMaterial(CTileMaterial *tm) { - TileMaterialAllocator.free(tm); + TileMaterialAllocator.freeBlock(tm); } // *************************************************************************** void CLandscape::deleteTileFace(CTileFace *tf) { - TileFaceAllocator.free(tf); + TileFaceAllocator.freeBlock(tf); } diff --git a/code/nel/src/3d/patch_render.cpp b/code/nel/src/3d/patch_render.cpp index ee916a3fe..59978a94d 100644 --- a/code/nel/src/3d/patch_render.cpp +++ b/code/nel/src/3d/patch_render.cpp @@ -24,8 +24,11 @@ #include "nel/3d/landscape.h" #include "nel/3d/landscape_profile.h" #include "nel/3d/patchdlm_context.h" +#include "nel/3d/debug_vb.h" + #include "nel/misc/vector.h" #include "nel/misc/common.h" + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/play_list_user.cpp b/code/nel/src/3d/play_list_user.cpp index 0a80a1076..9f9d0c688 100644 --- a/code/nel/src/3d/play_list_user.cpp +++ b/code/nel/src/3d/play_list_user.cpp @@ -19,8 +19,9 @@ #include "nel/3d/play_list_user.h" #include "nel/3d/animation_set_user.h" #include "nel/3d/u_transform.h" -#include "nel/misc/hierarchical_timer.h" +#include "nel/3d/transform.h" +#include "nel/misc/hierarchical_timer.h" #include "nel/misc/debug.h" using namespace NLMISC; diff --git a/code/nel/src/3d/ps_dot.cpp b/code/nel/src/3d/ps_dot.cpp index 516cac8f1..3711ff50e 100644 --- a/code/nel/src/3d/ps_dot.cpp +++ b/code/nel/src/3d/ps_dot.cpp @@ -21,6 +21,8 @@ #include "nel/3d/ps_iterator.h" #include "nel/3d/driver.h" #include "nel/3d/particle_system.h" +#include "nel/3d/debug_vb.h" + #include "nel/misc/fast_mem.h" namespace NL3D diff --git a/code/nel/src/3d/ps_face.cpp b/code/nel/src/3d/ps_face.cpp index e87459acf..818522897 100644 --- a/code/nel/src/3d/ps_face.cpp +++ b/code/nel/src/3d/ps_face.cpp @@ -21,8 +21,9 @@ #include "nel/3d/driver.h" #include "nel/3d/ps_iterator.h" #include "nel/3d/particle_system.h" -#include "nel/misc/quat.h" +#include "nel/3d/debug_vb.h" +#include "nel/misc/quat.h" namespace NL3D diff --git a/code/nel/src/3d/ps_face_look_at.cpp b/code/nel/src/3d/ps_face_look_at.cpp index 5b06f6eb5..32cd7c248 100644 --- a/code/nel/src/3d/ps_face_look_at.cpp +++ b/code/nel/src/3d/ps_face_look_at.cpp @@ -21,6 +21,8 @@ #include "nel/3d/driver.h" #include "nel/3d/ps_iterator.h" #include "nel/3d/particle_system.h" +#include "nel/3d/debug_vb.h" + #include "nel/misc/fast_floor.h" diff --git a/code/nel/src/3d/ps_fan_light.cpp b/code/nel/src/3d/ps_fan_light.cpp index 055826749..7f4f789a0 100644 --- a/code/nel/src/3d/ps_fan_light.cpp +++ b/code/nel/src/3d/ps_fan_light.cpp @@ -22,6 +22,7 @@ #include "nel/3d/ps_iterator.h" #include "nel/3d/particle_system.h" #include "nel/3d/driver.h" +#include "nel/3d/debug_vb.h" diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index 5b61168e5..25a4d8034 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -29,12 +29,11 @@ #include "nel/3d/particle_system_shape.h" #include "nel/3d/particle_system_model.h" #include "nel/3d/ps_iterator.h" +#include "nel/3d/debug_vb.h" + #include "nel/misc/stream.h" #include "nel/misc/path.h" - - - namespace NL3D { diff --git a/code/nel/src/3d/ps_ribbon_base.cpp b/code/nel/src/3d/ps_ribbon_base.cpp index 8f2a64932..8f602b931 100644 --- a/code/nel/src/3d/ps_ribbon_base.cpp +++ b/code/nel/src/3d/ps_ribbon_base.cpp @@ -20,6 +20,8 @@ #include "nel/3d/ps_ribbon_base.h" #include "nel/3d/particle_system.h" +using namespace NLMISC; + namespace NL3D { diff --git a/code/nel/src/3d/ps_ribbon_look_at.cpp b/code/nel/src/3d/ps_ribbon_look_at.cpp index 966e5a5b1..7fece0e3d 100644 --- a/code/nel/src/3d/ps_ribbon_look_at.cpp +++ b/code/nel/src/3d/ps_ribbon_look_at.cpp @@ -20,6 +20,7 @@ #include "nel/3d/particle_system.h" #include "nel/3d/ps_macro.h" #include "nel/3d/driver.h" +#include "nel/3d/debug_vb.h" namespace NL3D { diff --git a/code/nel/src/3d/ps_shockwave.cpp b/code/nel/src/3d/ps_shockwave.cpp index 20069e175..44f91d208 100644 --- a/code/nel/src/3d/ps_shockwave.cpp +++ b/code/nel/src/3d/ps_shockwave.cpp @@ -22,6 +22,7 @@ #include "nel/3d/texture_grouped.h" #include "nel/3d/ps_iterator.h" #include "nel/3d/particle_system.h" +#include "nel/3d/debug_vb.h" namespace NL3D diff --git a/code/nel/src/3d/ps_sound.cpp b/code/nel/src/3d/ps_sound.cpp index a5ae6ad26..a1705d907 100644 --- a/code/nel/src/3d/ps_sound.cpp +++ b/code/nel/src/3d/ps_sound.cpp @@ -21,6 +21,8 @@ #include "nel/3d/u_ps_sound_interface.h" #include "nel/3d/ps_attrib_maker.h" +using namespace NLMISC; + namespace NL3D { diff --git a/code/nel/src/3d/quad_grid_clip_cluster.cpp b/code/nel/src/3d/quad_grid_clip_cluster.cpp index a6ab799c8..dd52ed111 100644 --- a/code/nel/src/3d/quad_grid_clip_cluster.cpp +++ b/code/nel/src/3d/quad_grid_clip_cluster.cpp @@ -25,6 +25,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/3d/quad_grid_clip_manager.cpp b/code/nel/src/3d/quad_grid_clip_manager.cpp index 02c4fed62..0fe69e46e 100644 --- a/code/nel/src/3d/quad_grid_clip_manager.cpp +++ b/code/nel/src/3d/quad_grid_clip_manager.cpp @@ -28,6 +28,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/3d/ray_mesh.cpp b/code/nel/src/3d/ray_mesh.cpp index b315979b1..ca6b9b09d 100644 --- a/code/nel/src/3d/ray_mesh.cpp +++ b/code/nel/src/3d/ray_mesh.cpp @@ -19,6 +19,8 @@ #include "nel/3d/ray_mesh.h" #include "nel/misc/vector_2f.h" #include "nel/misc/fast_mem.h" +#include "nel/misc/plane.h" + #include "nel/3d/matrix_3x4.h" using namespace NLMISC; diff --git a/code/nel/src/3d/std3d.h b/code/nel/src/3d/std3d.h index e81f1ead4..d41f281ec 100644 --- a/code/nel/src/3d/std3d.h +++ b/code/nel/src/3d/std3d.h @@ -14,7 +14,15 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "nel/misc/types_nl.h" +#ifndef NL_STD3D_H +#define NL_STD3D_H + +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif #include #include @@ -36,6 +44,8 @@ #include #include +#include "nel/misc/types_nl.h" + #include "nel/misc/rgba.h" #include "nel/misc/debug.h" @@ -45,7 +55,4 @@ #include "nel/misc/matrix.h" #include "nel/misc/time_nl.h" -#include "nel/3d/debug_vb.h" -#include "nel/3d/transform.h" -#include "nel/3d/quad_grid.h" - +#endif diff --git a/code/nel/src/3d/target_anim_ctrl.cpp b/code/nel/src/3d/target_anim_ctrl.cpp index ea1eeeca0..8145fdb93 100644 --- a/code/nel/src/3d/target_anim_ctrl.cpp +++ b/code/nel/src/3d/target_anim_ctrl.cpp @@ -24,6 +24,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { diff --git a/code/nel/src/3d/texture_emboss.cpp b/code/nel/src/3d/texture_emboss.cpp index 414f93093..55d5d85a9 100644 --- a/code/nel/src/3d/texture_emboss.cpp +++ b/code/nel/src/3d/texture_emboss.cpp @@ -17,6 +17,8 @@ #include "std3d.h" #include "nel/3d/texture_emboss.h" +using namespace NLMISC; + namespace NL3D { // *********************************************************************************************************** diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index 5cacae18e..23075448e 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -243,7 +243,7 @@ void CTileBank::freeTile (int tileIndex) nlassert (tileIndex<(sint)_TileVector.size()); // Free - _TileVector[tileIndex].free(); + _TileVector[tileIndex].freeBlock(); // Resize tile table int i; diff --git a/code/nel/src/3d/track_sampled_quat.cpp b/code/nel/src/3d/track_sampled_quat.cpp index 1ef4e35b8..d49d63aa7 100644 --- a/code/nel/src/3d/track_sampled_quat.cpp +++ b/code/nel/src/3d/track_sampled_quat.cpp @@ -24,6 +24,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/3d/vegetable_manager.cpp b/code/nel/src/3d/vegetable_manager.cpp index e479a5e62..8946bc67b 100644 --- a/code/nel/src/3d/vegetable_manager.cpp +++ b/code/nel/src/3d/vegetable_manager.cpp @@ -35,6 +35,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { @@ -747,7 +750,7 @@ void CVegetableManager::deleteClipBlock(CVegetableClipBlock *clipBlock) _EmptyClipBlockList.remove(clipBlock); // delete - _ClipBlockMemory.free(clipBlock); + _ClipBlockMemory.freeBlock(clipBlock); } @@ -782,7 +785,7 @@ void CVegetableManager::deleteSortBlock(CVegetableSortBlock *sortBlock) sortBlock->_Owner->_SortBlockList.remove(sortBlock); // delete - _SortBlockMemory.free(sortBlock); + _SortBlockMemory.freeBlock(sortBlock); } @@ -878,7 +881,7 @@ void CVegetableManager::deleteIg(CVegetableInstanceGroup *ig) // unlink from sortBlock, and delete. sortBlock->_InstanceGroupList.remove(ig); - _InstanceGroupMemory.free(ig); + _InstanceGroupMemory.freeBlock(ig); // decRef the clipBlock diff --git a/code/nel/src/3d/vegetablevb_allocator.cpp b/code/nel/src/3d/vegetablevb_allocator.cpp index f5c833d8a..fa5aea364 100644 --- a/code/nel/src/3d/vegetablevb_allocator.cpp +++ b/code/nel/src/3d/vegetablevb_allocator.cpp @@ -19,6 +19,7 @@ #include "nel/3d/vegetablevb_allocator.h" #include "nel/3d/vegetable_def.h" +#include "nel/3d/debug_vb.h" using namespace std; diff --git a/code/nel/src/3d/visual_collision_manager.cpp b/code/nel/src/3d/visual_collision_manager.cpp index cafc9948e..c5c45578f 100644 --- a/code/nel/src/3d/visual_collision_manager.cpp +++ b/code/nel/src/3d/visual_collision_manager.cpp @@ -98,7 +98,7 @@ CVisualTileDescNode *CVisualCollisionManager::newVisualTileDescNode() // *************************************************************************** void CVisualCollisionManager::deleteVisualTileDescNode(CVisualTileDescNode *ptr) { - _TileDescNodeAllocator.free(ptr); + _TileDescNodeAllocator.freeBlock(ptr); } // *************************************************************************** @@ -110,7 +110,7 @@ CPatchQuadBlock *CVisualCollisionManager::newPatchQuadBlock() // *************************************************************************** void CVisualCollisionManager::deletePatchQuadBlock(CPatchQuadBlock *ptr) { - _PatchQuadBlockAllocator.free(ptr); + _PatchQuadBlockAllocator.freeBlock(ptr); } diff --git a/code/nel/src/3d/water_env_map.cpp b/code/nel/src/3d/water_env_map.cpp index a1b954764..9592f2948 100644 --- a/code/nel/src/3d/water_env_map.cpp +++ b/code/nel/src/3d/water_env_map.cpp @@ -24,6 +24,10 @@ #include "nel/misc/common.h" #include "nel/3d/viewport.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NL3D { diff --git a/code/nel/src/3d/water_pool_manager.cpp b/code/nel/src/3d/water_pool_manager.cpp index c377ff1f3..8ca8e2bfc 100644 --- a/code/nel/src/3d/water_pool_manager.cpp +++ b/code/nel/src/3d/water_pool_manager.cpp @@ -23,6 +23,9 @@ #include "nel/3d/water_height_map.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/gui/action_handler.cpp b/code/nel/src/gui/action_handler.cpp index d7214ef06..bbe7948cd 100644 --- a/code/nel/src/gui/action_handler.cpp +++ b/code/nel/src/gui/action_handler.cpp @@ -27,6 +27,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/ctrl_base.cpp b/code/nel/src/gui/ctrl_base.cpp index 475761e89..9fdeff8c2 100644 --- a/code/nel/src/gui/ctrl_base.cpp +++ b/code/nel/src/gui/ctrl_base.cpp @@ -27,6 +27,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { std::map< std::string, std::map< std::string, std::string > > CCtrlBase::AHCache; diff --git a/code/nel/src/gui/ctrl_base_button.cpp b/code/nel/src/gui/ctrl_base_button.cpp index 673ea906d..d60824295 100644 --- a/code/nel/src/gui/ctrl_base_button.cpp +++ b/code/nel/src/gui/ctrl_base_button.cpp @@ -27,6 +27,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace { const uint KEY_REPEAT_MIN = 100; diff --git a/code/nel/src/gui/ctrl_button.cpp b/code/nel/src/gui/ctrl_button.cpp index d689dd71c..02fd4b7d4 100644 --- a/code/nel/src/gui/ctrl_button.cpp +++ b/code/nel/src/gui/ctrl_button.cpp @@ -26,6 +26,10 @@ using namespace std; using namespace NLMISC; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CCtrlButton, std::string, "button"); namespace NLGUI diff --git a/code/nel/src/gui/ctrl_col_pick.cpp b/code/nel/src/gui/ctrl_col_pick.cpp index 2d62b6e74..4079388c2 100644 --- a/code/nel/src/gui/ctrl_col_pick.cpp +++ b/code/nel/src/gui/ctrl_col_pick.cpp @@ -27,6 +27,10 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CCtrlColPick, std::string, "colpick"); namespace NLGUI diff --git a/code/nel/src/gui/ctrl_draggable.cpp b/code/nel/src/gui/ctrl_draggable.cpp index 39872ab18..781585083 100644 --- a/code/nel/src/gui/ctrl_draggable.cpp +++ b/code/nel/src/gui/ctrl_draggable.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/ctrl_draggable.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/ctrl_polygon.cpp b/code/nel/src/gui/ctrl_polygon.cpp index 86059087d..c7ce984d2 100644 --- a/code/nel/src/gui/ctrl_polygon.cpp +++ b/code/nel/src/gui/ctrl_polygon.cpp @@ -23,6 +23,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/ctrl_quad.cpp b/code/nel/src/gui/ctrl_quad.cpp index 47346692c..22f4d4ae6 100644 --- a/code/nel/src/gui/ctrl_quad.cpp +++ b/code/nel/src/gui/ctrl_quad.cpp @@ -23,6 +23,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index ad2ca14f5..9c9585fcc 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -28,6 +28,10 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CCtrlScroll, std::string, "scroll"); namespace NLGUI diff --git a/code/nel/src/gui/ctrl_scroll_base.cpp b/code/nel/src/gui/ctrl_scroll_base.cpp index f95cac5d7..2813b997a 100644 --- a/code/nel/src/gui/ctrl_scroll_base.cpp +++ b/code/nel/src/gui/ctrl_scroll_base.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/ctrl_scroll_base.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/ctrl_sheet_selection.cpp b/code/nel/src/gui/ctrl_sheet_selection.cpp index bdbe0e73d..d0202547f 100644 --- a/code/nel/src/gui/ctrl_sheet_selection.cpp +++ b/code/nel/src/gui/ctrl_sheet_selection.cpp @@ -23,6 +23,10 @@ #include "nel/gui/ctrl_sheet_selection.h" #include "nel/gui/view_renderer.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/ctrl_text_button.cpp b/code/nel/src/gui/ctrl_text_button.cpp index c292d5473..81dfcc953 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -30,6 +30,9 @@ using namespace std; using namespace NLMISC; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif NLMISC_REGISTER_OBJECT(CViewBase, CCtrlTextButton, std::string, "text_button"); diff --git a/code/nel/src/gui/ctrl_tooltip.cpp b/code/nel/src/gui/ctrl_tooltip.cpp index 8a0427751..da42084ac 100644 --- a/code/nel/src/gui/ctrl_tooltip.cpp +++ b/code/nel/src/gui/ctrl_tooltip.cpp @@ -23,6 +23,10 @@ using namespace std; using namespace NLMISC; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CCtrlToolTip, std::string, "tooltip"); REGISTER_UI_CLASS(CCtrlToolTip) diff --git a/code/nel/src/gui/db_manager.cpp b/code/nel/src/gui/db_manager.cpp index a169adf8d..7896cbde3 100644 --- a/code/nel/src/gui/db_manager.cpp +++ b/code/nel/src/gui/db_manager.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/db_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { CDBManager* CDBManager::instance = NULL; diff --git a/code/nel/src/gui/dbgroup_combo_box.cpp b/code/nel/src/gui/dbgroup_combo_box.cpp index 184829e4c..2afd8c570 100644 --- a/code/nel/src/gui/dbgroup_combo_box.cpp +++ b/code/nel/src/gui/dbgroup_combo_box.cpp @@ -28,6 +28,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box"); diff --git a/code/nel/src/gui/dbgroup_select_number.cpp b/code/nel/src/gui/dbgroup_select_number.cpp index b3dc2e8f1..22afa4d0e 100644 --- a/code/nel/src/gui/dbgroup_select_number.cpp +++ b/code/nel/src/gui/dbgroup_select_number.cpp @@ -27,6 +27,10 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number"); diff --git a/code/nel/src/gui/dbview_bar.cpp b/code/nel/src/gui/dbview_bar.cpp index f4befb389..e2256444f 100644 --- a/code/nel/src/gui/dbview_bar.cpp +++ b/code/nel/src/gui/dbview_bar.cpp @@ -26,6 +26,10 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CDBViewBar, std::string, "bar"); namespace NLGUI diff --git a/code/nel/src/gui/dbview_bar3.cpp b/code/nel/src/gui/dbview_bar3.cpp index 32d3e9eaf..187a52f99 100644 --- a/code/nel/src/gui/dbview_bar3.cpp +++ b/code/nel/src/gui/dbview_bar3.cpp @@ -26,6 +26,10 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { NLMISC_REGISTER_OBJECT(CViewBase, CDBViewBar3, std::string, "bar3"); diff --git a/code/nel/src/gui/dbview_digit.cpp b/code/nel/src/gui/dbview_digit.cpp index 318327a77..81063d519 100644 --- a/code/nel/src/gui/dbview_digit.cpp +++ b/code/nel/src/gui/dbview_digit.cpp @@ -24,6 +24,10 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CDBViewDigit, std::string, "digit"); namespace NLGUI diff --git a/code/nel/src/gui/dbview_number.cpp b/code/nel/src/gui/dbview_number.cpp index e844bf4c0..36f5523f2 100644 --- a/code/nel/src/gui/dbview_number.cpp +++ b/code/nel/src/gui/dbview_number.cpp @@ -24,6 +24,9 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif NLMISC_REGISTER_OBJECT(CViewBase, CDBViewNumber, std::string, "text_number"); diff --git a/code/nel/src/gui/dbview_quantity.cpp b/code/nel/src/gui/dbview_quantity.cpp index 12dfce4b8..4685fc23d 100644 --- a/code/nel/src/gui/dbview_quantity.cpp +++ b/code/nel/src/gui/dbview_quantity.cpp @@ -24,6 +24,9 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif NLMISC_REGISTER_OBJECT(CViewBase, CDBViewQuantity, std::string, "text_quantity"); diff --git a/code/nel/src/gui/event_descriptor.cpp b/code/nel/src/gui/event_descriptor.cpp index fd1856ed3..356e75aec 100644 --- a/code/nel/src/gui/event_descriptor.cpp +++ b/code/nel/src/gui/event_descriptor.cpp @@ -19,6 +19,10 @@ #include "nel/misc/events.h" #include "nel/gui/event_descriptor.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/event_listener.cpp b/code/nel/src/gui/event_listener.cpp index 4f4d7a17d..b1e53c374 100644 --- a/code/nel/src/gui/event_listener.cpp +++ b/code/nel/src/gui/event_listener.cpp @@ -21,6 +21,10 @@ #include "nel/gui/interface_group.h" #include "nel/gui/widget_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { CEventListener::CEventListener() diff --git a/code/nel/src/gui/group_container.cpp b/code/nel/src/gui/group_container.cpp index 818c71278..1922db221 100644 --- a/code/nel/src/gui/group_container.cpp +++ b/code/nel/src/gui/group_container.cpp @@ -39,6 +39,10 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace { const sint SIZE_W_LEFT = 16; diff --git a/code/nel/src/gui/group_container_base.cpp b/code/nel/src/gui/group_container_base.cpp index 974964955..c031cec7e 100644 --- a/code/nel/src/gui/group_container_base.cpp +++ b/code/nel/src/gui/group_container_base.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/group_container_base.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index 4ac977803..f0a41c8a0 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -33,6 +33,9 @@ using namespace std; using namespace NLMISC; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NLGUI { diff --git a/code/nel/src/gui/group_editbox_base.cpp b/code/nel/src/gui/group_editbox_base.cpp index 133af0b83..d3c001c34 100644 --- a/code/nel/src/gui/group_editbox_base.cpp +++ b/code/nel/src/gui/group_editbox_base.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/group_editbox_base.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_editbox_decor.cpp b/code/nel/src/gui/group_editbox_decor.cpp index 07e07ddf3..6d1e500ae 100644 --- a/code/nel/src/gui/group_editbox_decor.cpp +++ b/code/nel/src/gui/group_editbox_decor.cpp @@ -20,6 +20,10 @@ #include "nel/gui/view_bitmap.h" #include "nel/gui/view_text.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { class EBDPrivate diff --git a/code/nel/src/gui/group_frame.cpp b/code/nel/src/gui/group_frame.cpp index d0a652092..54412f229 100644 --- a/code/nel/src/gui/group_frame.cpp +++ b/code/nel/src/gui/group_frame.cpp @@ -26,6 +26,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_header.cpp b/code/nel/src/gui/group_header.cpp index 908aa183e..dbc990447 100644 --- a/code/nel/src/gui/group_header.cpp +++ b/code/nel/src/gui/group_header.cpp @@ -24,6 +24,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index eee811d02..a67c8b8e8 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -49,6 +49,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif // Default maximum time the request is allowed to take #define DEFAULT_RYZOM_CONNECTION_TIMEOUT (300.0) diff --git a/code/nel/src/gui/group_html_parser.cpp b/code/nel/src/gui/group_html_parser.cpp index 5f6873477..b2a61c4f9 100644 --- a/code/nel/src/gui/group_html_parser.cpp +++ b/code/nel/src/gui/group_html_parser.cpp @@ -28,6 +28,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { // *************************************************************************** diff --git a/code/nel/src/gui/group_list.cpp b/code/nel/src/gui/group_list.cpp index 8869c4498..c0502577b 100644 --- a/code/nel/src/gui/group_list.cpp +++ b/code/nel/src/gui/group_list.cpp @@ -30,6 +30,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CGroupList, std::string, "list"); namespace NLGUI diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index 80117e5bd..3b0e4549d 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -32,6 +32,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace { diff --git a/code/nel/src/gui/group_modal.cpp b/code/nel/src/gui/group_modal.cpp index fb4c6d129..95ca783eb 100644 --- a/code/nel/src/gui/group_modal.cpp +++ b/code/nel/src/gui/group_modal.cpp @@ -24,6 +24,10 @@ using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index 6261656aa..7eaf11841 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -31,6 +31,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CCtrlLink, std::string, "button_link"); namespace NLGUI diff --git a/code/nel/src/gui/group_scrolltext.cpp b/code/nel/src/gui/group_scrolltext.cpp index c82bd40bf..aff59e5c2 100644 --- a/code/nel/src/gui/group_scrolltext.cpp +++ b/code/nel/src/gui/group_scrolltext.cpp @@ -25,6 +25,10 @@ #include "nel/misc/i18n.h" #include "nel/gui/widget_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CGroupScrollText, std::string, "scroll_text"); namespace NLGUI diff --git a/code/nel/src/gui/group_submenu_base.cpp b/code/nel/src/gui/group_submenu_base.cpp index 1c98fe643..8b26a7d85 100644 --- a/code/nel/src/gui/group_submenu_base.cpp +++ b/code/nel/src/gui/group_submenu_base.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/group_submenu_base.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_tab.cpp b/code/nel/src/gui/group_tab.cpp index 69ccce046..d79efdad3 100644 --- a/code/nel/src/gui/group_tab.cpp +++ b/code/nel/src/gui/group_tab.cpp @@ -26,6 +26,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CGroupTab, std::string, "tab"); namespace NLGUI diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp index a82ad5617..e194a70a4 100644 --- a/code/nel/src/gui/group_table.cpp +++ b/code/nel/src/gui/group_table.cpp @@ -29,6 +29,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_tree.cpp b/code/nel/src/gui/group_tree.cpp index b8e2ae1f4..c65ceba17 100644 --- a/code/nel/src/gui/group_tree.cpp +++ b/code/nel/src/gui/group_tree.cpp @@ -33,6 +33,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/group_wheel.cpp b/code/nel/src/gui/group_wheel.cpp index e242a98e7..a8d57c089 100644 --- a/code/nel/src/gui/group_wheel.cpp +++ b/code/nel/src/gui/group_wheel.cpp @@ -18,6 +18,9 @@ #include "stdpch.h" #include "nel/gui/group_wheel.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif NLMISC_REGISTER_OBJECT(CViewBase, CInterfaceGroupWheel, std::string, "group_wheel"); diff --git a/code/nel/src/gui/input_handler.cpp b/code/nel/src/gui/input_handler.cpp index 920636079..9e4864caa 100644 --- a/code/nel/src/gui/input_handler.cpp +++ b/code/nel/src/gui/input_handler.cpp @@ -17,6 +17,10 @@ #include "stdpch.h" #include "nel/gui/input_handler.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { CInputHandler::CInputHandler() diff --git a/code/nel/src/gui/interface_anim.cpp b/code/nel/src/gui/interface_anim.cpp index 4b230bb25..2fb190e85 100644 --- a/code/nel/src/gui/interface_anim.cpp +++ b/code/nel/src/gui/interface_anim.cpp @@ -27,6 +27,10 @@ using namespace std; using namespace NL3D; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index 66eee038e..e33d1dbd8 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -31,6 +31,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { bool CInterfaceElement::editorMode = false; diff --git a/code/nel/src/gui/interface_expr.cpp b/code/nel/src/gui/interface_expr.cpp index cbf3cace3..9d13286a9 100644 --- a/code/nel/src/gui/interface_expr.cpp +++ b/code/nel/src/gui/interface_expr.cpp @@ -25,6 +25,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/interface_expr_node.cpp b/code/nel/src/gui/interface_expr_node.cpp index 895cb169e..2a32c09db 100644 --- a/code/nel/src/gui/interface_expr_node.cpp +++ b/code/nel/src/gui/interface_expr_node.cpp @@ -24,6 +24,10 @@ using NLMISC::ICDBNode; using NLMISC::CCDBNodeBranch; using NLMISC::CCDBNodeLeaf; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/interface_expr_user_fct.cpp b/code/nel/src/gui/interface_expr_user_fct.cpp index b60f0b01c..07e329feb 100644 --- a/code/nel/src/gui/interface_expr_user_fct.cpp +++ b/code/nel/src/gui/interface_expr_user_fct.cpp @@ -25,6 +25,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/interface_factory.cpp b/code/nel/src/gui/interface_factory.cpp index ec914baa6..7f0fe76ee 100644 --- a/code/nel/src/gui/interface_factory.cpp +++ b/code/nel/src/gui/interface_factory.cpp @@ -18,6 +18,10 @@ #include "nel/gui/view_base.h" #include "nel/misc/factory.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { CViewBase* CInterfaceFactory::createClass( const std::string &name ) diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index 623dfe5bd..c0e7f6f17 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -32,6 +32,10 @@ using namespace std; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + #define IG_UNIQUE_ID(this) ((void*)&((this)->_GroupSizeRef)) // NB nico : use some pointer *inside* CInterfaceGroup as a unique id for lua registry (any field but // the first), instead of using 'this'. 'this' is already used by // CLuaIHM::pushReflectableOnStack as unique id to CInterfaceElement's ref pointers diff --git a/code/nel/src/gui/interface_link.cpp b/code/nel/src/gui/interface_link.cpp index 282199ee7..612fa908e 100644 --- a/code/nel/src/gui/interface_link.cpp +++ b/code/nel/src/gui/interface_link.cpp @@ -33,6 +33,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/interface_options.cpp b/code/nel/src/gui/interface_options.cpp index 1daef83cb..9a71e3709 100644 --- a/code/nel/src/gui/interface_options.cpp +++ b/code/nel/src/gui/interface_options.cpp @@ -26,6 +26,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 4362b5c12..e038cb73e 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -42,6 +42,11 @@ #ifdef LUA_NEVRAX_VERSION #include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger #endif + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + const uint32 UI_CACHE_SERIAL_CHECK = NELID("IUG_"); using namespace NLMISC; diff --git a/code/nel/src/gui/interface_property.cpp b/code/nel/src/gui/interface_property.cpp index 8715b0f2f..ab375ae5e 100644 --- a/code/nel/src/gui/interface_property.cpp +++ b/code/nel/src/gui/interface_property.cpp @@ -24,6 +24,10 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { // helper to convert double <> sint64 diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index 53cc9e403..919d50562 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -21,6 +21,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/libwww_types.cpp b/code/nel/src/gui/libwww_types.cpp index 31e05f456..9731e9aca 100644 --- a/code/nel/src/gui/libwww_types.cpp +++ b/code/nel/src/gui/libwww_types.cpp @@ -29,8 +29,13 @@ ****************************************************************************/ +#include "stdpch.h" #include "nel/gui/libwww_types.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/link_hack.cpp b/code/nel/src/gui/link_hack.cpp index 3ecc6fb0a..9ae97910d 100644 --- a/code/nel/src/gui/link_hack.cpp +++ b/code/nel/src/gui/link_hack.cpp @@ -22,6 +22,10 @@ #include "nel/gui/view_pointer.h" #include "nel/gui/group_editbox_decor.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { void ifexprufct_forcelink(); diff --git a/code/nel/src/gui/lua_helper.cpp b/code/nel/src/gui/lua_helper.cpp index 0e2b9ba71..4e776e0b9 100644 --- a/code/nel/src/gui/lua_helper.cpp +++ b/code/nel/src/gui/lua_helper.cpp @@ -49,6 +49,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/lua_ihm.cpp b/code/nel/src/gui/lua_ihm.cpp index d55bda42d..0951d973c 100644 --- a/code/nel/src/gui/lua_ihm.cpp +++ b/code/nel/src/gui/lua_ihm.cpp @@ -92,6 +92,10 @@ Compilation is VERY SLOW using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + // declare ostream << operator for ucstring -> registration of ucstring iin luabind will build a 'tostring' function from it std::ostream &operator<<(std::ostream &str, const ucstring &value) { @@ -107,11 +111,11 @@ namespace NLGUI { return NLMISC::CPath::lookup(fileName, false); } - static void shellExecute(const char *operation, const char *fileName, const char *parameters) + static void shellExecute(const std::string &operation, const std::string &fileName, const std::string ¶meters) { #if !FINAL_VERSION #ifdef NL_OS_WINDOWS - ShellExecute(NULL, operation, fileName, parameters, NULL, SW_SHOWDEFAULT); + ShellExecuteW(NULL, utf8ToWide(operation), utf8ToWide(fileName), utf8ToWide(parameters), NULL, SW_SHOWDEFAULT); #endif #endif } @@ -1701,8 +1705,20 @@ namespace NLGUI void *ptr= ls.newUserData(sizeof(CReflectableLuaRef)); nlassert(ptr); //ls.dumpStack(); - // initialize it, and copy the given element + +// disable memory leaks detection for placement new +#ifdef new + #undef new +#endif + + // initialize it, and copy the given element new (ptr) CReflectableLuaRef(pRPT); + +// reenable memory leaks detection for placement new +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + // Assign to this user data the __ui_metatable //ls.dumpStack(); ls.push(IHM_LUA_METATABLE); // userdata "__ui_metatable" diff --git a/code/nel/src/gui/lua_manager.cpp b/code/nel/src/gui/lua_manager.cpp index 2b354b0e4..d3f5dd81e 100644 --- a/code/nel/src/gui/lua_manager.cpp +++ b/code/nel/src/gui/lua_manager.cpp @@ -19,6 +19,10 @@ #include "nel/gui/lua_manager.h" #include "nel/gui/lua_helper.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/lua_object.cpp b/code/nel/src/gui/lua_object.cpp index 57581d6ec..c957c3f2c 100644 --- a/code/nel/src/gui/lua_object.cpp +++ b/code/nel/src/gui/lua_object.cpp @@ -20,6 +20,10 @@ #include "nel/gui/lua_ihm.h" #include "nel/gui/lua_helper.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/parser.cpp b/code/nel/src/gui/parser.cpp index eae7d3667..0d521b726 100644 --- a/code/nel/src/gui/parser.cpp +++ b/code/nel/src/gui/parser.cpp @@ -21,6 +21,10 @@ #include "nel/gui/interface_group.h" #include "nel/gui/interface_parser.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { IParser::IParser() diff --git a/code/nel/src/gui/proc.cpp b/code/nel/src/gui/proc.cpp index df9d6b8e9..2974a861e 100644 --- a/code/nel/src/gui/proc.cpp +++ b/code/nel/src/gui/proc.cpp @@ -22,6 +22,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/reflect.cpp b/code/nel/src/gui/reflect.cpp index 961c855e6..7ef321b6e 100644 --- a/code/nel/src/gui/reflect.cpp +++ b/code/nel/src/gui/reflect.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/reflect.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { // Yoyo: Act like a singleton, else registerClass may crash. diff --git a/code/nel/src/gui/reflect_register.cpp b/code/nel/src/gui/reflect_register.cpp index f7f47b1f9..86abc0cd5 100644 --- a/code/nel/src/gui/reflect_register.cpp +++ b/code/nel/src/gui/reflect_register.cpp @@ -49,6 +49,10 @@ #include "nel/gui/group_html.h" #include "nel/gui/group_header.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { void CReflectableRegister::registerClasses() diff --git a/code/nel/src/gui/root_group.cpp b/code/nel/src/gui/root_group.cpp index bffdd5579..756fb1096 100644 --- a/code/nel/src/gui/root_group.cpp +++ b/code/nel/src/gui/root_group.cpp @@ -14,10 +14,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - +#include "stdpch.h" #include "nel/gui/root_group.h" #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/stdpch.h b/code/nel/src/gui/stdpch.h index 51f1b1657..e0be5837e 100644 --- a/code/nel/src/gui/stdpch.h +++ b/code/nel/src/gui/stdpch.h @@ -17,6 +17,13 @@ #ifndef NELGUI_H #define NELGUI_H +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif + #include #include diff --git a/code/nel/src/gui/string_case.cpp b/code/nel/src/gui/string_case.cpp index b678d35c9..06936b393 100644 --- a/code/nel/src/gui/string_case.cpp +++ b/code/nel/src/gui/string_case.cpp @@ -17,6 +17,10 @@ #include "stdpch.h" #include "nel/gui/string_case.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { inline bool isSeparator (ucchar c) diff --git a/code/nel/src/gui/url_parser.cpp b/code/nel/src/gui/url_parser.cpp index 5db7f6d72..68f624743 100644 --- a/code/nel/src/gui/url_parser.cpp +++ b/code/nel/src/gui/url_parser.cpp @@ -14,11 +14,15 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "nel/misc/common.h" #include "nel/gui/url_parser.h" using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NLGUI { diff --git a/code/nel/src/gui/view_base.cpp b/code/nel/src/gui/view_base.cpp index 2b09061a9..6b0201858 100644 --- a/code/nel/src/gui/view_base.cpp +++ b/code/nel/src/gui/view_base.cpp @@ -20,6 +20,10 @@ #include "nel/gui/interface_group.h" #include "nel/gui/widget_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/view_bitmap.cpp b/code/nel/src/gui/view_bitmap.cpp index 21c0c2cd4..75a84dc77 100644 --- a/code/nel/src/gui/view_bitmap.cpp +++ b/code/nel/src/gui/view_bitmap.cpp @@ -26,6 +26,9 @@ using namespace std; using namespace NLMISC; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif NLMISC_REGISTER_OBJECT(CViewBase, CViewBitmap, std::string, "bitmap"); REGISTER_UI_CLASS(CViewBitmap) diff --git a/code/nel/src/gui/view_bitmap_combo.cpp b/code/nel/src/gui/view_bitmap_combo.cpp index 3fc54c89a..7ffe644b6 100644 --- a/code/nel/src/gui/view_bitmap_combo.cpp +++ b/code/nel/src/gui/view_bitmap_combo.cpp @@ -25,6 +25,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/view_link.cpp b/code/nel/src/gui/view_link.cpp index 1db08f583..7de4e3a01 100644 --- a/code/nel/src/gui/view_link.cpp +++ b/code/nel/src/gui/view_link.cpp @@ -24,6 +24,10 @@ using namespace std; using namespace NLMISC; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/view_pointer.cpp b/code/nel/src/gui/view_pointer.cpp index da8d730fc..aa5dff6d2 100644 --- a/code/nel/src/gui/view_pointer.cpp +++ b/code/nel/src/gui/view_pointer.cpp @@ -27,6 +27,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CViewPointer, std::string, "generic_pointer"); namespace NLGUI diff --git a/code/nel/src/gui/view_pointer_base.cpp b/code/nel/src/gui/view_pointer_base.cpp index e29af7858..f0cf3b6bb 100644 --- a/code/nel/src/gui/view_pointer_base.cpp +++ b/code/nel/src/gui/view_pointer_base.cpp @@ -18,6 +18,10 @@ #include "stdpch.h" #include "nel/gui/view_pointer_base.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/view_polygon.cpp b/code/nel/src/gui/view_polygon.cpp index baacf94a0..f3fd8efa2 100644 --- a/code/nel/src/gui/view_polygon.cpp +++ b/code/nel/src/gui/view_polygon.cpp @@ -23,6 +23,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/view_quad.cpp b/code/nel/src/gui/view_quad.cpp index 426a19f08..2724fe3b3 100644 --- a/code/nel/src/gui/view_quad.cpp +++ b/code/nel/src/gui/view_quad.cpp @@ -22,6 +22,10 @@ using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/view_renderer.cpp b/code/nel/src/gui/view_renderer.cpp index 4c5d7c501..58aceb185 100644 --- a/code/nel/src/gui/view_renderer.cpp +++ b/code/nel/src/gui/view_renderer.cpp @@ -26,6 +26,10 @@ using namespace NLMISC; using namespace std; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index a2975fc1a..06f46bf0c 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -32,6 +32,10 @@ using namespace std; using namespace NLMISC; using namespace NL3D; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + typedef std::string::size_type TCharPos; // index of a chracter in a string REGISTER_UI_CLASS(CViewText) diff --git a/code/nel/src/gui/view_text_formated.cpp b/code/nel/src/gui/view_text_formated.cpp index f0bda2add..56a0b2e74 100644 --- a/code/nel/src/gui/view_text_formated.cpp +++ b/code/nel/src/gui/view_text_formated.cpp @@ -20,6 +20,10 @@ #include "nel/misc/xml_auto_ptr.h" #include "nel/misc/i18n.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CViewTextFormated, std::string, "text_formated"); namespace NLGUI diff --git a/code/nel/src/gui/view_text_id.cpp b/code/nel/src/gui/view_text_id.cpp index 23b939f91..b7e276a10 100644 --- a/code/nel/src/gui/view_text_id.cpp +++ b/code/nel/src/gui/view_text_id.cpp @@ -24,6 +24,10 @@ using namespace std; using NLMISC::CCDBNodeLeaf; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CViewTextID, std::string, "text_id"); namespace NLGUI diff --git a/code/nel/src/gui/view_text_id_formated.cpp b/code/nel/src/gui/view_text_id_formated.cpp index 1c91b3c0a..848bea21b 100644 --- a/code/nel/src/gui/view_text_id_formated.cpp +++ b/code/nel/src/gui/view_text_id_formated.cpp @@ -21,6 +21,10 @@ #include "nel/misc/xml_auto_ptr.h" #include "nel/misc/i18n.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + NLMISC_REGISTER_OBJECT(CViewBase, CViewTextIDFormated, std::string, "text_id_formated"); namespace NLGUI diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index d3888b68c..73c7098fe 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -37,6 +37,10 @@ #include "nel/misc/events.h" #include "nel/gui/root_group.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLGUI { void LinkHack(); @@ -462,7 +466,7 @@ namespace NLGUI // ------------------------------------------------------------------------------------------------ CInterfaceElement* CWidgetManager::getElementFromDefine( const std::string &defineId ) { - return getElementFromId( parser->getDefine( defineId ) ); + return getElementFromId( _Parser->getDefine( defineId ) ); } // ------------------------------------------------------------------------------------------------ @@ -2109,8 +2113,6 @@ namespace NLGUI bool handled = false; - CViewPointer *_Pointer = static_cast< CViewPointer* >( getPointer() ); - if( evnt.getType() == CEventDescriptor::system ) { handleSystemEvent( evnt ); @@ -3272,7 +3274,7 @@ namespace NLGUI // ------------------------------------------------------------------------------------------------ void CWidgetManager::startAnim( const std::string &animId ) { - CInterfaceAnim *pIT = parser->getAnim( animId ); + CInterfaceAnim *pIT = _Parser->getAnim( animId ); if( pIT == NULL ) return; @@ -3298,7 +3300,7 @@ namespace NLGUI // ------------------------------------------------------------------------------------------------ void CWidgetManager::stopAnim( const std::string &animId ) { - CInterfaceAnim *pIT = parser->getAnim( animId ); + CInterfaceAnim *pIT = _Parser->getAnim( animId ); for( uint i = 0; i < activeAnims.size(); ++i ) if( activeAnims[ i ] == pIT ) @@ -3321,7 +3323,7 @@ namespace NLGUI void CWidgetManager::runProcedure( const std::string &procName, CCtrlBase *pCaller, const std::vector< std::string> ¶mList ) { - CProcedure *procp = parser->getProc( procName ); + CProcedure *procp = _Parser->getProc( procName ); if( procp == NULL ) return; @@ -3357,7 +3359,7 @@ namespace NLGUI void CWidgetManager::setProcedureAction( const std::string &procName, uint actionIndex, const std::string &ah, const std::string ¶ms ) { - CProcedure *procp = parser->getProc( procName ); + CProcedure *procp = _Parser->getProc( procName ); if( procp == NULL ) return; @@ -3697,7 +3699,7 @@ namespace NLGUI CReflectableRegister::registerClasses(); - parser = IParser::createParser(); + _Parser = IParser::createParser(); _Pointer = NULL; curContextHelp = NULL; @@ -3739,6 +3741,9 @@ namespace NLGUI delete _MasterGroups[i].Group; } + delete _Parser; + _Parser = NULL; + _Pointer = NULL; curContextHelp = NULL; diff --git a/code/nel/src/ligo/ligo_error.cpp b/code/nel/src/ligo/ligo_error.cpp index fdca7a2c2..30315b3e6 100644 --- a/code/nel/src/ligo/ligo_error.cpp +++ b/code/nel/src/ligo/ligo_error.cpp @@ -15,7 +15,7 @@ // along with this program. If not, see . #include "stdligo.h" -#include "ligo_error.h" +#include "nel/ligo/ligo_error.h" namespace NLLIGO { diff --git a/code/nel/src/ligo/ligo_material.cpp b/code/nel/src/ligo/ligo_material.cpp index c5e7541a3..d62f73be9 100644 --- a/code/nel/src/ligo/ligo_material.cpp +++ b/code/nel/src/ligo/ligo_material.cpp @@ -18,7 +18,7 @@ #include "ligo_material.h" // Ligo include -#include "ligo_error.h" +#include "nel/ligo/ligo_error.h" //using namespace NL3D; diff --git a/code/nel/src/ligo/ligo_material.h b/code/nel/src/ligo/ligo_material.h index 16b236cb7..986a020f1 100644 --- a/code/nel/src/ligo/ligo_material.h +++ b/code/nel/src/ligo/ligo_material.h @@ -18,7 +18,7 @@ #define NL_MATERIAL_LIGO_H #include "nel/misc/types_nl.h" -#include "zone_template.h" +#include "nel/ligo/zone_template.h" // NeL include //#include "3d/zone.h" diff --git a/code/nel/src/ligo/transition.cpp b/code/nel/src/ligo/transition.cpp index ee6921c78..47e204677 100644 --- a/code/nel/src/ligo/transition.cpp +++ b/code/nel/src/ligo/transition.cpp @@ -18,8 +18,9 @@ #include "transition.h" // Ligo include -#include "zone_template.h" -#include "ligo_error.h" +#include "nel/ligo/zone_template.h" +#include "nel/ligo/ligo_error.h" + #include "ligo_material.h" namespace NLLIGO diff --git a/code/nel/src/ligo/zone_edge.cpp b/code/nel/src/ligo/zone_edge.cpp index 8bd2c7fa2..7b4a75d47 100644 --- a/code/nel/src/ligo/zone_edge.cpp +++ b/code/nel/src/ligo/zone_edge.cpp @@ -18,7 +18,7 @@ // Ligo include #include "zone_edge.h" #include "nel/ligo/ligo_config.h" -#include "ligo_error.h" +#include "nel/ligo/ligo_error.h" // NeL include #include "nel/misc/matrix.h" diff --git a/code/nel/src/ligo/zone_template.cpp b/code/nel/src/ligo/zone_template.cpp index 9f51c3c8e..e21cde438 100644 --- a/code/nel/src/ligo/zone_template.cpp +++ b/code/nel/src/ligo/zone_template.cpp @@ -15,8 +15,8 @@ // along with this program. If not, see . #include "stdligo.h" -#include "zone_template.h" -#include "ligo_error.h" +#include "nel/ligo/zone_template.h" +#include "nel/ligo/ligo_error.h" #include "nel/ligo/ligo_config.h" #include "nel/misc/stream.h" diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index 029d24323..98b471e44 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -42,18 +42,18 @@ FILE(GLOB NLMISC_MATH plane.cpp ../../include/nel/misc/plane.h ../../include/nel/misc/plane_inline.h polygon.cpp ../../include/nel/misc/polygon.h - quad.cpp ../../include/nel/misc/quad.h + ../../include/nel/misc/quad.h quat.cpp ../../include/nel/misc/quat.h rect.cpp ../../include/nel/misc/rect.h rgba.cpp ../../include/nel/misc/rgba.h triangle.cpp ../../include/nel/misc/triangle.h - uv.cpp ../../include/nel/misc/uv.h + ../../include/nel/misc/uv.h vector*.cpp ../../include/nel/misc/vector*.h aabbox.cpp ../../include/nel/misc/aabbox.h algo.cpp ../../include/nel/misc/algo.h bsphere.cpp ../../include/nel/misc/bsphere.h fast_floor.cpp ../../include/nel/misc/fast_floor.h - geom_ext.cpp ../../include/nel/misc/geom_ext.h + ../../include/nel/misc/geom_ext.h line.cpp ../../include/nel/misc/line.h matrix.cpp ../../include/nel/misc/matrix.h ) @@ -70,7 +70,6 @@ FILE(GLOB NLMISC_PLATFORM inter_window_msg_queue.cpp ../../include/nel/misc/inter_window_msg_queue.h system_*.cpp ../../include/nel/misc/system_*.h win32_util.cpp ../../include/nel/misc/win32_util.h - win_tray.cpp ../../include/nel/misc/win_tray.h ) FILE(GLOB NLMISC_GENERIC @@ -80,7 +79,7 @@ FILE(GLOB NLMISC_GENERIC ../../include/nel/misc/callback.h *_allocator.cpp ../../include/nel/misc/*_allocator.h ../../include/nel/misc/enum_bitset.h - fast_id_map.cpp ../../include/nel/misc/fast_id_map.h + ../../include/nel/misc/fast_id_map.h hierarchical_timer.cpp ../../include/nel/misc/hierarchical_timer.h ../../include/nel/misc/historic.h ../../include/nel/misc/mutable_container.h @@ -92,11 +91,11 @@ FILE(GLOB NLMISC_GENERIC bit_set.cpp ../../include/nel/misc/bit_set.h stop_watch.cpp ../../include/nel/misc/stop_watch.h ../../include/nel/misc/twin_map.h - object_vector.cpp ../../include/nel/misc/object_vector.h + ../../include/nel/misc/object_vector.h ../../include/nel/misc/singleton.h speaker_listener.cpp ../../include/nel/misc/speaker_listener.h ../../include/nel/misc/static_map.h - stl_block_list.cpp ../../include/nel/misc/stl_block_list.h + ../../include/nel/misc/stl_block_list.h ) FILE(GLOB NLMISC_UTILITY @@ -118,7 +117,7 @@ FILE(GLOB NLMISC_UTILITY progress_callback.cpp ../../include/nel/misc/progress_callback.h sheet_id.cpp ../../include/nel/misc/sheet_id.h variable.cpp ../../include/nel/misc/variable.h - value_smoother.cpp ../../include/nel/misc/value_smoother.h + ../../include/nel/misc/value_smoother.h ) FILE(GLOB NLMISC_STRING diff --git a/code/nel/src/misc/big_file.cpp b/code/nel/src/misc/big_file.cpp index a458b602d..fc247b07b 100644 --- a/code/nel/src/misc/big_file.cpp +++ b/code/nel/src/misc/big_file.cpp @@ -45,8 +45,16 @@ void CBigFile::releaseInstance() // *************************************************************************** CBigFile::CThreadFileArray::CThreadFileArray() { - _CurrentId= 0; + _CurrentId = 0; } + +// *************************************************************************** +CBigFile::CThreadFileArray::~CThreadFileArray() +{ + vector *ptr = (vector*)_TDS.getPointer(); + if (ptr) delete ptr; +} + // *************************************************************************** uint32 CBigFile::CThreadFileArray::allocate() { @@ -186,11 +194,24 @@ void CBigFile::remove (const std::string &sBigFileName) fclose (handle.File); handle.File= NULL; } - delete [] rbnp.FileNames; + _BNPs.erase (it); } } +CBigFile::BNP::BNP() : FileNames(NULL), ThreadFileId(0), CacheFileOnOpen(false), AlwaysOpened(false), InternalUse(false), OffsetFromBeginning(0) +{ +} + +CBigFile::BNP::~BNP() +{ + if (FileNames) + { + delete[] FileNames; + FileNames = NULL; + } +} + //// *************************************************************************** bool CBigFile::BNP::readHeader() { diff --git a/code/nel/src/misc/bitmap_gif.cpp b/code/nel/src/misc/bitmap_gif.cpp index 4ae9dd0cf..9904d8312 100644 --- a/code/nel/src/misc/bitmap_gif.cpp +++ b/code/nel/src/misc/bitmap_gif.cpp @@ -23,6 +23,10 @@ using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/bitmap_png.cpp b/code/nel/src/misc/bitmap_png.cpp index 459437f5c..251fd5495 100644 --- a/code/nel/src/misc/bitmap_png.cpp +++ b/code/nel/src/misc/bitmap_png.cpp @@ -91,7 +91,7 @@ uint8 CBitmap::readPNG( NLMISC::IStream &f ) // free all of the memory associated with the png_ptr and info_ptr png_destroy_read_struct(&png_ptr, &info_ptr, NULL); // if we get here, we had a problem reading the file - nlwarning("failed to setjump"); + nlwarning("Error while reading PNG"); return 0; } @@ -241,6 +241,21 @@ uint8 CBitmap::readPNG( NLMISC::IStream &f ) return imageDepth; } +// small helper to avoid local variables +static bool writePNGSetJmp(png_struct *png_ptr) +{ + if (setjmp(png_jmpbuf(png_ptr))) + { + // free all of the memory associated with the png_ptr + png_destroy_write_struct(&png_ptr, (png_info**)NULL); + // if we get here, we had a problem writing the file + nlwarning("Error while writing PNG"); + return false; + } + + return true; +} + /*-------------------------------------------------------------------*\ writePNG \*-------------------------------------------------------------------*/ @@ -274,12 +289,7 @@ bool CBitmap::writePNG( NLMISC::IStream &f, uint32 d) return false; } - if (setjmp(png_jmpbuf(png_ptr))) - { - png_destroy_write_struct( &png_ptr, (png_info**)NULL ); - nlwarning("couldn't set setjmp"); - return false; - } + if (!writePNGSetJmp(png_ptr)) return false; // set the write function png_set_write_fn(png_ptr, (void*)&f, writePNGData, NULL); diff --git a/code/nel/src/misc/cdb.cpp b/code/nel/src/misc/cdb.cpp index 0a38dc71d..60f6801bd 100644 --- a/code/nel/src/misc/cdb.cpp +++ b/code/nel/src/misc/cdb.cpp @@ -28,6 +28,10 @@ //////////////// using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLMISC{ CStringMapper *ICDBNode::_DBSM = NULL; diff --git a/code/nel/src/misc/cdb_bank_handler.cpp b/code/nel/src/misc/cdb_bank_handler.cpp index 58843455d..78102498f 100644 --- a/code/nel/src/misc/cdb_bank_handler.cpp +++ b/code/nel/src/misc/cdb_bank_handler.cpp @@ -17,6 +17,10 @@ #include "stdmisc.h" #include "nel/misc/cdb_bank_handler.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLMISC{ CCDBBankHandler::CCDBBankHandler(uint maxbanks) : _CDBBankToUnifiedIndexMapping( maxbanks, std::vector< uint >() ), diff --git a/code/nel/src/misc/cdb_branch.cpp b/code/nel/src/misc/cdb_branch.cpp index 55b36a645..92631280c 100644 --- a/code/nel/src/misc/cdb_branch.cpp +++ b/code/nel/src/misc/cdb_branch.cpp @@ -56,6 +56,9 @@ using namespace std; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NLMISC{ diff --git a/code/nel/src/misc/cdb_branch_observing_handler.cpp b/code/nel/src/misc/cdb_branch_observing_handler.cpp index 8e6335533..b64862a18 100644 --- a/code/nel/src/misc/cdb_branch_observing_handler.cpp +++ b/code/nel/src/misc/cdb_branch_observing_handler.cpp @@ -17,6 +17,10 @@ #include "stdmisc.h" #include "nel/misc/cdb_branch_observing_handler.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLMISC{ CCDBBranchObservingHandler::CCDBBranchObservingHandler() { diff --git a/code/nel/src/misc/cdb_check_sum.cpp b/code/nel/src/misc/cdb_check_sum.cpp index d3619299d..7ec6614b2 100644 --- a/code/nel/src/misc/cdb_check_sum.cpp +++ b/code/nel/src/misc/cdb_check_sum.cpp @@ -17,6 +17,9 @@ #include "stdmisc.h" #include "nel/misc/cdb_check_sum.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NLMISC{ diff --git a/code/nel/src/misc/cdb_leaf.cpp b/code/nel/src/misc/cdb_leaf.cpp index f74fb2d3d..c996b78f3 100644 --- a/code/nel/src/misc/cdb_leaf.cpp +++ b/code/nel/src/misc/cdb_leaf.cpp @@ -35,6 +35,10 @@ //////////////// using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLMISC{ diff --git a/code/nel/src/misc/cdb_manager.cpp b/code/nel/src/misc/cdb_manager.cpp index db743416d..1b19f4141 100644 --- a/code/nel/src/misc/cdb_manager.cpp +++ b/code/nel/src/misc/cdb_manager.cpp @@ -17,6 +17,10 @@ #include "stdmisc.h" #include "nel/misc/cdb_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace NLMISC{ CCDBManager::CCDBManager( const char *rootNodeName, uint maxBanks ) : bankHandler( maxBanks ) diff --git a/code/nel/src/misc/check_fpu.cpp b/code/nel/src/misc/check_fpu.cpp index 0f2359eeb..0ceb3af2b 100644 --- a/code/nel/src/misc/check_fpu.cpp +++ b/code/nel/src/misc/check_fpu.cpp @@ -24,6 +24,9 @@ #pragma optimize("", off ) +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 5954ac9c9..f455f121f 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -761,7 +761,8 @@ static bool createProcess(const std::string &programName, const std::string &arg sProgramName = new wchar_t[MAX_PATH]; wcscpy(sProgramName, (wchar_t*)ucProgramName.c_str()); - args = arguments; + // important! we need to specify the executable full path as first argument + args = toString("\"%s\" ", programName.c_str()) + arguments; } BOOL res = CreateProcessW(sProgramName, utf8ToWide(args), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi); @@ -1416,17 +1417,17 @@ NLMISC_CATEGORISED_COMMAND(nel, killProgram, "kill a program given the pid", "

31); + // create process + PROCESS_INFORMATION pi; + return createProcess(program, document, false, pi); } } } @@ -1551,18 +1556,18 @@ static bool openDocWithExtension (const char *document, const char *ext) return false; } -bool openURL (const char *url) +bool openURL(const std::string &url) { return openDocWithExtension(url, "htm"); } -bool openDoc (const char *document) +bool openDoc(const std::string &document) { // get extension from document fullpath string ext = CFile::getExtension(document); // try to open document - return openDocWithExtension(document, ext.c_str()); + return openDocWithExtension(document, ext); } } // NLMISC diff --git a/code/nel/src/misc/config_file/cf_gramatical.cpp b/code/nel/src/misc/config_file/cf_gramatical.cpp index 1d8c568b7..d386b72ad 100644 --- a/code/nel/src/misc/config_file/cf_gramatical.cpp +++ b/code/nel/src/misc/config_file/cf_gramatical.cpp @@ -50,6 +50,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /* Constantes */ #define YYPARSE_PARAM pvararray diff --git a/code/nel/src/misc/config_file/cf_lexical.cpp b/code/nel/src/misc/config_file/cf_lexical.cpp index 8c39112a6..d132f4df8 100644 --- a/code/nel/src/misc/config_file/cf_lexical.cpp +++ b/code/nel/src/misc/config_file/cf_lexical.cpp @@ -1938,6 +1938,10 @@ char *yytext; using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /* Constantes */ // WARNING!!!! DEBUG_PRINTF are commented using // so IT MUST HAVE NO INSTRUCTION AFTER A DEBUG_PRINTF OR THEY LL BE COMMENTED @@ -3217,7 +3221,7 @@ static void *yy_flex_alloc( size ) yy_size_t size; #endif { - return (void *) malloc( size ); + return (void *) malloc( size ); // TODO: delete } #ifdef YY_USE_PROTOS diff --git a/code/nel/src/misc/contiguous_block_allocator.cpp b/code/nel/src/misc/contiguous_block_allocator.cpp index 6db4b0d63..b99c6b090 100644 --- a/code/nel/src/misc/contiguous_block_allocator.cpp +++ b/code/nel/src/misc/contiguous_block_allocator.cpp @@ -90,7 +90,7 @@ void *CContiguousBlockAllocator::alloc(uint numBytes) } // ********************************************************************************************************* -void CContiguousBlockAllocator::free(void *block, uint numBytes) +void CContiguousBlockAllocator::freeBlock(void *block, uint numBytes) { if (!block) return; #ifdef NL_DEBUG diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index 01fe6257a..020416b01 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -23,7 +23,9 @@ # include # include # pragma comment(lib, "imagehlp.lib") -# define getcwd(_a, _b) (_getcwd(_a,_b)) +# ifndef getcwd +# define getcwd(_a, _b) (_getcwd(_a,_b)) +# endif # ifdef NL_OS_WIN64 # define DWORD_TYPE DWORD64 # else @@ -178,7 +180,7 @@ void nlFatalError (const char *format, ...) char *str; NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/); - INelContext::getInstance().setDebugNeedAssert( NLMISC::DefaultMsgBoxDisplayer==0 ); + INelContext::getInstance().setDebugNeedAssert( NLMISC::DefaultMsgBoxDisplayer == NULL ); NLMISC::ErrorLog->displayNL (str); @@ -197,7 +199,7 @@ void nlError (const char *format, ...) char *str; NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/); - INelContext::getInstance().setDebugNeedAssert( NLMISC::DefaultMsgBoxDisplayer==0 ); + INelContext::getInstance().setDebugNeedAssert( NLMISC::DefaultMsgBoxDisplayer == NULL ); NLMISC::ErrorLog->displayNL (str); diff --git a/code/nel/src/misc/event_emitter.cpp b/code/nel/src/misc/event_emitter.cpp deleted file mode 100644 index 0cf3aad72..000000000 --- a/code/nel/src/misc/event_emitter.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -// remove stupid VC6 warnings -void foo_event_emitter_cpp() {} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - - -} // NLMISC diff --git a/code/nel/src/misc/fast_id_map.cpp b/code/nel/src/misc/fast_id_map.cpp deleted file mode 100644 index 5ba919b09..000000000 --- a/code/nel/src/misc/fast_id_map.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * \file fast_id_map.cpp - * \brief CFastIdMap - * \date 2012-04-10 19:28GMT - * \author Jan Boon (Kaetemi) - * CFastIdMap - */ - -/* - * Copyright (C) 2012 by authors - * - * This file is part of RYZOM CORE. - * RYZOM CORE is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * RYZOM CORE is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public - * License along with RYZOM CORE. If not, see - * . - */ - -#include -#include - -// STL includes - -// NeL includes -// #include - -// Project includes - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - -void dummytoavoidthecompilerwarningfastidmap() { } - -} /* namespace NLMISC */ - -/* end of file */ diff --git a/code/nel/src/misc/fixed_size_allocator.cpp b/code/nel/src/misc/fixed_size_allocator.cpp index 30693ddfd..6ec664db4 100644 --- a/code/nel/src/misc/fixed_size_allocator.cpp +++ b/code/nel/src/misc/fixed_size_allocator.cpp @@ -73,7 +73,7 @@ void *CFixedSizeAllocator::alloc() #define aligned_offsetof(s, m) ((offsetof(s, m) + (NL_DEFAULT_MEMORY_ALIGNMENT - 1)) & ~(NL_DEFAULT_MEMORY_ALIGNMENT - 1)) // ***************************************************************************************************************** -void CFixedSizeAllocator::free(void *block) +void CFixedSizeAllocator::freeBlock(void *block) { if (!block) return; /// get the node from the object diff --git a/code/nel/src/misc/geom_ext.cpp b/code/nel/src/misc/geom_ext.cpp deleted file mode 100644 index 32dba1d60..000000000 --- a/code/nel/src/misc/geom_ext.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/geom_ext.h" - - -// leave not static else this workaround don't work -void dummyToAvoidStupidCompilerWarning_misc_geom_ext_cpp() -{ -} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC -{ - - - -} // NLMISC diff --git a/code/nel/src/misc/heap_memory.cpp b/code/nel/src/misc/heap_memory.cpp index 0c3918ba0..89ce75e50 100644 --- a/code/nel/src/misc/heap_memory.cpp +++ b/code/nel/src/misc/heap_memory.cpp @@ -165,7 +165,7 @@ void *CHeapMemory::allocate(uint size) } // *************************************************************************** -void CHeapMemory::free(void *ptr) +void CHeapMemory::freeBlock(void *ptr) { if(ptr==NULL) return; diff --git a/code/nel/src/misc/log.cpp b/code/nel/src/misc/log.cpp index 4efae637a..277048c3b 100644 --- a/code/nel/src/misc/log.cpp +++ b/code/nel/src/misc/log.cpp @@ -615,8 +615,12 @@ void CLog::releaseProcessName() { INelContext::getInstance().releaseSingletonPointer("NLMISC::CLog::_ProcessName", _ProcessName); } - delete _ProcessName; - _ProcessName = NULL; + + if (_ProcessName) + { + delete _ProcessName; + _ProcessName = NULL; + } } } // NLMISC diff --git a/code/nel/src/misc/object_arena_allocator.cpp b/code/nel/src/misc/object_arena_allocator.cpp index 5fba66005..e27a066ec 100644 --- a/code/nel/src/misc/object_arena_allocator.cpp +++ b/code/nel/src/misc/object_arena_allocator.cpp @@ -97,7 +97,7 @@ void *CObjectArenaAllocator::alloc(uint size) } // ***************************************************************************************************************** -void CObjectArenaAllocator::free(void *block) +void CObjectArenaAllocator::freeBlock(void *block) { if (!block) return; uint8 *realBlock = (uint8 *) block - NL_DEFAULT_MEMORY_ALIGNMENT; // sizeof(uint); // a uint is used at start of block to give its size @@ -114,7 +114,7 @@ void CObjectArenaAllocator::free(void *block) } uint entry = ((size + (_Granularity - 1)) / _Granularity); nlassert(entry < _ObjectSizeToAllocator.size()); - _ObjectSizeToAllocator[entry]->free(realBlock); + _ObjectSizeToAllocator[entry]->freeBlock(realBlock); #ifdef NL_DEBUG std::map::iterator it = _MemBlockToAllocID.find(realBlock); nlassert(it != _MemBlockToAllocID.end()); diff --git a/code/nel/src/misc/object_vector.cpp b/code/nel/src/misc/object_vector.cpp deleted file mode 100644 index 7a863342b..000000000 --- a/code/nel/src/misc/object_vector.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/object_vector.h" - -// leave not static else this workaround don't work -void dummyToAvoidStupidCompilerWarning_misc_object_vector_cpp() -{ -} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - -} // NLMISC diff --git a/code/nel/src/misc/quad.cpp b/code/nel/src/misc/quad.cpp deleted file mode 100644 index 8fced3318..000000000 --- a/code/nel/src/misc/quad.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/quad.h" - - -// leave not static else this workaround don't work -void dummyToAvoidStupidCompilerWarning_misc_quad_cpp() -{ -} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - - - -} // NLMISC diff --git a/code/nel/src/misc/smart_ptr.cpp b/code/nel/src/misc/smart_ptr.cpp index e5c31fcd7..73c3c0799 100644 --- a/code/nel/src/misc/smart_ptr.cpp +++ b/code/nel/src/misc/smart_ptr.cpp @@ -29,12 +29,5 @@ namespace NLMISC //CPtrInfo() {Ptr=NULL; RefCount=0x7FFFFFFF; IsNullPtrInfo=true;} CRefCount::CPtrInfoBase CRefCount::NullPtrInfo= {NULL, 0x7FFFFFFF, true}; - -// must not be static -void dummy_to_avoid_stupid_4768_smart_ptr_cpp() -{ -} - - } diff --git a/code/nel/src/misc/stdmisc.h b/code/nel/src/misc/stdmisc.h index 3ed96f900..d7a623465 100644 --- a/code/nel/src/misc/stdmisc.h +++ b/code/nel/src/misc/stdmisc.h @@ -17,6 +17,13 @@ #ifndef NL_STDMISC_H #define NL_STDMISC_H +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif + #include #include #include diff --git a/code/nel/src/misc/stl_block_allocator.cpp b/code/nel/src/misc/stl_block_allocator.cpp deleted file mode 100644 index f57d0c238..000000000 --- a/code/nel/src/misc/stl_block_allocator.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/stl_block_allocator.h" - -// remove stupid VC6 warnings -void foo_stl_block_allocator_cpp() {} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - - - -} // NLMISC diff --git a/code/nel/src/misc/stl_block_list.cpp b/code/nel/src/misc/stl_block_list.cpp deleted file mode 100644 index 628b79371..000000000 --- a/code/nel/src/misc/stl_block_list.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/stl_block_list.h" - -// remove stupid VC6 warnings -void foo_stl_block_list_cpp() {} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - - -} // NLMISC diff --git a/code/nel/src/misc/string_common.cpp b/code/nel/src/misc/string_common.cpp index dd8d1fe96..9c9085e4e 100644 --- a/code/nel/src/misc/string_common.cpp +++ b/code/nel/src/misc/string_common.cpp @@ -27,7 +27,7 @@ using namespace std; namespace NLMISC { -string addSlashR (string str) +string addSlashR (const string &str) { string formatedStr; // replace \n with \r\n @@ -42,10 +42,10 @@ string addSlashR (string str) return formatedStr; } -string removeSlashR (string str) +string removeSlashR (const string &str) { string formatedStr; - // replace \n with \r\n + // remove \r for (uint i = 0; i < str.size(); i++) { if (str[i] != '\r') diff --git a/code/nel/src/misc/string_id_array.cpp b/code/nel/src/misc/string_id_array.cpp deleted file mode 100644 index b9489e3f9..000000000 --- a/code/nel/src/misc/string_id_array.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/string_id_array.h" - - -// leave not static else this workaround don't work -void dummyToAvoidStupidCompilerWarning_misc_string_id_array_cpp() -{ -} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - - -} // NLMISC diff --git a/code/nel/src/misc/uv.cpp b/code/nel/src/misc/uv.cpp deleted file mode 100644 index 9926efcc7..000000000 --- a/code/nel/src/misc/uv.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/uv.h" - - -// leave not static else this workaround don't work -void dummyToAvoidStupidCompilerWarning_misc_uv_cpp() -{ -} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC -{ - - - -} // NLMISC diff --git a/code/nel/src/misc/value_smoother.cpp b/code/nel/src/misc/value_smoother.cpp deleted file mode 100644 index 12de7842b..000000000 --- a/code/nel/src/misc/value_smoother.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/value_smoother.h" - -// remove stupid VC6 warnings -void foo_value_smoother_cpp() {} diff --git a/code/nel/src/misc/vector_2d.cpp b/code/nel/src/misc/vector_2d.cpp deleted file mode 100644 index 939e41239..000000000 --- a/code/nel/src/misc/vector_2d.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/vector_2d.h" - - -// leave not static else this workaround don't work -void dummyToAvoidStupidCompilerWarning_misc_vector_2d_cpp() -{ -} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC -{ - - - -} // NLMISC diff --git a/code/nel/src/misc/vector_h.cpp b/code/nel/src/misc/vector_h.cpp deleted file mode 100644 index 67eb41f6b..000000000 --- a/code/nel/src/misc/vector_h.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" - -#include "nel/misc/vector_h.h" - - -// leave not static else this workaround don't work -void dummyToAvoidStupidCompilerWarning_misc_vector_h_cpp() -{ -} - -#ifdef DEBUG_NEW - #define new DEBUG_NEW -#endif - -namespace NLMISC { - - - -} // NLMISC diff --git a/code/nel/src/misc/win_tray.cpp b/code/nel/src/misc/win_tray.cpp deleted file mode 100644 index 73e837813..000000000 --- a/code/nel/src/misc/win_tray.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "stdmisc.h" diff --git a/code/nel/src/misc/words_dictionary.cpp b/code/nel/src/misc/words_dictionary.cpp index 4d5057dd7..f0e7751ea 100644 --- a/code/nel/src/misc/words_dictionary.cpp +++ b/code/nel/src/misc/words_dictionary.cpp @@ -23,12 +23,12 @@ using namespace std; -const string DefaultColTitle = "name"; - #ifdef DEBUG_NEW - #define new DEBUG_NEW +#define new DEBUG_NEW #endif +const string DefaultColTitle = "name"; + namespace NLMISC { NL_INSTANCE_COUNTER_IMPL(CWordsDictionary); diff --git a/code/nel/src/misc/xml_auto_ptr.cpp b/code/nel/src/misc/xml_auto_ptr.cpp index fbf681e1c..2315cd52b 100644 --- a/code/nel/src/misc/xml_auto_ptr.cpp +++ b/code/nel/src/misc/xml_auto_ptr.cpp @@ -21,6 +21,10 @@ #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + //======================================= void CXMLAutoPtr::destroy() { diff --git a/code/nel/src/net/email.cpp b/code/nel/src/net/email.cpp index 9ac22c886..f402edd65 100644 --- a/code/nel/src/net/email.cpp +++ b/code/nel/src/net/email.cpp @@ -196,15 +196,8 @@ bool sendEmail (const string &smtpServer, const string &from, const string &to, // we must skip the first line formatedBody = "\r\n"; - // replace \n with \r\n - for (i = 0; i < body.size(); i++) - { - if (body[i] == '\n' && i > 0 && body[i-1] != '\r') - { - formatedBody += '\r'; - } - formatedBody += body[i]; - } + // replace \n by \r\n + formatedBody += addSlashR(body); // add attachment if any if (!attachedFile.empty()) diff --git a/code/nel/src/pacs/move_container.cpp b/code/nel/src/pacs/move_container.cpp index 7eeca8f08..c302b53ab 100644 --- a/code/nel/src/pacs/move_container.cpp +++ b/code/nel/src/pacs/move_container.cpp @@ -1304,8 +1304,8 @@ void CMoveContainer::freeAllOTInfo () { H_AUTO (NLPACS_Free_All_OT_Info); - _AllocOTDynamicInfo.free (); - _AllocOTStaticInfo.free (); + _AllocOTDynamicInfo.freeBlock (); + _AllocOTStaticInfo.freeBlock (); } // *************************************************************************** diff --git a/code/nel/src/sound/driver/openal/stdopenal.h b/code/nel/src/sound/driver/openal/stdopenal.h index 37b7e5e2f..f689a1e53 100644 --- a/code/nel/src/sound/driver/openal/stdopenal.h +++ b/code/nel/src/sound/driver/openal/stdopenal.h @@ -14,7 +14,15 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "nel/misc/types_nl.h" +#ifndef STDOPENAL_H +#define STDOPENAL_H + +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif #include #include @@ -35,6 +43,8 @@ #include #include +#include "nel/misc/types_nl.h" + #ifdef NL_OS_MAC # include # include @@ -59,4 +69,5 @@ #include "nel/sound/driver/listener.h" #include "nel/sound/driver/effect.h" +#endif /* end of file */ diff --git a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h index 76b2a13d8..f6e55d0aa 100644 --- a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h @@ -17,7 +17,12 @@ #ifndef NLSOUND_STDPCH_XAUDIO2_H #define NLSOUND_STDPCH_XAUDIO2_H -#include "nel/misc/types_nl.h" +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif // STL includes #include @@ -27,6 +32,8 @@ #include #include +#include "nel/misc/types_nl.h" + // 3rd Party Includes #include #define XAUDIO2_HELPER_FUNCTIONS diff --git a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp index 052eb04a0..44b43beed 100644 --- a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp @@ -33,9 +33,10 @@ #include "nel/misc/stream.h" // From ligo library -#include "nel/../../src/ligo/zone_template.h" +#include "nel/ligo/zone_template.h" #include "nel/ligo/ligo_config.h" -#include "nel/../../src/ligo/ligo_error.h" +#include "nel/ligo/ligo_error.h" +#include "nel/misc/path.h" using namespace std; using namespace NLMISC; @@ -131,15 +132,12 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di if (res) { // Path - TCHAR sDrive[256]; - TCHAR sDir[256]; - _tsplitpath (sModulePath, sDrive, sDir, NULL, NULL); - _tmakepath (sModulePath, sDrive, sDir, _T("ligoscape"), _T(".cfg")); + std::string path = NLMISC::CFile::getPath(tStrToUtf8(sModulePath) + "ligoscape.cfg"); try { // Load the config file - config.readConfigFile (tStrToUtf8(sModulePath), false); + config.readConfigFile (path, false); // ok return true; diff --git a/code/nel/tools/3d/ligo/plugin_max/script.cpp b/code/nel/tools/3d/ligo/plugin_max/script.cpp index b494f69ff..36d5ff109 100644 --- a/code/nel/tools/3d/ligo/plugin_max/script.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/script.cpp @@ -80,9 +80,9 @@ namespace std #include "nel/misc/config_file.h" // From ligo library -#include "nel/../../src/ligo/zone_template.h" +#include "nel/ligo/zone_template.h" #include "nel/ligo/ligo_config.h" -#include "nel/../../src/ligo/ligo_error.h" +#include "nel/ligo/ligo_error.h" #include "nel/../../src/ligo/ligo_material.h" #include "nel/../../src/ligo/transition.h" #include "nel/ligo/zone_bank.h" @@ -250,7 +250,7 @@ Value* export_material_cf (Value** arg_list, int count) ok = false; } } - catch (Exception &e) + catch (const Exception &e) { // Error message char tmp[512]; @@ -262,8 +262,8 @@ Value* export_material_cf (Value** arg_list, int count) // Remove the files if (!ok) { - remove (fileName); - remove (path); + CFile::deleteFile(fileName); + CFile::deleteFile(path); } } } @@ -549,7 +549,7 @@ Value* export_transition_cf (Value** arg_list, int count) for (uint file=0; filedwFileVersionMS>>16, - info->dwFileVersionMS&0xffff, - info->dwFileVersionLS>>16, + TCHAR version[512]; + _stprintf (version, _T("Version %d.%d.%d.%d"), + info->dwFileVersionMS>>16, + info->dwFileVersionMS&0xffff, + info->dwFileVersionLS>>16, info->dwFileVersionLS&0xffff); GetDlgItem (IDC_VERSION)->SetWindowText (version); } diff --git a/code/nel/tools/3d/object_viewer/edit_ex.cpp b/code/nel/tools/3d/object_viewer/edit_ex.cpp index a48b4642f..97df943f2 100644 --- a/code/nel/tools/3d/object_viewer/edit_ex.cpp +++ b/code/nel/tools/3d/object_viewer/edit_ex.cpp @@ -83,7 +83,7 @@ void CEditEx::setSInt(sint value) { nlassert(_Type == SIntType); TCHAR buf[16]; - _tcprintf(buf, "%d", (int) value); + _stprintf(buf, _T("%d"), (int) value); setString(buf); } @@ -91,7 +91,7 @@ void CEditEx::setUInt(uint value) { nlassert(_Type == UIntType); TCHAR buf[16]; - _tcprintf(buf, "%d", (int) value); + _stprintf(buf, _T("%d"), (int) value); setString(buf); } @@ -99,7 +99,7 @@ void CEditEx::setFloat(float value) { nlassert(_Type == FloatType); TCHAR buf[16]; - _tcprintf(buf, "%g", (double) value); + _stprintf(buf, _T("%g"), (double) value); setString(buf); } diff --git a/code/nel/tools/3d/object_viewer/editable_range.h b/code/nel/tools/3d/object_viewer/editable_range.h index 65c633352..5a4b6263c 100644 --- a/code/nel/tools/3d/object_viewer/editable_range.h +++ b/code/nel/tools/3d/object_viewer/editable_range.h @@ -346,7 +346,7 @@ inline const TCHAR *CEditableRangeT::string2value(const CString &value, sint32 tmp; if (NLMISC::fromString(tStrToUtf8(value), tmp)) { - if (strchr((LPCTSTR) value, '-')) + if (value.Find(_T("-")) > -1) { return _T("negative values not allowed"); } diff --git a/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp b/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp index 95f54acb7..ef55408e1 100644 --- a/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/global_wind_dlg.cpp @@ -65,7 +65,7 @@ void CGlobalWindDlg::updateView() // update Power. a= _ObjViewer->getGlobalWindPower(); - _tcprintf(str, "%.2f", a); + _stprintf(str, _T("%.2f"), a); StaticPower.SetWindowText(str); NLMISC::clamp(a, 0.f, 1.f); SliderPower.SetPos((sint)(a*NL_GLOBAL_WIND_SLIDER_RANGE)); @@ -117,7 +117,7 @@ void CGlobalWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) a= (float)nPos / NL_GLOBAL_WIND_SLIDER_RANGE; _ObjViewer->setGlobalWindPower(a); - _tcprintf(str, "%.2f", a); + _stprintf(str, _T("%.2f"), a); StaticPower.SetWindowText(str); } else diff --git a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp index 58776b931..58d67bd0b 100644 --- a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp @@ -214,10 +214,10 @@ void CMultiTexDlg::writeValues(bool alternate) GetDlgItem(IDC_U_SPEED_2)->GetWindowText(u2, 10); GetDlgItem(IDC_V_SPEED_2)->GetWindowText(v2, 10); - if (_tcscanf(u1, "%f", &vs1.x) == 1 && - _tcscanf(v1, "%f", &vs1.y) == 1 && - _tcscanf(u2, "%f", &vs2.x) == 1 && - _tcscanf(v2, "%f", &vs2.y) == 1) + if (_stscanf(u1, _T("%f"), &vs1.x) == 1 && + _stscanf(v1, _T("%f"), &vs1.y) == 1 && + _stscanf(u2, _T("%f"), &vs2.x) == 1 && + _stscanf(v2, _T("%f"), &vs2.y) == 1) { _MTP->setScrollSpeed(0, vs1); _MTP->setScrollSpeed(1, vs2); @@ -236,10 +236,10 @@ void CMultiTexDlg::writeValues(bool alternate) GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->GetWindowText(v1, 10); GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->GetWindowText(u2, 10); GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->GetWindowText(v2, 10); - if (_tcscanf(u1, "%f", &vs1.x) == 1 && - _tcscanf(v1, "%f", &vs1.y) == 1 && - _tcscanf(u2, "%f", &vs2.x) == 1 && - _tcscanf(v2, "%f", &vs2.y) == 1) + if (_stscanf(u1, _T("%f"), &vs1.x) == 1 && + _stscanf(v1, _T("%f"), &vs1.y) == 1 && + _stscanf(u2, _T("%f"), &vs2.x) == 1 && + _stscanf(v2, _T("%f"), &vs2.y) == 1) { _MTP->setAlternateScrollSpeed(0, vs1); _MTP->setAlternateScrollSpeed(1, vs2); @@ -251,7 +251,7 @@ void CMultiTexDlg::writeValues(bool alternate) TCHAR bumpFactorTxt[10]; float bumpFactor; GetDlgItem(IDC_BUMP_FACTOR)->GetWindowText(bumpFactorTxt, 10); - if (_tcscanf(bumpFactorTxt, "%f", &bumpFactor) == 1) + if (_stscanf(bumpFactorTxt, _T("%f"), &bumpFactor) == 1) { _MTP->setBumpFactor(bumpFactor); updateModifiedFlag(); diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index 4b78b9838..00d530dd6 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -93,8 +93,7 @@ using namespace NLPACS; -static char SDrive[256]; -static char SDir[256]; +static std::string SPath; uint SkeletonUsedForSound = 0xFFFFFFFF; CSoundContext SoundContext; @@ -285,9 +284,9 @@ std::string CObjectViewer::getModulePath() const int res = GetModuleFileName(hModule, sModulePath, 256); nlassert(res); nldebug("Object viewer module path is '%s'", sModulePath); - std::string path = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)); + SPath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)); - return NLMISC::CPath::standardizeDosPath(path) + "object_viewer.cfg"; + return SPath + "object_viewer.cfg"; } @@ -812,11 +811,10 @@ bool CObjectViewer::initUI (HWND parent) // Enable sum of vram CNELU::Driver->enableUsedTextureMemorySum (); - char sModulePath[256]; // load the scheme bank if one is present CIFile iF; - ::_makepath (sModulePath, SDrive, SDir, "default", ".scb"); - if (iF.open(sModulePath)) + std::string path = SPath + "default.scb"; + if (iF.open(path)) { try { @@ -831,8 +829,9 @@ bool CObjectViewer::initUI (HWND parent) iF.close(); // try to load a default config file for the viewer (for anitmation and particle edition setup) - ::_makepath (sModulePath, SDrive, SDir, "default", ".ovcgf"); - if (iF.open (sModulePath)) + path = SPath + "default.ovcgf"; + + if (iF.open (path)) { try { @@ -1886,7 +1885,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename) if (file.open (igFilename)) { // Shape pointer - NL3D::CInstanceGroup *ig= new NL3D::CInstanceGroup; + NL3D::CInstanceGroup *ig = new NL3D::CInstanceGroup; try { diff --git a/code/nel/tools/3d/object_viewer/particle_system_edit.cpp b/code/nel/tools/3d/object_viewer/particle_system_edit.cpp index 6d833acdf..7aa989d8b 100644 --- a/code/nel/tools/3d/object_viewer/particle_system_edit.cpp +++ b/code/nel/tools/3d/object_viewer/particle_system_edit.cpp @@ -403,9 +403,9 @@ void CParticleSystemEdit::updateBBoxFromText() m_BBoxYCtrl.GetWindowText(inY, 128); m_BBoxZCtrl.GetWindowText(inZ, 128); - if (_tcscanf(inX, "%f", &h.x) == 1 - && _tcscanf(inY, "%f", &h.y) == 1 - && _tcscanf(inZ, "%f", &h.z) == 1 + if (_stscanf(inX, _T("%f"), &h.x) == 1 + && _stscanf(inY, _T("%f"), &h.y) == 1 + && _stscanf(inZ, _T("%f"), &h.z) == 1 ) { NLMISC::CAABBox b; @@ -466,7 +466,7 @@ void CParticleSystemEdit::OnChangeApplyAfterDelay() GetDlgItem(IDC_APPLY_AFTER_DELAY)->GetWindowText(in, 128); float value; - if (_tcscanf(in, "%f", &value) == 1) + if (_stscanf(in, _T("%f"), &value) == 1) { if (_Node->getPSPointer()->getDelayBeforeDeathConditionTest() != value) { diff --git a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp index 8cbb869de..89830cd5b 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp @@ -224,15 +224,6 @@ void CSnapshotToolDlg::toRegistry() RegSetValueEx(hKey, _T("Filters"), 0, REG_SZ, (BYTE*) (LPCTSTR) filters, filters.GetLength() + 1); DWORD recurseSubFolder = m_RecurseSubFolder; DWORD dumpTextureSets = m_DumpTextureSets; - DWORD views [] = - { - m_ViewBack, - m_ViewBottom, - m_ViewFront, - m_ViewLeft, - m_ViewRight, - m_ViewTop - }; DWORD width = (DWORD) m_OutputWidth; DWORD height = (DWORD) m_OutputHeight; DWORD format = m_Format; @@ -710,7 +701,25 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent) { outputFilename += "_" + viewToString(viewIndex); } - outputFilename += (m_Format == OutputFormat_Tga ? ".tga" : ".jpg"); + + std::string ext; + switch (m_Format) + { + case OutputFormat_Tga: + ext = "tga"; + break; + case OutputFormat_Png: + ext = "png"; + break; + case OutputFormat_Jpg: + ext = "jpg"; + break; + default: + nlerror("Unsupported format %d", m_Format); + break; + } + outputFilename += "." + ext; + switch(m_OutputPathOption) { case OutputPath_Custom: // custom output path @@ -724,10 +733,15 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent) break; } COFile output(outputFilename); + if (m_Format == OutputFormat_Tga) { snapshot.writeTGA(output); } + else if (m_Format == OutputFormat_Png) + { + snapshot.writePNG(output); + } else { snapshot.writeJPG(output); diff --git a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h index 72df1dea5..a9b1d476a 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.h @@ -42,20 +42,21 @@ public: enum { - OutputFormat_Tga = 0, + OutputFormat_Tga, + OutputFormat_Png, OutputFormat_Jpg }; enum { - OutputPath_Custom = 0, + OutputPath_Custom, OutputPath_SameAsInput, OutputPath_CurrShapeDirectory, }; enum { - SnapshotAngle_Front = 0, + SnapshotAngle_Front, SnapshotAngle_Right, SnapshotAngle_Left, SnapshotAngle_Top, diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp index 71bc61d0e..ee0b05c21 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp @@ -26,7 +26,7 @@ #include "nel_export_scene.h" - + using namespace NL3D; using namespace NLMISC; @@ -42,15 +42,15 @@ CExportNelOptions theExportSceneStruct; CNelExportClassDesc CNelExportDesc; ClassDesc2* GetCNelExportDesc() {return &CNelExportDesc;} -static const char *zoneFilter="NeL zone file (*.zone)\0*.zone\0All files (*.*)\0*.*\0"; -static const char *meshFilter="NeL shape file (*.shape)\0*.shape\0All files (*.*)\0*.*\0"; -static const char *collisionFilter="NeL collision file (*.cmb)\0*.cmb\0All files (*.*)\0*.*\0"; -static const char *animModelFilter="NeL model animation file (*.anim)\0*.anim\0All files (*.*)\0*.*\0"; -static const char *SWTFilter="NeL Skeleton Weight Template file (*.swt)\0*.swt\0All files (*.*)\0*.*\0"; -static const char *InstanceGroupFilter="NeL Instance Group file (*.ig)\0*.ig\0All files (*.*)\0*.*\0"; -static const char *skeletonFilter="NeL Skeleton file (*.skel)\0*.skel\0All files (*.*)\0*.*\0"; -static const char *vegetableFilter="NeL Vegetable file (*.veget)\0*.veget\0All files (*.*)\0*.*\0"; -static const char *lodCharacterFilter="NeL LodCharacter file (*.clod)\0*.clod\0All files (*.*)\0*.*\0"; +static const TCHAR *zoneFilter = _T("NeL zone file (*.zone)\0*.zone\0All files (*.*)\0*.*\0"); +static const TCHAR *meshFilter = _T("NeL shape file (*.shape)\0*.shape\0All files (*.*)\0*.*\0"); +static const TCHAR *collisionFilter = _T("NeL collision file (*.cmb)\0*.cmb\0All files (*.*)\0*.*\0"); +static const TCHAR *animModelFilter = _T("NeL model animation file (*.anim)\0*.anim\0All files (*.*)\0*.*\0"); +static const TCHAR *SWTFilter = _T("NeL Skeleton Weight Template file (*.swt)\0*.swt\0All files (*.*)\0*.*\0"); +static const TCHAR *InstanceGroupFilter = _T("NeL Instance Group file (*.ig)\0*.ig\0All files (*.*)\0*.*\0"); +static const TCHAR *skeletonFilter = _T("NeL Skeleton file (*.skel)\0*.skel\0All files (*.*)\0*.*\0"); +static const TCHAR *vegetableFilter = _T("NeL Vegetable file (*.veget)\0*.veget\0All files (*.*)\0*.*\0"); +static const TCHAR *lodCharacterFilter = _T("NeL LodCharacter file (*.clod)\0*.clod\0All files (*.*)\0*.*\0"); void *CNelExportClassDesc::Create(BOOL loading) @@ -66,50 +66,61 @@ INT_PTR CALLBACK OptionsDialogCallback ( LPARAM lParam // second message parameter ) { - switch (uMsg) + switch (uMsg) { case WM_INITDIALOG: { - char tmp[1024]; CenterWindow( hwndDlg, theCNelExport._Ip->GetMAXHWnd() ); ShowWindow( hwndDlg, TRUE ); + // Initialize from theExportSceneStruct if( theExportSceneStruct.bExcludeNonSelected ) SendMessage( GetDlgItem(hwndDlg,IDC_EXCLUDE), BM_SETCHECK, BST_CHECKED, 0 ); else SendMessage( GetDlgItem(hwndDlg,IDC_EXCLUDE), BM_SETCHECK, BST_UNCHECKED, 0 ); + if( theExportSceneStruct.bExportLighting ) SendMessage( GetDlgItem(hwndDlg,IDC_CHECKEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 ); else SendMessage( GetDlgItem(hwndDlg,IDC_CHECKEXPORTLIGHTING), BM_SETCHECK, BST_UNCHECKED, 0 ); + if( theExportSceneStruct.OutputLightmapLog ) SendMessage( GetDlgItem(hwndDlg,IDC_CHECKOUTPUTLIGHTMAPLOG), BM_SETCHECK, BST_CHECKED, 0 ); else SendMessage( GetDlgItem(hwndDlg,IDC_CHECKOUTPUTLIGHTMAPLOG), BM_SETCHECK, BST_UNCHECKED, 0 ); + if( theExportSceneStruct.bShadow) SendMessage( GetDlgItem(hwndDlg,IDC_SHADOW), BM_SETCHECK, BST_CHECKED, 0 ); else SendMessage( GetDlgItem(hwndDlg,IDC_SHADOW), BM_SETCHECK, BST_UNCHECKED, 0 ); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (long)theExportSceneStruct.sExportLighting.c_str() ); + + SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(theExportSceneStruct.sExportLighting)); + if( theExportSceneStruct.nExportLighting == 0 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 ); + if( theExportSceneStruct.nExportLighting == 1 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIORADIOSITYEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 ); - sprintf( tmp, "%f", theExportSceneStruct.rLumelSize ); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_SETTEXT, 0, (long)tmp ); + + SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.rLumelSize))); + if( theExportSceneStruct.nOverSampling == 1 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_SETCHECK, BST_CHECKED, 0 ); + if( theExportSceneStruct.nOverSampling == 2 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS2), BM_SETCHECK, BST_CHECKED, 0 ); + if( theExportSceneStruct.nOverSampling == 4 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS3), BM_SETCHECK, BST_CHECKED, 0 ); + if( theExportSceneStruct.nOverSampling == 8 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS4), BM_SETCHECK, BST_CHECKED, 0 ); + if( theExportSceneStruct.bShowLumel ) SendMessage( GetDlgItem(hwndDlg,IDC_SHOWLUMEL), BM_SETCHECK, BST_CHECKED, 0 ); else SendMessage( GetDlgItem(hwndDlg,IDC_SHOWLUMEL), BM_SETCHECK, BST_UNCHECKED, 0 ); - + if( theExportSceneStruct.bExportBgColor ) SendMessage( GetDlgItem(hwndDlg,IDC_EXPORT_BG_COLOR), BM_SETCHECK, BST_CHECKED, 0 ); else @@ -120,26 +131,24 @@ INT_PTR CALLBACK OptionsDialogCallback ( SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_SETCHECK, BST_CHECKED, 0 ); else SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_SETCHECK, BST_UNCHECKED, 0 ); - sprintf( tmp, "%f", theExportSceneStruct.SurfaceLightingCellSize ); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_SETTEXT, 0, (long)tmp ); - sprintf( tmp, "%f", theExportSceneStruct.SurfaceLightingDeltaZ ); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_SETTEXT, 0, (long)tmp ); + + SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.SurfaceLightingCellSize))); + SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.SurfaceLightingDeltaZ))); } break; case WM_COMMAND: if( HIWORD(wParam) == BN_CLICKED ) - switch (LOWORD(wParam)) + switch (LOWORD(wParam)) { case IDC_BUTTONEXPORTLIGHTING: { - char sTemp[1024]; - strcpy(sTemp,theExportSceneStruct.sExportLighting.c_str()); - if( theCNelExport.SelectDir(hwndDlg, "LightMaps Directory", sTemp ) ) + std::string sTemp = theExportSceneStruct.sExportLighting; + if( theCNelExport.SelectDir(hwndDlg, _T("LightMaps Directory"), sTemp ) ) { theExportSceneStruct.sExportLighting = sTemp; - SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (long)theExportSceneStruct.sExportLighting.c_str() ); + SendMessage( GetDlgItem(hwndDlg, IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(theExportSceneStruct.sExportLighting) ); } } break; @@ -148,53 +157,67 @@ INT_PTR CALLBACK OptionsDialogCallback ( break; case IDOK: { - char tmp[1024]; // The result goes in theExportSceneStruct if( SendMessage( GetDlgItem(hwndDlg,IDC_EXCLUDE), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.bExcludeNonSelected = true; else theExportSceneStruct.bExcludeNonSelected = false; + if( SendMessage( GetDlgItem(hwndDlg,IDC_SHADOW), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.bShadow = true; else theExportSceneStruct.bShadow = false; + if( SendMessage( GetDlgItem(hwndDlg,IDC_CHECKEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.bExportLighting = true; else theExportSceneStruct.bExportLighting = false; + if( SendMessage( GetDlgItem(hwndDlg,IDC_CHECKOUTPUTLIGHTMAPLOG), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.OutputLightmapLog = true; else theExportSceneStruct.OutputLightmapLog = false; - SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_GETTEXT, 1024, (long)tmp ); - theExportSceneStruct.sExportLighting = tmp; + + TCHAR tmp[1024]; + SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_GETTEXT, 1024, (LPARAM)tmp ); + theExportSceneStruct.sExportLighting = tStrToUtf8(tmp); + if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nExportLighting = 0; + if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIORADIOSITYEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nExportLighting = 1; - SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_GETTEXT, 1024, (long)tmp ); - NLMISC::fromString(tmp, theExportSceneStruct.rLumelSize); + + SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_GETTEXT, 1024, (LPARAM)tmp ); + NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.rLumelSize); if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nOverSampling = 1; + if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS2), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nOverSampling = 2; + if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS3), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nOverSampling = 4; + if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS4), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nOverSampling = 8; + if( SendMessage( GetDlgItem(hwndDlg,IDC_SHOWLUMEL), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.bShowLumel = true; else theExportSceneStruct.bShowLumel = false; + theExportSceneStruct.bExportBgColor = ( SendMessage( GetDlgItem(hwndDlg,IDC_EXPORT_BG_COLOR), BM_GETCHECK, 0, 0 ) == BST_CHECKED ); // SurfaceLighting theExportSceneStruct.bTestSurfaceLighting= (SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_GETCHECK, 0, 0 ) == BST_CHECKED); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_GETTEXT, 1024, (long)tmp ); - NLMISC::fromString(tmp, theExportSceneStruct.SurfaceLightingCellSize); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_GETTEXT, 1024, (long)tmp ); - NLMISC::fromString(tmp, theExportSceneStruct.SurfaceLightingDeltaZ); + + SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_GETTEXT, 1024, (LPARAM)tmp ); + NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingCellSize); + + SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_GETTEXT, 1024, (LPARAM)tmp ); + NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingDeltaZ); // End the dialog EndDialog(hwndDlg, TRUE); @@ -207,9 +230,9 @@ INT_PTR CALLBACK OptionsDialogCallback ( EndDialog(hwndDlg,1); break; - case WM_DESTROY: + case WM_DESTROY: break; - + default: return FALSE; } @@ -223,7 +246,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP setlocale (LC_NUMERIC, "English"); BOOL ret = TRUE; - switch (msg) + switch (msg) { case WM_INITDIALOG: { @@ -234,7 +257,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (hModule) { // Get module file name - char moduldeFileName[512]; + TCHAR moduldeFileName[512]; if (GetModuleFileName (hModule, moduldeFileName, 512)) { // Get version info size @@ -250,41 +273,41 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP { uint *versionTab; uint versionSize; - if (VerQueryValue (buffer, "\\", (void**)&versionTab, &versionSize)) + if (VerQueryValue (buffer, _T("\\"), (void**)&versionTab, &versionSize)) { // Get the pointer on the structure VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab; if (info) { // Setup version number - char version[512]; - sprintf (version, "Version %d.%d.%d.%d", - info->dwFileVersionMS>>16, - info->dwFileVersionMS&0xffff, - info->dwFileVersionLS>>16, + TCHAR version[512]; + _stprintf(version, _T("Version %d.%d.%d.%d"), + info->dwFileVersionMS>>16, + info->dwFileVersionMS&0xffff, + info->dwFileVersionLS>>16, info->dwFileVersionLS&0xffff); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), version); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "VS_FIXEDFILEINFO * is NULL"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("VS_FIXEDFILEINFO * is NULL")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "VerQueryValue failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("VerQueryValue failed")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetFileVersionInfo failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfo failed")); // Free the buffer delete [] buffer; } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetFileVersionInfoSize failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfoSize failed")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetModuleFileName failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetModuleFileName failed")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "hInstance NULL"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("hInstance NULL")); } break; @@ -307,7 +330,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Get time TimeValue time=theCNelExport._Ip->GetTime(); - + // Get node count int nNumSelNode=theCNelExport._Ip->GetSelNodeCount(); @@ -324,15 +347,14 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP nlwarning("pNode->GetName()"); // Name of the node - char sNodeMsg[256]; - nlwarning (sNodeMsg, "Save %s model...", tStrToUtf8(pNode->GetName()).c_str()); + TCHAR sNodeMsg[256]; + _stprintf(sNodeMsg, _T("Save %s model..."), pNode->GetName()); // It is a zone ? if (RPO::isZone (*pNode, time)) { // Save path - char sSavePath[256]; - strcpy (sSavePath, tStrToUtf8(pNode->GetName()).c_str()); + std::string sSavePath = tStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -342,7 +364,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportZone (sSavePath, *pNode, time)) { // Error message - std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath); + std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); MessageBox (hWnd, utf8ToTStr(sErrorMsg), L"NeL export", MB_OK|MB_ICONEXCLAMATION); } } @@ -354,15 +376,14 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) - if (theCNelExport.SelectFileForSave(hWnd, sNodeMsg, vegetableFilter, sSavePath.c_str())) + if (theCNelExport.SelectFileForSave(hWnd, sNodeMsg, vegetableFilter, sSavePath)) { // Export the mesh if (!theCNelExport.exportVegetable (sSavePath.c_str(), *pNode, time)) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting the vegetable %s in the file\n%s", pNode->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the vegetable %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -370,8 +391,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP else if (CExportNel::isLodCharacter (*pNode, time)) { // Save path - char sSavePath[256]; - strcpy (sSavePath, pNode->GetName()); + std::string sSavePath = tStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -381,9 +401,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportLodCharacter (sSavePath, *pNode, time)) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting the lod character %s in the file\n%s", pNode->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the lod character %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -391,8 +410,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP else if (CExportNel::isMesh (*pNode, time)) { // Save path - char sSavePath[256]; - strcpy (sSavePath, pNode->GetName()); + std::string sSavePath = tStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -406,9 +424,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportMesh (sSavePath, *pNode, time)) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting the mesh %s in the file\n%s", pNode->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the mesh %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } // Delete the skeleton pointer if (pSkinShape) @@ -431,7 +448,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Get time TimeValue time=theCNelExport._Ip->GetTime(); - + // Get node count uint nNumSelNode=theCNelExport._Ip->GetSelNodeCount(); @@ -444,24 +461,20 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP nlassert (vectNode.size()!=0); // Name of the node - char sNodeMsg[256]; - sprintf (sNodeMsg, "Save animations..."); // Save path - char sSavePath[256]; - strcpy (sSavePath, (*vectNode.begin())->GetName()); + std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); // Choose a file to export - if (theCNelExport.SelectFileForSave (hWnd, sNodeMsg, (LOWORD(wParam)==ID_SAVE_MODEL_ANIM)?animModelFilter:animModelFilter, + if (theCNelExport.SelectFileForSave (hWnd, _T("Save animations..."), (LOWORD(wParam)==ID_SAVE_MODEL_ANIM)?animModelFilter:animModelFilter, sSavePath)) { // Export the zone if (!theCNelExport.exportAnim (sSavePath, vectNode, time, LOWORD(wParam)==ID_SAVE_SCENE_ANIM)) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting animation %s in the file\n%s", (*vectNode.begin())->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting animation %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); + MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -470,7 +483,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // --- case ID_SAVECOLLISION: { - + // Init the exporter nlassert (theIP); @@ -478,7 +491,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Get time TimeValue time=theCNelExport._Ip->GetTime(); - + // Get node count int nNumSelNode=theCNelExport._Ip->GetSelNodeCount(); @@ -503,23 +516,20 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP } // Name of the node - char sNodeMsg[256]; - sprintf (sNodeMsg, "Save collision mesh build..."); // Save path - char sSavePath[256]; - strcpy (sSavePath, ""); + std::string sSavePath; // Choose a file to export // ULONG SelectDir(HWND Parent, char* Title, char* Path); // if (theCNelExport.SelectFileForSave(hWnd, sNodeMsg, collisionFilter, sSavePath)) - if (theCNelExport.SelectDir(hWnd, sNodeMsg, sSavePath)) + if (theCNelExport.SelectDir(hWnd, _T("Save collision mesh build..."), sSavePath)) { // Export the mesh if (!theCNelExport.exportCollision (sSavePath, nodes, time)) { // Error message - MessageBox (hWnd, "Error during export collision", "NeL export", MB_OK|MB_ICONEXCLAMATION); + MessageBox (hWnd, _T("Error during export collision"), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } @@ -545,32 +555,27 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Init the exporter nlassert (theIP); theCNelExport.init (false, true, theIP, true); - + uint nNumSelNode = theCNelExport._Ip->GetSelNodeCount(); // Save all selected objects if (nNumSelNode) - { + { std::vector vectNode; theCNelExport.getSelectedNode (vectNode); nlassert (vectNode.size()!=0); - char sDialogMsg[256]; - sprintf (sDialogMsg, "Save SWT..."); - // Save path - char sSavePath[256]; - strcpy (sSavePath, (*vectNode.begin())->GetName()); + std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); - if (theCNelExport.SelectFileForSave (hWnd, sDialogMsg, SWTFilter, sSavePath)) + if (theCNelExport.SelectFileForSave (hWnd, _T("Save SWT..."), SWTFilter, sSavePath)) { // Export the swt if (!theCNelExport.exportSWT (sSavePath, vectNode)) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting SWT %s in the file\n%s", (*vectNode.begin())->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting SWT %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); + MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -582,10 +587,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Init the exporter nlassert (theIP); theCNelExport.init (false, true, theIP, true); - - char sConfigFileName[512]; - strcpy( sConfigFileName, theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR) ); - strcat( sConfigFileName, "\\NelExportScene.cfg" ); + + std::string sConfigFileName = tStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; // Do a modal dialog box to choose the scene export options if( DialogBox( hInstance, @@ -598,7 +601,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP COFile outputFile; if( outputFile.open(sConfigFileName) ) theExportSceneStruct.serial( outputFile ); - } + } // EXPORT THE SCENE // theCNelExport.exportScene( vectNode ); } @@ -610,7 +613,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Init the exporter nlassert (theIP); theCNelExport.init (false, true, theIP, true); - + // Build a seleted set std::set listNode; @@ -633,29 +636,27 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Init the exporter nlassert (theIP); theCNelExport.init (false, true, theIP, true); - + uint nNumSelNode = theCNelExport._Ip->GetSelNodeCount(); // done in dllentry registerSerial3d(); - // All the selected nodes are considered as a scene + // All the selected nodes are considered as a scene if( nNumSelNode > 0 ) - { + { std::vector vectNode; theCNelExport.getSelectedNode (vectNode); nlassert (vectNode.size()!=0); - char sSavePath[256]; - strcpy (sSavePath, (*vectNode.begin())->GetName()); + std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); - if (theCNelExport.SelectFileForSave (hWnd, "Save Instance group", InstanceGroupFilter, sSavePath)) + if (theCNelExport.SelectFileForSave (hWnd, _T("Save Instance group"), InstanceGroupFilter, sSavePath)) { // Export the instance group if (!theCNelExport.exportInstanceGroup( sSavePath, vectNode)) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting instance group %s", sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting instance group %s", sSavePath.c_str()); + MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -667,12 +668,12 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Init the exporter nlassert (theIP); theCNelExport.init (false, true, theIP, true); - + uint nNumSelNode = theCNelExport._Ip->GetSelNodeCount(); if (nNumSelNode!=1) { // Select only the root of the skeleton - MessageBox (hWnd, "Select the root node of the skeleton.", "NeL export", MB_OK|MB_ICONEXCLAMATION); + MessageBox (hWnd, _T("Select the root node of the skeleton."), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } else { @@ -680,31 +681,29 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP INode* pNode=theCNelExport._Ip->GetSelNode (0); // Save path - char sSavePath[256]; - strcpy (sSavePath, "*.skel"); + std::string sSavePath = "*.skel"; // Select the file - if (theCNelExport.SelectFileForSave (hWnd, "Save skeleton...", skeletonFilter, sSavePath)) + if (theCNelExport.SelectFileForSave (hWnd, _T("Save skeleton..."), skeletonFilter, sSavePath)) { // Export the zone if (!theCNelExport.exportSkeleton (sSavePath, pNode, theCNelExport._Ip->GetTime())) { // Error message - char sErrorMsg[512]; - sprintf (sErrorMsg, "Error exporting skeleton %s in the file\n%s", pNode->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting skeleton %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } } break; - case ID_TEST_INTERFACE_MESH: - { - nlassert (theIP); + case ID_TEST_INTERFACE_MESH: + { + nlassert (theIP); theCNelExport.init (false, true, theIP, true); // Get time TimeValue time = theCNelExport._Ip->GetTime(); - + // Get node count uint nNumSelNode=theCNelExport._Ip->GetSelNodeCount(); @@ -716,39 +715,39 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP theCNelExport.getSelectedNode (vectNode); if (vectNode.size() == 0) { - ::MessageBox(hWnd, "No nodes selected", "Error", MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(hWnd, _T("No nodes selected"), _T("Error"), MB_OK|MB_ICONEXCLAMATION); return ret; } - // create a mem displayer, that will receive errors + // create a mem displayer, that will receive errors try - { + { // test all nodes for(std::vector::iterator it = vectNode.begin(); it != vectNode.end(); ++it) { nlassert(theCNelExport._ExportNel); if (!theCNelExport._ExportNel->selectInterfaceVertices(**it, time)) { - ::MessageBox(NULL, "Unable to bind interface of mesh %s", (*it)->GetName(), MB_OK | MB_ICONEXCLAMATION); + ::MessageBox(NULL, _T("Unable to bind interface of mesh %s"), (*it)->GetName(), MB_OK | MB_ICONEXCLAMATION); break; - } - } + } + } theIP->RedrawViews(time); } catch(const std::exception &e) - { - ::MessageBox(hWnd, e.what(), "Error", MB_OK | MB_ICONEXCLAMATION); - } + { + ::MessageBox(hWnd, utf8ToTStr(e.what()), _T("Error"), MB_OK | MB_ICONEXCLAMATION); + } } } - break; + break; } - + break; case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: - theCNelExport._Ip->RollupMouseMessage(hWnd,msg,wParam,lParam); + theCNelExport._Ip->RollupMouseMessage(hWnd,msg,wParam,lParam); break; default: @@ -766,7 +765,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP //--- CNelExport ------------------------------------------------------- CNelExport::CNelExport() : _ErrorInDialog(true), _TerminateOnFileOpenIssues(false) { - _Ip = NULL; + _Ip = NULL; theHPanel = NULL; } @@ -775,7 +774,7 @@ CNelExport::~CNelExport() } -void CNelExport::BeginEditParams(Interface *_Ip,IUtil *iu) +void CNelExport::BeginEditParams(Interface *_Ip,IUtil *iu) { theIP = _Ip; if (_ExportNel) @@ -787,8 +786,8 @@ void CNelExport::BeginEditParams(Interface *_Ip,IUtil *iu) theHBar = GetDlgItem(theHPanel,ID_BAR); SendMessage(theHBar,PBM_SETPOS,0,0); } - -void CNelExport::EndEditParams(Interface *_Ip,IUtil *iu) + +void CNelExport::EndEditParams(Interface *_Ip,IUtil *iu) { this->_Ip = NULL; if (_ExportNel) @@ -826,14 +825,14 @@ void CNelExport::getSelectedNode (std::vector& vectNode) void CNelExport::initOptions() { // Initialization of theExportSceneStruct - char sConfigFileName[512]; - strcpy( sConfigFileName, theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR) ); - strcat( sConfigFileName, "\\NelExportScene.cfg" ); + std::string sConfigFileName = tStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; + // MessageBox (hWnd, sConfigFileName, "sConfigFileName", MB_OK|MB_ICONEXCLAMATION); - if( theCNelExport.FileExists(sConfigFileName) ) + if( CFile::fileExists(sConfigFileName) ) { // Serial the configuration - try { + try + { CIFile inputFile; if( inputFile.open(sConfigFileName) ) { @@ -843,8 +842,7 @@ void CNelExport::initOptions() } catch(...) { - MessageBox( theCNelExport._Ip->GetMAXHWnd(), "NelExportScene.cfg corrupted or old version", - "Error", MB_OK|MB_ICONEXCLAMATION ); + MessageBox( theCNelExport._Ip->GetMAXHWnd(), _T("NelExportScene.cfg corrupted or old version"), _T("Error"), MB_OK|MB_ICONEXCLAMATION ); } } } @@ -859,7 +857,7 @@ void CNelExport::init (bool view, bool errorInDialog, Interface *ip, bool loadSt // Create a new nelexport _Ip = ip; - + // Load the options if (loadStruct) theCNelExport.initOptions(); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.h b/code/nel/tools/3d/plugin_max/nel_export/nel_export.h index f6f0b145a..eabc05a09 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.h +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.h @@ -59,21 +59,21 @@ public: bool freeExported(void); void getSelectedNode (std::vector& vectNode); - bool exportZone (const char *sName, INode& node, TimeValue time); - bool exportMesh (const char *sPath, INode& node, TimeValue time); - bool exportAnim (const char *sPath, std::vector& vectNode, TimeValue time, bool scene); - bool exportSWT (const char *sPath, std::vector& vectNode); + bool exportZone (const std::string &sName, INode& node, TimeValue time); + bool exportMesh (const std::string &sPath, INode& node, TimeValue time); + bool exportAnim (const std::string &sPath, std::vector& vectNode, TimeValue time, bool scene); + bool exportSWT (const std::string &sPath, std::vector& vectNode); bool exportInstanceGroup (std::string filename, std::vector& vectNode); - bool exportSkeleton (const char *sPath, INode* pNode, TimeValue time); + bool exportSkeleton (const std::string &sPath, INode* pNode, TimeValue time); - bool exportCollision (const char *sPath, std::vector &nodes, TimeValue time); + bool exportCollision (const std::string &sPath, std::vector &nodes, TimeValue time); - bool exportPACSPrimitives (const char *sPath, std::vector &nodes, TimeValue time); + bool exportPACSPrimitives (const std::string &sPath, std::vector &nodes, TimeValue time); - bool exportVegetable (const char *sPath, INode& node, TimeValue time); + bool exportVegetable (const std::string &sPath, INode& node, TimeValue time); - bool exportLodCharacter (const char *sPath, INode& node, TimeValue time); + bool exportLodCharacter (const std::string &sPath, INode& node, TimeValue time); void viewMesh (TimeValue time); @@ -81,16 +81,8 @@ public: static void deleteLM(INode& ZeNode); // the export scene struct MUST be initialized before calling this fn void OnNodeProperties (const std::set &listNode); - ULONG ExtractFileName(char* Path, char* Name); - ULONG ExtractPath(char* FullPath, char* Path); - ULONG SelectFileForLoad(HWND Parent, char* Title, const char* Mask, char* FileName); - ULONG SelectFileForSave(HWND Parent, char* Title, const char* Mask, char* FileName); - ULONG SelectDir(HWND Parent, char* Title, char* Path); - static ULONG FileExists(const char* FileName); - ULONG GetFileSize(char* FileName); - ULONG ProcessDir(char* Dir, const char* Mask, unsigned long flag, ULONG Fnct(char* FileName) ); - ULONG CleanFileName(char* FileName); - ULONG CreateBAKFile(char* FileName); + ULONG SelectFileForSave(HWND Parent, TCHAR* Title, const TCHAR* Mask, std::string &FileName); + ULONG SelectDir(HWND Parent, TCHAR* Title, std::string &Path); // The nel export objtect CExportNel *_ExportNel; @@ -113,11 +105,11 @@ class CNelExportClassDesc:public ClassDesc2 public: int IsPublic() {return 1;} void * Create(BOOL loading = FALSE); - const TCHAR * ClassName() {return _T("NeL Export");} + const MCHAR * ClassName() {return _M("NeL Export");} SClass_ID SuperClassID() {return UTILITY_CLASS_ID;} Class_ID ClassID() {return CNELEXPORT_CLASS_ID;} - const TCHAR* Category() {return _T("NeL Tools");} - const TCHAR* InternalName() { return _T("NeL export and view"); } // returns fixed parsable name (scripter-visible name) + const MCHAR* Category() {return _M("NeL Tools");} + const MCHAR* InternalName() { return _M("NeL export and view"); } // returns fixed parsable name (scripter-visible name) HINSTANCE HInstance() { return hInstance; } // returns owning module handle }; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp index 8ff853031..dd48e4487 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp @@ -30,7 +30,7 @@ using namespace NLPACS; // -------------------------------------------------- -bool CNelExport::exportCollision (const char *sPath, std::vector &nodes, TimeValue time) +bool CNelExport::exportCollision (const std::string &sPath, std::vector &nodes, TimeValue time) { // get list of CMB froms nodes. std::vector > meshBuildList; @@ -148,7 +148,7 @@ bool CNelExport::exportCollision (const char *sPath, INode& node, Interface& _Ip */ // -------------------------------------------------- -bool CNelExport::exportPACSPrimitives (const char *sPath, std::vector &nodes, TimeValue time) +bool CNelExport::exportPACSPrimitives (const std::string &sPath, std::vector &nodes, TimeValue time) { // Build the primitive block NLPACS::CPrimitiveBlock primitiveBlock; @@ -172,12 +172,12 @@ bool CNelExport::exportPACSPrimitives (const char *sPath, std::vector & } else { - nlwarning ("Can't init XML stream with file %s", sPath); + nlwarning ("Can't init XML stream with file %s", sPath.c_str()); } } else { - nlwarning ("Can't open the file %s for writing", sPath); + nlwarning ("Can't open the file %s for writing", sPath.c_str()); } } return false; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp index 4beaeb108..a41c3134c 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp @@ -32,21 +32,17 @@ using namespace NLMISC; // -------------------------------------------------- -bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) +bool CNelExport::exportMesh (const std::string &sPath, INode& node, TimeValue time) { // Result to return bool bRet = false; - TCHAR tempFileName[MAX_PATH] = { 0 }; - TCHAR tempPathBuffer[MAX_PATH] = { 0 }; + std::string tempFileName; + std::string tempPathBuffer; try { - DWORD dwRetVal = GetTempPath(MAX_PATH, tempPathBuffer); - if (dwRetVal > MAX_PATH || (dwRetVal == 0)) - nlerror("GetTempPath failed"); - UINT uRetVal = GetTempFileName(tempPathBuffer, _T("_nel_export_mesh_"), 0, tempFileName); - if (uRetVal == 0) - nlerror("GetTempFileName failed"); + tempPathBuffer = NLMISC::CPath::getTemporaryDirectory(); + NLMISC::CFile::getTemporaryOutputFilename(tempPathBuffer + "_nel_export_mesh_", tempFileName); // Eval the object a time ObjectState os = node.EvalWorldState(time); @@ -99,7 +95,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) { // Open a file COFile file; - if (file.open(tStrToUtf8(tempFileName))) + if (file.open(tempFileName)) { try { @@ -126,12 +122,13 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) { } - remove(tempFileName); + + CFile::deleteFile(tempFileName); } } else { - nlwarning("Failed to create file %s", tempFileName); + nlwarning("Failed to create file %s", tempFileName.c_str()); if (_TerminateOnFileOpenIssues) nelExportTerminateProcess(); } @@ -148,7 +145,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) catch (...) { nlwarning("Failed to delete pShape pointer! Something might be wrong."); - remove(tempFileName); + CFile::deleteFile(tempFileName); bRet = false; } @@ -173,7 +170,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) } else { - nlwarning("Failed to open file: %s", tempFileName); + nlwarning("Failed to open file: %s", tempFileName.c_str()); if (_TerminateOnFileOpenIssues) nelExportTerminateProcess(); } @@ -181,7 +178,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) catch (...) { nlwarning("Failed to verify shape. Must crash now."); - remove(tempFileName); + CFile::deleteFile(tempFileName); bRet = false; } @@ -196,16 +193,9 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) if (bRet) { - try - { - remove(sPath); - } - catch (...) - { - - } + CFile::deleteFile(sPath); CFile::moveFile(sPath, tempFileName); - nlinfo("MOVE %s -> %s", tempFileName, sPath); + nlinfo("MOVE %s -> %s", tempFileName.c_str(), sPath.c_str()); } return bRet; @@ -213,7 +203,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) // -------------------------------------------------- -bool CNelExport::exportVegetable (const char *sPath, INode& node, TimeValue time) +bool CNelExport::exportVegetable (const std::string &sPath, INode& node, TimeValue time) { bool bRet=false; @@ -246,21 +236,17 @@ bool CNelExport::exportVegetable (const char *sPath, INode& node, TimeValue time // -------------------------------------------------- -bool CNelExport::exportAnim (const char *sPath, std::vector& vectNode, TimeValue time, bool scene) +bool CNelExport::exportAnim (const std::string &sPath, std::vector& vectNode, TimeValue time, bool scene) { // Result to return bool bRet=false; - char tempFileName[MAX_PATH] = { 0 }; - char tempPathBuffer[MAX_PATH] = { 0 }; + std::string tempFileName; + std::string tempPathBuffer; try { - DWORD dwRetVal = GetTempPathA(MAX_PATH, tempPathBuffer); - if (dwRetVal > MAX_PATH || (dwRetVal == 0)) - nlerror("GetTempPath failed"); - UINT uRetVal = GetTempFileNameA(tempPathBuffer, TEXT("_nel_export_mesh_"), 0, tempFileName); - if (uRetVal == 0) - nlerror("GetTempFileName failed"); + tempPathBuffer = NLMISC::CPath::getTemporaryDirectory(); + NLMISC::CFile::getTemporaryOutputFilename(tempPathBuffer + "_nel_export_mesh_", tempFileName); // Create an animation file CAnimation animFile; @@ -269,7 +255,7 @@ bool CNelExport::exportAnim (const char *sPath, std::vector& vectNode, T for (uint n=0; n& vectNode, T } else { - nlwarning("Failed to open file: %s", tempFileName); + nlwarning("Failed to open file: %s", tempFileName.c_str()); bRet = false; if (_TerminateOnFileOpenIssues) nelExportTerminateProcess(); @@ -336,14 +322,14 @@ bool CNelExport::exportAnim (const char *sPath, std::vector& vectNode, T catch (...) { nlwarning("Failed to verify shape. Must crash now."); - remove(tempFileName); + CFile::deleteFile(tempFileName); bRet = false; } } catch (const Exception& e) { if (_ErrorInDialog) - MessageBox (NULL, e.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); else nlwarning ("ERROR : %s", e.what ()); } @@ -351,9 +337,9 @@ bool CNelExport::exportAnim (const char *sPath, std::vector& vectNode, T else { if (_ErrorInDialog) - MessageBox (NULL, "Can't open the file for writing.", "NeL export", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, _T("Can't open the file for writing."), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); else - nlwarning ("ERROR : Can't open the file (%s) for writing", tempFileName); + nlwarning ("ERROR : Can't open the file (%s) for writing", tempFileName.c_str()); if (_TerminateOnFileOpenIssues) nelExportTerminateProcess(); } @@ -367,23 +353,16 @@ bool CNelExport::exportAnim (const char *sPath, std::vector& vectNode, T if (bRet) { - try - { - remove(sPath); - } - catch (...) - { - - } + CFile::deleteFile(sPath); CFile::moveFile(sPath, tempFileName); - nlinfo("MOVE %s -> %s", tempFileName, sPath); + nlinfo("MOVE %s -> %s", tempFileName.c_str(), sPath.c_str()); } return bRet; } // -------------------------------------------------- -bool CNelExport::exportSkeleton (const char *sPath, INode* pNode, TimeValue time) +bool CNelExport::exportSkeleton (const std::string &sPath, INode* pNode, TimeValue time) { // Result to return bool bRet=false; @@ -422,7 +401,7 @@ bool CNelExport::exportSkeleton (const char *sPath, INode* pNode, TimeValue time // -------------------------------------------------- -bool CNelExport::exportLodCharacter (const char *sPath, INode& node, TimeValue time) +bool CNelExport::exportLodCharacter (const std::string &sPath, INode& node, TimeValue time) { // Result to return bool bRet=false; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp index a6d68c4f5..59d149128 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp @@ -31,50 +31,50 @@ using namespace NLMISC; // Which dialog tab is the VerytexProgram one? #define TAB_VP_ID 5 -char *_EnvironmentNames[] = +TCHAR *_EnvironmentNames[] = { - "", - "no fx", - "GENERIC", - "PADDEDCELL", - "ROOM", - "BATHROOM", - "LIVINGROOM", - "STONEROOM", - "AUDITORIUM", - "CONCERTHALL", - "CAVE", - "ARENA", - "HANGAR", - "CARPETEDHALLWAY", - "HALLWAY", - "STONECORRIDOR", - "ALLEY", - "FOREST", - "CITY", - "MOUNTAINS", - "QUARRY", - "PLAIN", - "PARKINGLOT", - "SEWERPIPE", - "UNDERWATER", - "DRUGGED", - "DIZZY", - "PSYCHOTIC", + _T(""), + _T("no fx"), + _T("GENERIC"), + _T("PADDEDCELL"), + _T("ROOM"), + _T("BATHROOM"), + _T("LIVINGROOM"), + _T("STONEROOM"), + _T("AUDITORIUM"), + _T("CONCERTHALL"), + _T("CAVE"), + _T("ARENA"), + _T("HANGAR"), + _T("CARPETEDHALLWAY"), + _T("HALLWAY"), + _T("STONECORRIDOR"), + _T("ALLEY"), + _T("FOREST"), + _T("CITY"), + _T("MOUNTAINS"), + _T("QUARRY"), + _T("PLAIN"), + _T("PARKINGLOT"), + _T("SEWERPIPE"), + _T("UNDERWATER"), + _T("DRUGGED"), + _T("DIZZY"), + _T("PSYCHOTIC"), NULL }; -char *_MaterialNames[] = +TCHAR *_MaterialNames[] = { - "", - "no occlusion", - "SINGLEWINDOW", - "DOUBLEWINDOW", - "THINDOOR", - "THICKDOOR", - "WOODWALL", - "BRICKWALL", - "STONEWALL", - "CURTAIN", + _T(""), + _T("no occlusion"), + _T("SINGLEWINDOW"), + _T("DOUBLEWINDOW"), + _T("THINDOOR"), + _T("THICKDOOR"), + _T("WOODWALL"), + _T("BRICKWALL"), + _T("STONEWALL"), + _T("CURTAIN"), NULL }; @@ -90,13 +90,13 @@ class addSubLodNodeHitCallBack : public HitByNameDlgCallback public: INodeTab NodeTab; private: - virtual TCHAR *dialogTitle() + virtual const MCHAR *dialogTitle() { - return "Select sub lod objects to add"; + return _M("Select sub lod objects to add"); } - virtual TCHAR *buttonText() + virtual const MCHAR *buttonText() { - return "Add"; + return _M("Add"); } virtual BOOL singleSelect() { @@ -319,7 +319,7 @@ INT_PTR CALLBACK VertexProgramDialogCallBack (HWND hwndDlg, UINT uMsg, WPARAM wP INT_PTR CALLBACK MiscDialogCallback (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK AnimationDialogCallback (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -const char *SubText[TAB_COUNT] = {"LOD & MRM", "Accelerator", "Instance", "Lighting", "LMC", "Vegetable", "VertexProgram", "Misc", "Animation"}; +const TCHAR *SubText[TAB_COUNT] = { _T("LOD & MRM"), _T("Accelerator"), _T("Instance"), _T("Lighting"), _T("LMC"), _T("Vegetable"), _T("VertexProgram"), _T("Misc"), _T("Animation")}; const int SubTab[TAB_COUNT] = {IDD_LOD, IDD_ACCEL, IDD_INSTANCE, IDD_LIGHTMAP, IDD_LIGHTMAP2, IDD_VEGETABLE, IDD_VERTEX_PROGRAM, IDD_MISC, IDD_ANIM}; DLGPROC SubProc[TAB_COUNT] = {MRMDialogCallback, AccelDialogCallback, InstanceDialogCallback, LightmapDialogCallback, Lightmap2DialogCallback, VegetableDialogCallback, VertexProgramDialogCallBack, MiscDialogCallback, AnimationDialogCallback}; @@ -508,37 +508,37 @@ INT_PTR CALLBACK AccelDialogCallback ( { for (uint i=0; _MaterialNames[i] != 0; ++i) { - SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_ADDSTRING, 0, (LONG)(_MaterialNames[i])); - SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_ADDSTRING, 0, (LONG)(_MaterialNames[i])); + SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_ADDSTRING, 0, (LPARAM)(_MaterialNames[i])); + SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_ADDSTRING, 0, (LPARAM)(_MaterialNames[i])); } } { for (uint i =0; _EnvironmentNames[i] != 0; ++i) { - SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_ADDSTRING, 0, (LONG)(_EnvironmentNames[i])); + SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_ADDSTRING, 0, (LPARAM)(_EnvironmentNames[i])); } } { std::set::iterator first(_KnownSoundGroups.begin()), last(_KnownSoundGroups.end()); for (; first != last; ++first) { - SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LONG)(first->c_str())); + SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LPARAM)(first->c_str())); } } // set the combo and edit box - if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LONG)(currentParam->OcclusionModel.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)(currentParam->OcclusionModel.c_str())) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LONG)(currentParam->OpenOcclusionModel.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)(currentParam->OpenOcclusionModel.c_str())) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LONG)(currentParam->EnvironmentFX.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LPARAM)(currentParam->EnvironmentFX.c_str())) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LONG)(currentParam->SoundGroup.c_str())) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LPARAM)(currentParam->SoundGroup.c_str())) == CB_ERR) { // nlassert(false); } @@ -581,16 +581,16 @@ INT_PTR CALLBACK AccelDialogCallback ( currentParam->AudibleFromFather=SendMessage (GetDlgItem (hwndDlg, IDC_AUDIBLE_FROM_FATHER), BM_GETCHECK, 0, 0); // get the strings params - char tmp[256]; - SendMessage (GetDlgItem(hwndDlg, IDC_OCC_MODEL), WM_GETTEXT, 256, (LONG)tmp); - currentParam->OcclusionModel = tmp; - SendMessage (GetDlgItem(hwndDlg, IDC_OPEN_OCC_MODEL), WM_GETTEXT, 256, (LONG)tmp); - currentParam->OpenOcclusionModel = tmp; - SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LONG)tmp); - currentParam->SoundGroup = tmp; - _KnownSoundGroups.insert(tmp); - SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LONG)tmp); - currentParam->EnvironmentFX = tmp; + TCHAR tmp[256]; + SendMessage (GetDlgItem(hwndDlg, IDC_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp); + currentParam->OcclusionModel = tStrToUtf8(tmp); + SendMessage (GetDlgItem(hwndDlg, IDC_OPEN_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp); + currentParam->OpenOcclusionModel = tStrToUtf8(tmp); + SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LPARAM)tmp); + currentParam->SoundGroup = tStrToUtf8(tmp); + _KnownSoundGroups.insert(currentParam->SoundGroup); + SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LPARAM)tmp); + currentParam->EnvironmentFX = tStrToUtf8(tmp); // Quit EndDialog(hwndDlg, IDOK); @@ -653,9 +653,9 @@ INT_PTR CALLBACK MRMDialogCallback ( currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); // Window text - std::string winName=(*(currentParam->ListNode->begin()))->GetName(); + std::string winName= tStrToUtf8((*(currentParam->ListNode->begin()))->GetName()); winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); - SetWindowText (hwndDlg, winName.c_str()); + SetWindowText (hwndDlg, utf8ToTStr(winName)); // Set default state SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_IN), BM_SETCHECK, currentParam->BlendIn, 0); @@ -669,8 +669,8 @@ INT_PTR CALLBACK MRMDialogCallback ( EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), currentParam->DistMax.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), currentParam->BlendLength.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), utf8ToTStr(currentParam->DistMax)); + SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), utf8ToTStr(currentParam->BlendLength)); SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_SETCHECK, currentParam->MRM, 0); CoarseStateChanged (hwndDlg); @@ -678,12 +678,12 @@ INT_PTR CALLBACK MRMDialogCallback ( if (currentParam->SkinReduction!=-1) CheckRadioButton (hwndDlg, IDC_SKIN_REDUCTION_MIN, IDC_SKIN_REDUCTION_BEST, IDC_SKIN_REDUCTION_MIN+currentParam->SkinReduction); - SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), currentParam->NbLod.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), currentParam->Divisor.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), currentParam->DistanceFinest.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), currentParam->DistanceMiddle.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), currentParam->DistanceCoarsest.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), currentParam->BoneLodDistance.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), utf8ToTStr(currentParam->NbLod)); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), utf8ToTStr(currentParam->Divisor)); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), utf8ToTStr(currentParam->DistanceFinest)); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), utf8ToTStr(currentParam->DistanceMiddle)); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), utf8ToTStr(currentParam->DistanceCoarsest)); + SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), utf8ToTStr(currentParam->BoneLodDistance)); // Iterate list HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); @@ -717,11 +717,11 @@ INT_PTR CALLBACK MRMDialogCallback ( currentParam->CoarseMesh=SendMessage (GetDlgItem (hwndDlg, IDC_COARSE_MESH), BM_GETCHECK, 0, 0); currentParam->DynamicMesh=SendMessage (GetDlgItem (hwndDlg, IDC_DYNAMIC_MESH), BM_GETCHECK, 0, 0); - char tmp[512]; + TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512); - currentParam->DistMax=tmp; + currentParam->DistMax = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), tmp, 512); - currentParam->BlendLength=tmp; + currentParam->BlendLength = tStrToUtf8(tmp); currentParam->MRM=SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_GETCHECK, 0, 0); @@ -734,17 +734,17 @@ INT_PTR CALLBACK MRMDialogCallback ( currentParam->SkinReduction=2; GetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), tmp, 512); - currentParam->NbLod=tmp; + currentParam->NbLod = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), tmp, 512); - currentParam->Divisor=tmp; + currentParam->Divisor = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), tmp, 512); - currentParam->DistanceFinest=tmp; + currentParam->DistanceFinest = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), tmp, 512); - currentParam->DistanceMiddle=tmp; + currentParam->DistanceMiddle = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), tmp, 512); - currentParam->DistanceCoarsest=tmp; + currentParam->DistanceCoarsest = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), tmp, 512); - currentParam->BoneLodDistance=tmp; + currentParam->BoneLodDistance = tStrToUtf8(tmp); // Iterate list HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); @@ -758,7 +758,7 @@ INT_PTR CALLBACK MRMDialogCallback ( SendMessage (hwndList, LB_GETTEXT, item, (LPARAM) tmp); // Push it back - currentParam->ListLodName.push_back (tmp); + currentParam->ListLodName.push_back (tStrToUtf8(tmp)); } // default LodCharacter @@ -875,7 +875,7 @@ INT_PTR CALLBACK MRMDialogCallback ( if (wID!=LB_ERR) { // Get the node name - char name[512]; + TCHAR name[512]; SendMessage (GetDlgItem (hwndDlg, IDC_LIST1), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name); // Find the node @@ -920,8 +920,8 @@ INT_PTR CALLBACK InstanceDialogCallback ( LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), currentParam->InstanceShape.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), currentParam->InstanceName.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), utf8ToTStr(currentParam->InstanceShape)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), utf8ToTStr(currentParam->InstanceName)); SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_SETCHECK, currentParam->DontAddToScene, 0); @@ -930,7 +930,7 @@ INT_PTR CALLBACK InstanceDialogCallback ( SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION), BM_SETCHECK, currentParam->Collision, 0); SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION_EXTERIOR), BM_SETCHECK, currentParam->CollisionExterior, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), currentParam->InstanceGroupName.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), utf8ToTStr(currentParam->InstanceGroupName)); bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4; CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0); @@ -950,16 +950,16 @@ INT_PTR CALLBACK InstanceDialogCallback ( break; case IDOK: { - char tmp[512]; + TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), tmp, 512); - currentParam->InstanceShape=tmp; + currentParam->InstanceShape = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512); - currentParam->InstanceName=tmp; + currentParam->InstanceName = tStrToUtf8(tmp); currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512); - currentParam->InstanceGroupName=tmp; + currentParam->InstanceGroupName = tStrToUtf8(tmp); currentParam->DontExport=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_EXPORT), BM_GETCHECK, 0, 0); @@ -1036,9 +1036,9 @@ INT_PTR CALLBACK LightmapDialogCallback ( LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), currentParam->LumelSizeMul.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), currentParam->SoftShadowRadius.c_str()); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), currentParam->SoftShadowConeLength.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), utf8ToTStr(currentParam->LumelSizeMul)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), utf8ToTStr(currentParam->SoftShadowRadius)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), utf8ToTStr(currentParam->SoftShadowConeLength)); // Lighting SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_SETCHECK, currentParam->ExportRealTimeLight, 0); @@ -1048,7 +1048,7 @@ INT_PTR CALLBACK LightmapDialogCallback ( SendMessage (GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), BM_SETCHECK, currentParam->UseLightingLocalAttenuation, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowInterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), currentParam->ExportLightMapName.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), utf8ToTStr(currentParam->ExportLightMapName)); SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0); // Set enable disable @@ -1065,7 +1065,7 @@ INT_PTR CALLBACK LightmapDialogCallback ( switch (LOWORD(wParam)) { case IDC_RESET_NAME: - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), "GlobalLight"); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), _T("GlobalLight")); break; case IDCANCEL: EndDialog(hwndDlg, IDCANCEL); @@ -1073,13 +1073,13 @@ INT_PTR CALLBACK LightmapDialogCallback ( case IDOK: { // Set default state - char tmp[512]; + TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), tmp, 512); - currentParam->LumelSizeMul = tmp; + currentParam->LumelSizeMul = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), tmp, 512); - currentParam->SoftShadowRadius = tmp; + currentParam->SoftShadowRadius = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), tmp, 512); - currentParam->SoftShadowConeLength = tmp; + currentParam->SoftShadowConeLength = tStrToUtf8(tmp); // RealTime light currentParam->ExportRealTimeLight = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0); @@ -1090,7 +1090,7 @@ INT_PTR CALLBACK LightmapDialogCallback ( currentParam->LightDontCastShadowExterior = SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_GETCHECK, 0, 0); currentParam->ExportLightMapAnimated = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_ANIMATED), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512); - currentParam->ExportLightMapName = tmp; + currentParam->ExportLightMapName = tStrToUtf8(tmp); currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0); // Get the acceleration type @@ -1132,7 +1132,7 @@ INT_PTR CALLBACK LightmapDialogCallback ( if (wID!=LB_ERR) { // Get the node name - char name[512]; + TCHAR name[512]; SendMessage (GetDlgItem (hwndDlg, IDC_LIST1), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name); // Find the node @@ -1432,7 +1432,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback( lmcParam->SelectionDone= true; // Get the node name - char name[512]; + TCHAR name[512]; SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_LIST), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name); // Find the node @@ -1497,7 +1497,7 @@ void lmcCopyFrom(CLodDialogBoxParam *currentParam, HWND parentDlg) // **** launch the choosing dialog paramLMCFrom.reset(); - if (DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_LMC_CHOOSE_FROM), parentDlg, LMCCopyFromDialogCallback, (long)¶mLMCFrom)==IDOK + if (DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_LMC_CHOOSE_FROM), parentDlg, LMCCopyFromDialogCallback, (LPARAM)¶mLMCFrom)==IDOK && paramLMCFrom.SelectionDone) { // **** Apply to the current setup @@ -1679,7 +1679,7 @@ INT_PTR CALLBACK VegetableDialogCallback ( CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter); - SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), currentParam->VegetableBendFactor.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), utf8ToTStr(currentParam->VegetableBendFactor)); VegetableStateChanged (hwndDlg); } @@ -1732,9 +1732,9 @@ INT_PTR CALLBACK VegetableDialogCallback ( else currentParam->VegetableBendCenter = -1; - char tmp[512]; + TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512); - currentParam->VegetableBendFactor = tmp; + currentParam->VegetableBendFactor = tStrToUtf8(tmp); } break; case IDC_VEGETABLE: @@ -1930,7 +1930,7 @@ static int VPWTBiasStaticId[CVPWindTreeAppData::HrcDepth]= void updateVPWTStatic(HWND hwndDlg, uint type, uint depth, const CVPWindTreeAppData &vpwt) { int sliderValue; - char stmp[256]; + TCHAR stmp[256]; float nticks= CVPWindTreeAppData::NumTicks; float scale; @@ -1953,29 +1953,29 @@ void updateVPWTStatic(HWND hwndDlg, uint type, uint depth, const CVPWindTreeAppD { case 0: sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqSliderId[depth], TBM_GETPOS, 0, 0); - _stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); + _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); SetWindowText( GetDlgItem(hwndDlg, VPWTFreqStaticId[depth]), stmp ); break; case 1: sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqWDSliderId[depth], TBM_GETPOS, 0, 0); - _stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); + _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); SetWindowText( GetDlgItem(hwndDlg, VPWTFreqWDStaticId[depth]), stmp ); break; case 2: sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistXYSliderId[depth], TBM_GETPOS, 0, 0); - _stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); + _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); SetWindowText( GetDlgItem(hwndDlg, VPWTDistXYStaticId[depth]), stmp ); break; case 3: sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistZSliderId[depth], TBM_GETPOS, 0, 0); - _stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); + _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks); SetWindowText( GetDlgItem(hwndDlg, VPWTDistZStaticId[depth]), stmp ); break; case 4: sliderValue= SendDlgItemMessage(hwndDlg, VPWTBiasSliderId[depth], TBM_GETPOS, 0, 0); // expand to -2 to 2. float biasVal= 4 * float(sliderValue)/nticks - 2; - _stprintf(stmp, "%.2f", biasVal); + _stprintf(stmp, _T("%.2f"), biasVal); SetWindowText( GetDlgItem(hwndDlg, VPWTBiasStaticId[depth]), stmp ); break; } @@ -1987,14 +1987,14 @@ static void concatEdit2Lines(HWND edit) const uint lineLen= 1000; uint n; // retrieve the 2 lines. - char tmp0[2*lineLen]; - char tmp1[lineLen]; + TCHAR tmp0[2*lineLen]; + TCHAR tmp1[lineLen]; *(WORD*)tmp0= lineLen; *(WORD*)tmp1= lineLen; - n= SendMessage(edit, EM_GETLINE, 0, (LONG)tmp0); tmp0[n]= 0; - n= SendMessage(edit, EM_GETLINE, 1, (LONG)tmp1); tmp1[n]= 0; + n= SendMessage(edit, EM_GETLINE, 0, (LPARAM)tmp0); tmp0[n]= 0; + n= SendMessage(edit, EM_GETLINE, 1, (LPARAM)tmp1); tmp1[n]= 0; // concat and update the CEdit. - SetWindowText(edit, strcat(tmp0, tmp1)); + SetWindowText(edit, _tcscat(tmp0, tmp1)); } @@ -2055,10 +2055,10 @@ INT_PTR CALLBACK VPWindTreeCallback ( // Init Global. editBox - char stmp[256]; - _stprintf(stmp, "%.2f", vpwt.FreqScale); + TCHAR stmp[256]; + _stprintf(stmp, _T("%.2f"), vpwt.FreqScale); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_FREQ_SCALE), stmp ); - _stprintf(stmp, "%.2f", vpwt.DistScale); + _stprintf(stmp, _T("%.2f"), vpwt.DistScale); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp ); SendDlgItemMessage(hwndDlg, IDC_CHECK_VP_SPECLIGHT, BM_SETCHECK, vpwt.SpecularLighting, 0); @@ -2102,7 +2102,7 @@ INT_PTR CALLBACK VPWindTreeCallback ( { CVPWindTreeAppData &vpwt= currentParam->VertexProgramWindTree; int nticks= CVPWindTreeAppData::NumTicks; - char stmp[256]; + TCHAR stmp[256]; float val; if( HIWORD(wParam) == BN_CLICKED ) @@ -2195,7 +2195,7 @@ INT_PTR CALLBACK VPWindTreeCallback ( } } // Update Scale Edit text. - _stprintf(stmp, "%.2f", vpwt.FreqScale); + _stprintf(stmp, _T("%.2f"), vpwt.FreqScale); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_FREQ_SCALE), stmp ); } break; @@ -2216,7 +2216,7 @@ INT_PTR CALLBACK VPWindTreeCallback ( } } // Update Scale Edit text. - _stprintf(stmp, "%.2f", vpwt.DistScale); + _stprintf(stmp, _T("%.2f"), vpwt.DistScale); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp ); } break; @@ -2290,34 +2290,34 @@ INT_PTR CALLBACK MiscDialogCallback ( // Ligoscape SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_SETCHECK, currentParam->LigoSymmetry, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), currentParam->LigoRotate.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), utf8ToTStr(currentParam->LigoRotate)); // SWT SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_SETCHECK, currentParam->SWT, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), currentParam->SWTWeight.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), utf8ToTStr(currentParam->SWTWeight)); // Radial normals for (uint smoothGroup=0; smoothGroupRadialNormals[smoothGroup].c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup), utf8ToTStr(currentParam->RadialNormals[smoothGroup])); // Mesh interfaces - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), currentParam->InterfaceFileName.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), utf8ToTStr(currentParam->InterfaceFileName)); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), - currentParam->InterfaceThreshold != -1.f ? toStringMax(currentParam->InterfaceThreshold).c_str() - : "" + currentParam->InterfaceThreshold != -1.f ? utf8ToTStr(toStringMax(currentParam->InterfaceThreshold)) + : _T("") ); SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0); // Skeleton Scale SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), currentParam->ExportBoneScaleNameExt.c_str()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), utf8ToTStr(currentParam->ExportBoneScaleNameExt)); // Remanence SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_SETCHECK, currentParam->UseRemanence, 0); SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_SETCHECK, currentParam->RemanenceShiftingTexture, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? toStringMax(currentParam->RemanenceSliceNumber).c_str() : ""); - SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? toStringMax(currentParam->RemanenceSamplingPeriod).c_str() : ""); - SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? toStringMax(currentParam->RemanenceRollupRatio).c_str() : ""); + SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSliceNumber)) : _T("")); + SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSamplingPeriod)) : _T("")); + SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceRollupRatio)) : _T("")); } break; @@ -2357,7 +2357,7 @@ INT_PTR CALLBACK MiscDialogCallback ( GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), tmp, 512); currentParam->InterfaceFileName = tStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512); - if (strlen(tmp) != 0) + if (_tcslen(tmp) != 0) currentParam->InterfaceThreshold = toFloatMax(tmp); currentParam->GetInterfaceNormalsFromSceneObjects = SendMessage (GetDlgItem (hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_GETCHECK, 0, 0); @@ -2492,9 +2492,9 @@ INT_PTR CALLBACK LodDialogCallback ( currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); // Window text - std::string winName=(*(currentParam->ListNode->begin()))->GetName(); + std::string winName = tStrToUtf8((*(currentParam->ListNode->begin()))->GetName()); winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); - SetWindowText (hwndDlg, winName.c_str()); + SetWindowText (hwndDlg, utf8ToTStr(winName)); // Move dialog RECT windowRect, desktopRect; @@ -2522,7 +2522,7 @@ INT_PTR CALLBACK LodDialogCallback ( // Insert a tab TCITEM tabItem; tabItem.mask = TCIF_TEXT; - tabItem.pszText = (char*)SubText[tab]; + tabItem.pszText = (LPTSTR)SubText[tab]; SendMessage (GetDlgItem (hwndDlg, IDC_TAB), TCM_INSERTITEM, SendMessage (GetDlgItem (hwndDlg, IDC_TAB), TCM_GETITEMCOUNT, 0, 0), (LPARAM)&tabItem); // Create the dialog @@ -3050,7 +3050,7 @@ void CNelExport::OnNodeProperties (const std::set &listNode) ite++; } - if (DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_NODE_PROPERTIES), _Ip->GetMAXHWnd(), LodDialogCallback, (long)¶m)==IDOK) + if (DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_NODE_PROPERTIES), _Ip->GetMAXHWnd(), LodDialogCallback, (LPARAM)¶m)==IDOK) { // Next node ite=listNode.begin(); diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp index af1047d0c..b50903324 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp @@ -59,7 +59,7 @@ bool CNelExport::exportInstanceGroup(string filename, vector& vectNode) catch (const Exception &c) { // Cannot save the file - MessageBox (NULL, c.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, utf8ToTStr(c.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); return false; } } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp index 71892b417..dfdbdec08 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp @@ -63,11 +63,11 @@ def_visible_primitive ( set_file_modification_date, "NeLSetFileModificationDate def_visible_primitive ( force_quit_on_msg_displayer, "NelForceQuitOnMsgDisplayer"); def_visible_primitive ( force_quit_right_now, "NelForceQuitRightNow"); -char *sExportShapeErrorMsg = "NeLExportShape [Object] [Filename.shape]"; -char *sExportShapeExErrorMsg = "NeLExportShapeEx [Object] [Filename.shape] [bShadow] [bExportLighting] [sLightmapPath] [nLightingLimit] [fLumelSize] [nOverSampling] [bExcludeNonSelected] [bShowLumel]"; -char *sExportAnimationErrorMsg = "NelExportAnimation [node array] [Filename.anim] [bool_scene_animation]"; -char *sExportCollisionErrorMsg = "NelExportCollision [node array] [output directory]"; -char *sExportPACSPrimitivesErrorMsg = "NelExportPACSPrimitves [node array] [output filename]"; +MCHAR *sExportShapeErrorMsg = _M("NeLExportShape [Object] [Filename.shape]"); +MCHAR *sExportShapeExErrorMsg = _M("NeLExportShapeEx [Object] [Filename.shape] [bShadow] [bExportLighting] [sLightmapPath] [nLightingLimit] [fLumelSize] [nOverSampling] [bExcludeNonSelected] [bShowLumel]"); +MCHAR *sExportAnimationErrorMsg = _M("NelExportAnimation [node array] [Filename.anim] [bool_scene_animation]"); +MCHAR *sExportCollisionErrorMsg = _M("NelExportCollision [node array] [output directory]"); +MCHAR *sExportPACSPrimitivesErrorMsg = _M("NelExportPACSPrimitves [node array] [output filename]"); extern CExportNelOptions theExportSceneStruct; @@ -91,7 +91,7 @@ Value* export_shape_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - const char* sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Ok ? Boolean *ret=&false_value; @@ -154,12 +154,12 @@ Value* export_shape_ex_cf (Value** arg_list, int count) nlassert(node->GetName()); // Export path - std::string sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Ex argu theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE; theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE; - theExportSceneStruct.sExportLighting = arg_list[4]->to_string(); + theExportSceneStruct.sExportLighting = tStrToUtf8(arg_list[4]->to_string()); theExportSceneStruct.nExportLighting = arg_list[5]->to_int(); theExportSceneStruct.rLumelSize = arg_list[6]->to_float(); theExportSceneStruct.nOverSampling = arg_list[7]->to_int(); @@ -207,8 +207,8 @@ Value* export_skeleton_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check (arg_list[0], MAXNode, "NelExportSkeleton [root node] [Filename]"); - type_check (arg_list[1], String, "NelExportSkeleton [root node] [Filename]"); + type_check (arg_list[0], MAXNode, _M("NelExportSkeleton [root node] [Filename]")); + type_check (arg_list[1], String, _M("NelExportSkeleton [root node] [Filename]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -220,7 +220,7 @@ Value* export_skeleton_cf (Value** arg_list, int count) nlassert (node); // Export path - const char* sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Ok ? Boolean *ret=&false_value; @@ -260,7 +260,7 @@ Value* export_animation_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - const char* sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Get time TimeValue time=MAXScript_interface->GetTime(); @@ -298,7 +298,7 @@ Value* export_animation_cf (Value** arg_list, int count) else { // Error message - mprintf ("Error exporting animation %s in the file\n%s\n", (*vectNode.begin())->GetName(), sPath); + mprintf (_M("Error exporting animation %s in the file\n%s\n"), (*vectNode.begin())->GetName(), utf8ToTStr(sPath)); } } } @@ -321,8 +321,8 @@ Value* export_ig_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check (arg_list[0], Array, "NelExportInstanceGroup [Object array] [Filename]"); - type_check (arg_list[1], String, "NelExportInstanceGroup [Object array] [Filename]"); + type_check (arg_list[0], Array, _M("NelExportInstanceGroup [Object array] [Filename]")); + type_check (arg_list[1], String, _M("NelExportInstanceGroup [Object array] [Filename]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -342,7 +342,7 @@ Value* export_ig_cf (Value** arg_list, int count) // Check each value in the array uint i; for (i=0; i<(uint)array->size; i++) - type_check (array->get (i+1), MAXNode, "NelExportInstanceGroup [Object array] [Filename]"); + type_check (array->get (i+1), MAXNode, _M("NelExportInstanceGroup [Object array] [Filename]")); // Create a STL array if (array->size) @@ -352,7 +352,7 @@ Value* export_ig_cf (Value** arg_list, int count) vect.push_back (array->get (i+1)->to_node()); // Export path - const char* sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Export if (theCNelExport.exportInstanceGroup (sPath, vect)) @@ -380,8 +380,8 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check (arg_list[0], Array, "NelExportSkeletonWeight [Object array] [Filename]"); - type_check (arg_list[1], String, "NelExportSkeletonWeight [Object array] [Filename]"); + type_check (arg_list[0], Array, _M("NelExportSkeletonWeight [Object array] [Filename]")); + type_check (arg_list[1], String, _M("NelExportSkeletonWeight [Object array] [Filename]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -401,7 +401,7 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count) // Check each value in the array uint i; for (i=0; i<(uint)array->size; i++) - type_check (array->get (i+1), MAXNode, "NelExportSkeletonWeight [Object array] [Filename]"); + type_check (array->get (i+1), MAXNode, _M("NelExportSkeletonWeight [Object array] [Filename]")); // Create a STL array if (array->size) @@ -411,7 +411,7 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count) vect.push_back (array->get (i+1)->to_node()); // Export path - const char* sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Export if (theCNelExport.exportSWT (sPath, vect)) @@ -462,8 +462,8 @@ Value* test_file_date_cf (Value** arg_list, int count) // Make sure we have the correct number of arguments (2) check_arg_count(view_shape, 2, count); - type_check (arg_list[0], String, "NeLTestFileDate [DestFilename] [SrcFilename]"); - type_check (arg_list[1], String, "NeLTestFileDate [DestFilename] [SrcFilename]"); + type_check (arg_list[0], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]")); + type_check (arg_list[1], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -471,11 +471,11 @@ Value* test_file_date_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // The 2 filenames - string file0 = arg_list[0]->to_string(); - string file1 = arg_list[1]->to_string(); + string file0 = tStrToUtf8(arg_list[0]->to_string()); + string file1 = tStrToUtf8(arg_list[1]->to_string()); // Open it - FILE *file=fopen (file0.c_str(), "r"); + FILE *file=nlfopen (file0.c_str(), "r"); if (file == NULL) return &true_value; @@ -486,10 +486,10 @@ Value* test_file_date_cf (Value** arg_list, int count) Value *ret = &undefined; // Create first file - HANDLE h0 = CreateFile (file0.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE h0 = CreateFile (utf8ToTStr(file0), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h0!=INVALID_HANDLE_VALUE) { - HANDLE h1 = CreateFile (file1.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE h1 = CreateFile (utf8ToTStr(file1), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h1!=INVALID_HANDLE_VALUE) { // Get file time @@ -526,7 +526,7 @@ Value* export_vegetable_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - char *message = "NelExportVegetable [node] [filename] [dialog error]"; + MCHAR *message = _M("NelExportVegetable [node] [filename] [dialog error]"); type_check (arg_list[0], MAXNode, message); type_check (arg_list[1], String, message); type_check (arg_list[2], Boolean, message); @@ -536,7 +536,7 @@ Value* export_vegetable_cf (Value** arg_list, int count) nlassert (node); // Export path - const char* sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Message in dialog bool dialogMessage = arg_list[2]->to_bool() != FALSE; @@ -615,7 +615,7 @@ Value* export_collision_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - string sPath = arg_list[1]->to_string(); + string sPath = tStrToUtf8(arg_list[1]->to_string()); // Get time TimeValue time = MAXScript_interface->GetTime(); @@ -674,7 +674,7 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - string sPath = arg_list[1]->to_string(); + string sPath = tStrToUtf8(arg_list[1]->to_string()); // Get time TimeValue time = MAXScript_interface->GetTime(); @@ -723,7 +723,7 @@ Value* export_lod_character_cf (Value** arg_list, int count) check_arg_count(export_lod_character, 3, count); // Check to see if the arguments match up to what we expect - char *message = "NelExportLodCharacter [node] [filename] [dialog error]"; + MCHAR *message = _M("NelExportLodCharacter [node] [filename] [dialog error]"); type_check (arg_list[0], MAXNode, message); type_check (arg_list[1], String, message); type_check (arg_list[2], Boolean, message); @@ -733,7 +733,7 @@ Value* export_lod_character_cf (Value** arg_list, int count) nlassert (node); // Export path - const char* sPath=arg_list[1]->to_string(); + std::string sPath = tStrToUtf8(arg_list[1]->to_string()); // Message in dialog bool dialogMessage = arg_list[2]->to_bool() != FALSE; @@ -771,7 +771,7 @@ Value* node_properties_cf (Value** arg_list, int count) check_arg_count(export_lod_character, 2, count); // Check to see if the arguments match up to what we expect - char *message = "NelNodeProperties [node_array] [dialog error]"; + MCHAR *message = _M("NelNodeProperties [node_array] [dialog error]"); //type_check (arg_list[0], MAXNode, message); type_check (arg_list[0], Array, message); @@ -787,7 +787,7 @@ Value* node_properties_cf (Value** arg_list, int count) uint i; for (i=0; i<(uint)array->size; i++) { - type_check (array->get (i+1), MAXNode, "NelNodeProperties [node_array] [dialog error]"); + type_check (array->get (i+1), MAXNode, _M("NelNodeProperties [node_array] [dialog error]")); // Add to the array of nodes nodes.insert (array->get (i+1)->to_node()); @@ -830,7 +830,7 @@ Value* mirror_physique_cf (Value** arg_list, int count) check_arg_count(NelMirrorPhysique , 3, count); // Check to see if the arguments match up to what we expect - char *message = "NelMirrorPhysique [node] [vert_list_in] [threshold]"; + MCHAR *message = _M("NelMirrorPhysique [node] [vert_list_in] [threshold]"); //type_check type_check (arg_list[0], MAXNode, message); @@ -873,17 +873,17 @@ Value* get_file_modification_date_cf (Value** arg_list, int count) check_arg_count(NeLGetFileModificationDate , 1, count); // Check to see if the arguments match up to what we expect - char *message = "date NeLGetFileModificationDate [filename] - If an error occurred, returns undefined."; + MCHAR *message = _M("date NeLGetFileModificationDate [filename] - If an error occurred, returns undefined."); //type_check type_check (arg_list[0], String, message); // get the node - string sPath = arg_list[0]->to_string(); + string sPath = tStrToUtf8(arg_list[0]->to_string()); // get vertices indices string result; - HANDLE file = CreateFile (sPath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file) { FILETIME lastWriteTime; @@ -899,7 +899,7 @@ Value* get_file_modification_date_cf (Value** arg_list, int count) if (result.empty()) return &undefined; else - return new String((char*)result.c_str()); + return new String(utf8ToTStr(result)); } // *************************************************************************** @@ -911,19 +911,19 @@ Value* set_file_modification_date_cf (Value** arg_list, int count) check_arg_count(NeLSetFileModificationDate , 2, count); // Check to see if the arguments match up to what we expect - char *message = "bool NeLSetFileModificationDate [filename] [date] - If an error occurred, returns false."; + MCHAR *message = _M("bool NeLSetFileModificationDate [filename] [date] - If an error occurred, returns false."); //type_check type_check (arg_list[0], String, message); type_check (arg_list[1], String, message); // get the node - string sPath = arg_list[0]->to_string(); - string sDate = arg_list[1]->to_string(); + string sPath = tStrToUtf8(arg_list[0]->to_string()); + string sDate = tStrToUtf8(arg_list[1]->to_string()); // get vertices indices string result; - HANDLE file = CreateFile (sPath.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file) { FILETIME lastWriteTime; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp index d1c47c00e..997b935a9 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp @@ -27,7 +27,7 @@ using namespace NL3D; using namespace NLMISC; -bool CNelExport::exportSWT(const char *sPath, std::vector& vectNode) +bool CNelExport::exportSWT(const std::string &sPath, std::vector& vectNode) { float rPosValue; float rRotValue; @@ -55,15 +55,15 @@ bool CNelExport::exportSWT(const char *sPath, std::vector& vectNode) // Store them in the temporary list aSWNodes.resize(nNumNode+3); - aSWNodes[nNumNode].Name = pNode->GetName(); + aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName(); aSWNodes[nNumNode].Weight = rRotValue; ++nNumNode; - aSWNodes[nNumNode].Name = pNode->GetName(); + aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName (); aSWNodes[nNumNode].Weight = rPosValue; ++nNumNode; - aSWNodes[nNumNode].Name = pNode->GetName(); + aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName(); aSWNodes[nNumNode].Weight = rScaleValue; ++nNumNode; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp index bff98becc..ba4fe5769 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp @@ -102,14 +102,14 @@ void regsiterOVPath () //#ifdef NL_DEBUG_FAST // HMODULE hModule = GetModuleHandle("object_viewer_dll_df.dll"); #if defined (NL_DEBUG) - HMODULE hModule = GetModuleHandle("object_viewer_dll_d.dll"); + HMODULE hModule = GetModuleHandle(_T("object_viewer_dll_d.dll")); //#elif defined (NL_RELEASE_DEBUG) // HMODULE hModule = GetModuleHandle("object_viewer_dll_rd.dll"); #else HMODULE hModule = GetModuleHandle("object_viewer_dll_r.dll"); #endif - if (!hModule) { ::MessageBox(NULL, "'hModule' failed at '" __FUNCTION__ "' in file '" __FILE__ " on line " NL_MACRO_TO_STR(__LINE__), "NeL Export", MB_OK | MB_ICONERROR); return; } - char sModulePath[256]; + if (!hModule) { ::MessageBox(NULL, _T("'hModule' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; } + TCHAR sModulePath[256]; int res = GetModuleFileName(hModule, sModulePath, 256); if (!res) { ::MessageBox(NULL, _T("'res' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; } @@ -174,7 +174,7 @@ void CNelExport::viewMesh (TimeValue time) // Check wether there's not an instance currently running if (view->isInstanceRunning()) { - ::MessageBox(NULL, "An instance of the viewer is currently running, please close it :)", "NeL Export", MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, _T("An instance of the viewer is currently running, please close it :)"), _T("NeL Export"), MB_OK|MB_ICONEXCLAMATION); return; } @@ -191,7 +191,7 @@ void CNelExport::viewMesh (TimeValue time) // Init it if (!view->initUI()) { - ::MessageBox(NULL, "Failed to initialize object viewer ui, this may be a driver init issue, check your log.log files", "NeL Export", MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, _T("Failed to initialize object viewer ui, this may be a driver init issue, check your log.log files"), _T("NeL Export"), MB_OK|MB_ICONEXCLAMATION); IObjectViewer::releaseInterface(view); return; } @@ -300,7 +300,7 @@ void CNelExport::viewMesh (TimeValue time) _ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time); // Add the shape in the view - uint instance = view->addSkel (skelShape, skeletonRoot->GetName()); + uint instance = view->addSkel (skelShape, tStrToUtf8(skeletonRoot->GetName())); // Add tracks CAnimation *anim=new CAnimation; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_zone.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_zone.cpp index e74e39dd0..334b56aff 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_zone.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_zone.cpp @@ -25,7 +25,7 @@ using namespace NLMISC; // -------------------------------------------------- -bool CNelExport::exportZone (const char *sPath, INode& node, TimeValue time) +bool CNelExport::exportZone (const std::string &sPath, INode& node, TimeValue time) { // Result to return bool bRet=false; diff --git a/code/nel/tools/3d/plugin_max/nel_export/progress.cpp b/code/nel/tools/3d/plugin_max/nel_export/progress.cpp index 3f6a2e824..8a8973154 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/progress.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/progress.cpp @@ -52,24 +52,24 @@ INT_PTR CALLBACK CalculatingDialogCallback ( case WM_PAINT: { - char temp[256]; + TCHAR temp[256]; SendMessage( GetDlgItem( hwndDlg, IDC_PROGRESS1 ), PBM_SETPOS, (int)(pClass->rRatioCalculated*100), 0 ); if( pClass->rRatioCalculated > 0.0 ) { double TimeLeft = (TimeCurrent - pClass->rTimeBegin) * (1.0-pClass->rRatioCalculated); - sprintf( temp, "Time remaining : %02d h %02d m %02d s", ((uint32)TimeLeft)/3600, + _stprintf( temp, _T("Time remaining : %02d h %02d m %02d s"), ((uint32)TimeLeft)/3600, (((uint32)TimeLeft)/60)%60, (((uint32)TimeLeft))%60 ); if (pClass->bCancelCalculation) - strcpy (temp, "INTERRUPTED - Finishing current object..."); - SendMessage (GetDlgItem (hwndDlg, IDC_STATICTIMELEFT), WM_SETTEXT, 0, (long)temp); + _tcscpy (temp, _T("INTERRUPTED - Finishing current object...")); + SendMessage (GetDlgItem (hwndDlg, IDC_STATICTIMELEFT), WM_SETTEXT, 0, (LPARAM)temp); SendMessage (GetDlgItem (hwndDlg, IDC_BUTTONCANCEL), WM_PAINT, 0, 0); } string all; for (uint32 i = 0; i < 14; ++i) all += pClass->sInfoProgress[i] + "\n"; - SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (long)all.c_str()); + SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(all)); } break; @@ -119,7 +119,7 @@ void CProgressBar::initProgressBar( sint32 nNbMesh, Interface &ip) MAKEINTRESOURCE(IDD_CALCULATING), NULL,//ip.GetMAXHWnd(), CalculatingDialogCallback, - (long)this ); + (LPARAM)this ); } // ----------------------------------------------------------------------------------------------- diff --git a/code/nel/tools/3d/plugin_max/nel_export/std_afx.h b/code/nel/tools/3d/plugin_max/nel_export/std_afx.h index 9b4b18357..ba7b4b4c0 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/std_afx.h +++ b/code/nel/tools/3d/plugin_max/nel_export/std_afx.h @@ -71,5 +71,6 @@ namespace std #endif #include "nel/misc/bsphere.h" +#include "nel/misc/path.h" #endif diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index 21d63b626..863b1b89b 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -2128,7 +2128,7 @@ void appendLightmapLog (COFile &outputLog, const char *lightmapName, const vecto outputLog.serialBuffer ((uint8*)text.c_str(), text.size()); } - catch (exception &e) + catch (const exception &e) { nlwarning ("Error writing the file : %s", e.what()); } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp index 51b8aa367..a7631c05a 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp @@ -775,17 +775,17 @@ void CExportNel::outputErrorMessage(const std::string &message) // -------------------------------------------------- -void CExportNel::outputWarningMessage (const char *message) +void CExportNel::outputWarningMessage (const std::string &message) { if (_ErrorInDialog) { - MessageBox (_Ip->GetMAXHWnd(), message, _ErrorTitle.c_str(), MB_OK|MB_ICONEXCLAMATION); + MessageBox (_Ip->GetMAXHWnd(), utf8ToTStr(message), utf8ToTStr(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); } - mprintf (message); - mprintf ("\n"); + mprintf (utf8ToTStr(message)); + mprintf (_M("\n")); nlwarning ("Warning in max file %s : ", _Ip->GetCurFilePath()); - nlwarning (message); + nlwarning (message.c_str()); } // -------------------------------------------------- @@ -819,7 +819,7 @@ void CExportNel::addChildLodNode (std::set &lodListToExclude, INode *cur if (lodName != "") { // Get the lod by name - INode *lodNode = _Ip->GetINodeByName (lodName.c_str()); + INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName)); if (lodNode) { // Insert it in the set @@ -850,7 +850,7 @@ void CExportNel::addParentLodNode (INode &child, std::set &lodListToExcl if (lodName != "") { // Get the lod by name - INode *lodNode = _Ip->GetINodeByName (lodName.c_str()); + INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName)); if (lodNode == &child) { // Insert it in the set @@ -1111,12 +1111,23 @@ static void restoreDecimalSeparator() float toFloatMax(const TCHAR *src) { float result = 0.f; - if (toFloatMax(src, result)) return result; + if (toFloatMax(tStrToUtf8(src), result)) return result; return 0.f; } +float toFloatMax(const std::string &src) +{ + float result = 0.f; + if (toFloatMax(src, result)) return result; + return 0.f; +} bool toFloatMax(const TCHAR *src, float &dest) +{ + return toFloatMax(tStrToUtf8(src), dest); +} + +bool toFloatMax(const std::string &src, float &dest) { setDecimalSeparatorAsPoint(); std::string str(src); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h index d9d8b6189..178190f13 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h @@ -1092,8 +1092,10 @@ private: /** replacment for sprintf scanf (because of localisation in max) */ +float toFloatMax(const std::string &src); float toFloatMax(const TCHAR *src); // Same as to float max, but returns true if succeed +bool toFloatMax(const std::string &src, float &dest); bool toFloatMax(const TCHAR *src, float &dest); std::string toStringMax(float value); std::string toStringMax(int value); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp index 5d9caef86..2fb18cd9f 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp @@ -458,7 +458,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v delete ss.getShapePointer(); ss.setShapePointer(NULL); } - catch (NLMISC::Exception &e) + catch (const NLMISC::Exception &e) { nlwarning(e.what()); } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp index ec1bb1f92..cf084901d 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp @@ -1171,8 +1171,8 @@ void CExportNel::addSkeletonBindPos (INode& skinedNode, mapBoneBindPos& boneBind if (res != MATRIX_RETURNED) { - nlwarning("res != MATRIX_RETURNED; res = %i; boneIndex = %i / %i", res, boneIndex, count); - nlwarning("bone = %i", (uint32)(void *)bone); + nlwarning("res != MATRIX_RETURNED; res = %d; boneIndex = %u / %u", res, boneIndex, count); + nlwarning("bone = %p", bone); std::string boneName = getName (*bone); nlwarning("boneName = %s", boneName.c_str()); nlassert(false); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h b/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h index 5ca665591..77c2c03ca 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h @@ -50,7 +50,7 @@ class PO2RPO : public Modifier { HWND hRollup; // From Animatable - MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } + const MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } //From Modifier //TODO: Add the channels that the modifier needs to perform its modification @@ -87,8 +87,7 @@ class PO2RPO : public Modifier { void GetClassName(TSTR& s) {s = GetString(IDS_CLASS_NAME);} RefTargetHandle Clone( RemapDir &remap ); - RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message); + RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); int NumSubs() { return 0; } TSTR SubAnimName(int i) { return GetString(IDS_PARAMS); } @@ -115,11 +114,11 @@ class PO2RPOClassDesc:public ClassDesc2 { return new PO2RPO(); } - const TCHAR * ClassName() {return "NeL Convert";} + const MCHAR * ClassName() {return _M("NeL Convert");} SClass_ID SuperClassID() {return OSM_CLASS_ID;} Class_ID ClassID() {return PO2RPO_CLASS_ID;} - const TCHAR* Category() {return "NeL Tools";} - const TCHAR* InternalName() { return _T("PatchObjectToNelPatchObject"); } // returns fixed parsable name (scripter-visible name) + const MCHAR* Category() {return _M("NeL Tools");} + const MCHAR* InternalName() { return _M("PatchObjectToNelPatchObject"); } // returns fixed parsable name (scripter-visible name) HINSTANCE HInstance() { return hInstance; } // returns owning module handle }; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp index 61b8de8e8..ee75bc152 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp @@ -40,12 +40,12 @@ static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2R //rollout IDD_PANEL, IDS_PARAMS, 0, 0, NULL, // params - pb_spin, _T("spin"), TYPE_FLOAT, P_ANIMATABLE, IDS_SPIN, - p_default, 0.1f, - p_range, 0.0f,1000.0f, - p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f, - end, - end + pb_spin, _T("spin"), TYPE_FLOAT, P_ANIMATABLE, IDS_SPIN, + p_default, 0.1f, + p_range, 0.0f,1000.0f, + p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f, + p_end, + p_end ); IObjParam *PO2RPO::ip = NULL; @@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP if (hModule) { // Get module file name - char moduldeFileName[512]; + TCHAR moduldeFileName[512]; if (GetModuleFileName (hModule, moduldeFileName, 512)) { // Get version info size @@ -141,49 +141,49 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP uint versionInfoSize=GetFileVersionInfoSize (moduldeFileName, &doomy); if (versionInfoSize) { - // Alloc the buffer - char *buffer=new char[versionInfoSize]; + // Alloc the buffer (size in bytes) + uint8_t *buffer = new uint8_t[versionInfoSize]; // Find the verion resource if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer)) { uint *versionTab; uint versionSize; - if (VerQueryValue (buffer, "\\", (void**)&versionTab, &versionSize)) + if (VerQueryValue (buffer, _T("\\"), (void**)&versionTab, &versionSize)) { // Get the pointer on the structure VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab; if (info) { // Setup version number - char version[512]; - sprintf (version, "Version %d.%d.%d.%d", - info->dwFileVersionMS>>16, - info->dwFileVersionMS&0xffff, - info->dwFileVersionLS>>16, + TCHAR version[512]; + _stprintf (version, _T("Version %d.%d.%d.%d"), + info->dwFileVersionMS>>16, + info->dwFileVersionMS&0xffff, + info->dwFileVersionLS>>16, info->dwFileVersionLS&0xffff); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), version); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "VS_FIXEDFILEINFO * is NULL"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("VS_FIXEDFILEINFO * is NULL")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "VerQueryValue failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("VerQueryValue failed")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetFileVersionInfo failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfo failed")); // Free the buffer delete [] buffer; } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetFileVersionInfoSize failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfoSize failed")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetModuleFileName failed"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetModuleFileName failed")); } else - SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "hInstance NULL"); + SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("hInstance NULL")); } // ----- @@ -220,8 +220,8 @@ void PO2RPO::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next) // ----------------------------------------------------------------------------------------------------------------------------------------------------------- -//From ReferenceMaker -RefResult PO2RPO::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,PartID& partID, RefMessage message) +//From ReferenceMaker +RefResult PO2RPO::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) { //TODO: Add code to handle the various reference changed messages return REF_SUCCEED; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp index 5f492473c..7ce6c3068 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp @@ -157,7 +157,7 @@ def_visible_primitive( set_vertex_pos, "SetRykolVertexPos"); def_visible_primitive( get_vector_pos, "GetRykolVectorPos"); def_visible_primitive( set_vector_pos, "SetRykolVectorPos");*/ -void errorMessage (const char *msg, const char *title, Interface& it, bool dialog) +void errorMessage (const MCHAR *msg, const TCHAR *title, Interface& it, bool dialog) { // Text or dialog ? if (dialog) @@ -168,7 +168,8 @@ void errorMessage (const char *msg, const char *title, Interface& it, bool dialo else { // Text message - mprintf ((string(msg) + "\n").c_str()); + mprintf(msg); + mprintf(_M("\n")); } } @@ -180,7 +181,7 @@ export_zone_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "ExportRykolZone [Object]"); + type_check(arg_list[0], MAXNode, _M("ExportRykolZone [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -215,7 +216,7 @@ export_zone_cf (Value** arg_list, int count) if (tri->rpatch->exportZone (node, &tri->patch, zone, zoneSymmetry, nZone, 160, 1, false)) { // Export path - const char* sPath=arg_list[1]->to_string(); + const std::string sPath = tStrToUtf8(arg_list[1]->to_string()); COFile file; if (file.open (sPath)) @@ -237,7 +238,7 @@ Value* import_zone_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - char *help = "NeLImportZone filename dialogError"; + MCHAR *help = _M("NeLImportZone filename dialogError"); type_check (arg_list[0], String, help); type_check (arg_list[1], Boolean, help); @@ -245,7 +246,7 @@ Value* import_zone_cf (Value** arg_list, int count) Interface *ip = MAXScript_interface; // Get the filename - string filename = arg_list[0]->to_string(); + string filename = tStrToUtf8(arg_list[0]->to_string()); // Get the flip bool dialog = arg_list[1]->to_bool ()!=FALSE; @@ -287,13 +288,15 @@ Value* import_zone_cf (Value** arg_list, int count) catch (const Exception& e) { // Error message - errorMessage (("Error when loading file "+filename+": "+e.what()).c_str(), "NeL import zone", *ip, dialog); + std::string msg = toString("Error when loading file %s: %s", filename.c_str(), e.what()); + errorMessage (utf8ToTStr(msg), _T("NeL import zone"), *ip, dialog); } } else { // Error message - errorMessage (("Can't open the file "+filename+" for reading.").c_str(), "NeL import zone", *ip, dialog); + std::string msg = toString("Can't open the file %s for reading.", filename.c_str()); + errorMessage (utf8ToTStr(msg), _T("NeL import zone"), *ip, dialog); } return ret; @@ -307,7 +310,7 @@ get_selected_tile_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolSeltile [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolSeltile [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -354,7 +357,7 @@ get_selected_patch_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolSelPatch [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolSelPatch [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -401,7 +404,7 @@ get_selected_vertex_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolSelVertex [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolSelVertex [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -448,7 +451,7 @@ set_tile_mode_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "SetRykolTileMode [Object]"); + type_check(arg_list[0], MAXNode, _M("SetRykolTileMode [Object]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -498,7 +501,7 @@ set_compute_interior_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "RykolComputeInterior [Object]"); + type_check(arg_list[0], MAXNode, _M("RykolComputeInterior [Object]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -546,7 +549,7 @@ set_interior_mode_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "SetRykolInteriorMode [Object]"); + type_check(arg_list[0], MAXNode, _M("SetRykolInteriorMode [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -598,7 +601,7 @@ set_vertex_count_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolVertexCount [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolVertexCount [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -638,7 +641,7 @@ set_vector_count_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolVectorCount [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolVectorCount [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -678,7 +681,7 @@ set_vertex_pos_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "SetRykolVertexPos [Object]"); + type_check(arg_list[0], MAXNode, _M("SetRykolVertexPos [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -728,7 +731,7 @@ set_vector_pos_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "SetRykolVectorPos [Object]"); + type_check(arg_list[0], MAXNode, _M("SetRykolVectorPos [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -778,7 +781,7 @@ get_vertex_pos_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolVertexPos [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolVertexPos [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -822,7 +825,7 @@ get_vector_pos_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolVectorPos [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolVectorPos [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -867,7 +870,7 @@ get_edge_vect1_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolEdgesVect1 [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolEdgesVect1 [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -911,7 +914,7 @@ get_edge_vect2_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolEdgesVect2 [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolEdgesVect2 [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -955,7 +958,7 @@ get_edge_vert1_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolEdgesVert1 [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolEdgesVert1 [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -1000,7 +1003,7 @@ get_edge_vert2_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolEdgesVert2 [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolEdgesVert2 [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -1044,7 +1047,7 @@ get_sel_edge_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "SetRykolSelEdges [Object]"); + type_check(arg_list[0], MAXNode, _M("SetRykolSelEdges [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -1092,7 +1095,7 @@ set_steps_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "SetRykolPatchSteps [Object]"); + type_check(arg_list[0], MAXNode, _M("SetRykolPatchSteps [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -1155,7 +1158,7 @@ set_tile_steps_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "SetRykoltileSteps [Object]"); + type_check(arg_list[0], MAXNode, _M("SetRykoltileSteps [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -1208,7 +1211,7 @@ get_tile_count_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolTileCount [Zone] [PatchNumber]"); + type_check(arg_list[0], MAXNode, _M("GetRykolTileCount [Zone] [PatchNumber]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -1265,7 +1268,7 @@ Value* get_patch_vertex_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - char *message="NeLGetPatchVertex [NeLPatchMesh] [PatchId] [VertexId]"; + const MCHAR *message= _M("NeLGetPatchVertex [NeLPatchMesh] [PatchId] [VertexId]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], Integer, message); type_check(arg_list[2], Integer, message); @@ -1336,7 +1339,7 @@ get_patch_count_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "GetRykolPatchCount [Object]"); + type_check(arg_list[0], MAXNode, _M("GetRykolPatchCount [Object]")); //type_check(arg_list[1], Integer, "SetRykolPatchSteps [Object]"); // Get a good interface pointer @@ -1389,10 +1392,10 @@ get_tile_tile_number_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]"); - type_check(arg_list[1], Integer, "NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]"); - type_check(arg_list[2], Integer, "NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]"); - type_check(arg_list[3], Integer, "NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]"); + type_check(arg_list[0], MAXNode, _M("NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]")); + type_check(arg_list[1], Integer, _M("NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]")); + type_check(arg_list[2], Integer, _M("NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]")); + type_check(arg_list[3], Integer, _M("NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber] [Layer]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -1411,7 +1414,7 @@ get_tile_tile_number_cf(Value** arg_list, int count) uint layer=arg_list[3]->to_int()-1; if (layer>=3) { - mprintf ("Error: layer must be 1, 2, or 3\n"); + mprintf (_M("Error: layer must be 1, 2, or 3\n")); } else { @@ -1427,7 +1430,7 @@ get_tile_tile_number_cf(Value** arg_list, int count) uint nPatch=arg_list[1]->to_int()-1; if (nPatch>=tri->rpatch->getUIPatchSize()) { - mprintf ("Error: patch index is invalid.\n"); + mprintf (_M("Error: patch index is invalid.\n")); } else { @@ -1439,7 +1442,7 @@ get_tile_tile_number_cf(Value** arg_list, int count) uint tile=arg_list[2]->to_int()-1; if (tile>=nPatchCount) { - mprintf ("Error: tile index is invalid.\n"); + mprintf (_M("Error: tile index is invalid.\n")); } else { @@ -1475,9 +1478,9 @@ get_tile_noise_number_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber]"); - type_check(arg_list[1], Integer, "NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber]"); - type_check(arg_list[2], Integer, "NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber]"); + type_check(arg_list[0], MAXNode, _M("NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber]")); + type_check(arg_list[1], Integer, _M("NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber]")); + type_check(arg_list[2], Integer, _M("NelGetTileTileNumber [Zone] [PatchNumber] [TileNumber]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -1504,7 +1507,7 @@ get_tile_noise_number_cf(Value** arg_list, int count) uint nPatch=arg_list[1]->to_int()-1; if (nPatch>=tri->rpatch->getUIPatchSize()) { - mprintf ("Error: patch index is invalid.\n"); + mprintf (_M("Error: patch index is invalid.\n")); } else { @@ -1516,7 +1519,7 @@ get_tile_noise_number_cf(Value** arg_list, int count) uint tile=arg_list[2]->to_int()-1; if (tile>=nPatchCount) { - mprintf ("Error: patch index is invalid.\n"); + mprintf (_M("Error: patch index is invalid.\n")); } else { @@ -1544,10 +1547,10 @@ set_tile_noise_number_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]"); - type_check(arg_list[1], Integer, "NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]"); - type_check(arg_list[2], Integer, "NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]"); - type_check(arg_list[3], Integer, "NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]"); + type_check(arg_list[0], MAXNode, _M("NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]")); + type_check(arg_list[1], Integer, _M("NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]")); + type_check(arg_list[2], Integer, _M("NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]")); + type_check(arg_list[3], Integer, _M("NelGetTileNoiseNumber [Zone] [PatchNumber] [TileNumber] [noise]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -1566,7 +1569,7 @@ set_tile_noise_number_cf(Value** arg_list, int count) uint noise=arg_list[3]->to_int()-1; if (noise>=16) { - mprintf ("Error: noise value must be 1~16\n"); + mprintf (_M("Error: noise value must be 1~16\n")); } else { @@ -1582,7 +1585,7 @@ set_tile_noise_number_cf(Value** arg_list, int count) uint nPatch=arg_list[1]->to_int()-1; if (nPatch>=tri->rpatch->getUIPatchSize()) { - mprintf ("Error: patch index is invalid.\n"); + mprintf (_M("Error: patch index is invalid.\n")); } else { @@ -1594,7 +1597,7 @@ set_tile_noise_number_cf(Value** arg_list, int count) uint tile=arg_list[2]->to_int()-1; if (tile>=nPatchCount) { - mprintf ("Error: patch index is invalid.\n"); + mprintf (_M("Error: patch index is invalid.\n")); } else { @@ -1646,13 +1649,13 @@ load_bank_cf(Value** arg_list, int count) } else { - mprintf ("Error: can't open bank file %s\n", bankName.c_str()); + mprintf (_M("Error: can't open bank file %s\n"), bankName.c_str()); } } catch (const Exception& e) { // Error message - mprintf ("Error: %s\n", e.what()); + mprintf (_M("Error: %s\n"), e.what()); } } @@ -1668,7 +1671,7 @@ get_tile_set_cf(Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], Integer, "NelGetTileSet [tileId]"); + type_check(arg_list[0], Integer, _M("NelGetTileSet [tileId]")); // ok ? int nRet=-1; @@ -1677,7 +1680,7 @@ get_tile_set_cf(Value** arg_list, int count) uint tile=arg_list[0]->to_int()-1; if (tile>=(uint)scriptedBank.getTileCount()) { - mprintf ("Error: tile number is wrong. (1 ~ %d)\n", scriptedBank.getTileCount()); + mprintf (_M("Error: tile number is wrong. (1 ~ %d)\n"), scriptedBank.getTileCount()); } else { @@ -1702,10 +1705,10 @@ Value* set_tile_bank_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], String, "NelSetTileBank [tile bank pathname]"); + type_check(arg_list[0], String, _M("NelSetTileBank [tile bank pathname]")); // ok ? - const char *pathname = arg_list[0]->to_string(); + const std::string pathname = tStrToUtf8(arg_list[0]->to_string()); // Get tile number SetBankPathName (pathname); @@ -1947,8 +1950,8 @@ attach_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "NeLAttachPatchMesh [RykolPatchMeshSrc] [RykolPatchMeshDest]"); - type_check(arg_list[1], MAXNode, "NeLAttachPatchMesh [RykolPatchMeshSrc] [RykolPatchMeshDest]"); + type_check(arg_list[0], MAXNode, _M("NeLAttachPatchMesh [RykolPatchMeshSrc] [RykolPatchMeshDest]")); + type_check(arg_list[1], MAXNode, _M("NeLAttachPatchMesh [RykolPatchMeshSrc] [RykolPatchMeshDest]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -2005,8 +2008,8 @@ weld_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "NeLWeldPatchMesh [RykolPatchMeshSrc] [threshold]"); - type_check(arg_list[1], Float, "NeLWeldPatchMesh [RykolPatchMeshSrc] [threshold]"); + type_check(arg_list[0], MAXNode, _M("NeLWeldPatchMesh [RykolPatchMeshSrc] [threshold]")); + type_check(arg_list[1], Float, _M("NeLWeldPatchMesh [RykolPatchMeshSrc] [threshold]")); // Get a good interface pointer Interface *ip = MAXScript_interface; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h b/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h index ec8947571..b6fe7adb1 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h @@ -574,9 +574,8 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac static bool additiveTile; static bool automaticLighting; - RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, - PartID& partID, RefMessage message ) { return REF_SUCCEED; } - + RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) { return REF_SUCCEED; } + int selLevel; // RB:named sel sets @@ -752,7 +751,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac void BeginEditParams( IObjParam *ip, ULONG flags, Animatable *prev ); void EndEditParams( IObjParam *ip, ULONG flags, Animatable *next ); RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); - TCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); } + const MCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); } void ActivateSubobjSel(int level, XFormModes& modes ); int NeedUseSubselButton() { return 0; } void SelectSubPatch(int index); @@ -929,10 +928,10 @@ class EditPatchClassDesc:public ClassDesc { { return new EditPatchMod; } - const TCHAR * ClassName() { return "NeL Edit"; } + const MCHAR * ClassName() { return _M("NeL Edit"); } SClass_ID SuperClassID() { return OSM_CLASS_ID; } Class_ID ClassID() { return Class_ID(0x4dd14a3c, 0x4ac23c0c); } - const TCHAR* Category() { return "NeL Tools";} + const MCHAR* Category() { return _M("NeL Tools");} void ResetClassParams(BOOL fileReset); }; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp index 133d0b4d6..980bb64d8 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp @@ -642,7 +642,7 @@ void EditPatchMod::DoVertWeld() { hadSel = TRUE; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertWeld")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoVertWeld"))); // Call the patch weld function if (patch->Weld(weldThreshold)) { @@ -716,7 +716,7 @@ void EditPatchMod::DoVertReset () { hadSel = TRUE; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertReset")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoVertReset"))); // Call the patch weld function ResetVert (patch); patchData->UpdateChanges(patch, rpatch); @@ -890,9 +890,9 @@ Value *turn_patch_cf (Value** arg_list, int count) // Check to see if the arguments match up to what we expect // We want to use 'TurnAllTexturesOn ' - type_check(arg_list[0], MAXNode, "RykolTurnPatch [Node] [Modifier] [Patch]"); - type_check(arg_list[1], MAXModifier, "RykolTurnPatch [Node] [Modifier] [Patch]"); - type_check(arg_list[2], Integer, "RykolTurnPatch [Node] [Modifier] [Patch]"); + type_check(arg_list[0], MAXNode, _M("RykolTurnPatch [Node] [Modifier] [Patch]")); + type_check(arg_list[1], MAXModifier, _M("RykolTurnPatch [Node] [Modifier] [Patch]")); + type_check(arg_list[2], Integer, _M("RykolTurnPatch [Node] [Modifier] [Patch]")); // Get a good interface pointer Interface *ip = MAXScript_interface; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp index 55825158b..4306cfd0b 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp @@ -338,8 +338,7 @@ static INT_PTR CALLBACK PickSetDlgProc( Tab &names = *((Tab < TSTR*>*)lParam); for (int i = 0; i < names.Count(); i++) { - int pos = SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_ADDSTRING, 0, - (LPARAM)(TCHAR*)*names[i]); + int pos = SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_ADDSTRING, 0, (LPARAM)(TCHAR*)*names[i]->ToMCHAR()); SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_SETITEMDATA, pos, i); } break; @@ -688,7 +687,7 @@ if (!TestAFlag(A_HELD)) patchData->vdelta.SetSize(*patch, FALSE); if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "XFormHandles")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("XFormHandles"))); } patchData->vdelta.Zero(); // Reset all deltas patchData->ClearHandleFlag(); @@ -946,7 +945,7 @@ for (int i = 0; i < mcList.Count(); i++) if (theHold.Holding()) { // Hulud: here, i pass a NULL pointer because rpatch are not modified by xform - theHold.Put(new PatchRestore(patchData, this, patch, NULL, "XFormVerts")); + theHold.Put(new PatchRestore(patchData, this, patch, NULL, _T("XFormVerts"))); } patchData->vdelta.Zero(); // Reset all deltas patchData->ClearHandleFlag(); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_add_patches.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_add_patches.cpp index 49e2cb005..8ef6fde75 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_add_patches.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_add_patches.cpp @@ -24,7 +24,7 @@ static void AddPatches(int type, PatchMesh *patch, RPatchMesh *rpatch, BOOL post int edges = patch->getNumEdges(); if (type==PATCH_TRI) - MessageBox (NULL, "Rykol tools", "C'est pas cool les tripatches...", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, _T("Rykol tools"), _T("C'est pas cool les tripatches..."), MB_OK|MB_ICONEXCLAMATION); // Add a patch of the desired type to each selected edge that doesn't have two patches atatched! for (int i = 0; i < edges; ++i) @@ -393,7 +393,7 @@ void EditPatchMod::DoPatchAdd(int type) { altered = holdNeeded = 1; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchAdd")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoPatchAdd"))); // Call the patch add function AddPatches(type, patch, rpatch, TRUE); patchData->UpdateChanges(patch, rpatch); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_attach.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_attach.cpp index d2843df1c..0067a7175 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_attach.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_attach.cpp @@ -284,7 +284,7 @@ int EditPatchMod::DoAttach(INode *node, PatchMesh *attPatch, RPatchMesh *rattPat // Start a restore object... if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoAttach")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoAttach"))); // Do the attach patch->Attach(attPatch, mat2Offset); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_del.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_del.cpp index f196105ed..f2597fc58 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_del.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_del.cpp @@ -110,7 +110,7 @@ void EditPatchMod::DoPatchDelete() { altered = holdNeeded = 1; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchDelete")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoPatchDelete"))); // Call the patch delete function DeleteSelPatches(patch, rpatch); patchData->UpdateChanges(patch, rpatch); @@ -211,7 +211,7 @@ void EditPatchMod::DoVertDelete() { altered = holdNeeded = 1; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertDelete")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoVertDelete"))); // Call the vertex delete function DeleteSelVerts(patch, rpatch); patchData->UpdateChanges(patch, rpatch); @@ -279,7 +279,7 @@ void EditPatchMod::DoEdgeDelete() { altered = holdNeeded = 1; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoEdgeDelete")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoEdgeDelete"))); int edges = patch->getNumEdges(); int patches = patch->getNumPatches(); int verts = patch->getNumVerts(); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_detach.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_detach.cpp index eaf0c7369..370027a46 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_detach.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_detach.cpp @@ -133,7 +133,7 @@ void EditPatchMod::DoPatchDetach(int copy, int reorient) // Save the unmodified info. if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchDetach")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoPatchDetach"))); } PatchMesh wpatch = *patch; RPatchMesh wrpatch = *rpatch; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_material.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_material.cpp index 6adcde3cd..bc36eae43 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_material.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_material.cpp @@ -89,7 +89,7 @@ void EditPatchMod::SetSelMatIndex(int index) // Start a restore object... if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSelMatIndex")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSelMatIndex"))); } for (int j = 0; j < patch->getNumPatches(); j++) @@ -254,7 +254,7 @@ void EditPatchMod::SetSelTess(int nU, int nV) // Start a restore object... if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSelTess")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSelTess"))); } for (int j = 0; j < patch->getNumPatches(); j++) @@ -276,7 +276,7 @@ void EditPatchMod::SetSelTess(int nU, int nV) } if (holdNeeded) - theHold.Accept("Tile count in U and V change"); + theHold.Accept(_M("Tile count in U and V change")); else { ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME); @@ -391,7 +391,7 @@ void EditPatchMod::setSmoothFlags (bool smooth) // Start a restore object... if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSmoothFlags")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSmoothFlags"))); } // For each edges @@ -453,7 +453,7 @@ void EditPatchMod::setSmoothFlags (bool smooth) } if (holdNeeded) - theHold.Accept("Tile count in U and V change"); + theHold.Accept(_M("Tile count in U and V change")); else { ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME); @@ -539,7 +539,7 @@ void EditPatchMod::BalanceSelPatch () // Start a restore object... if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSelTess")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSelTess"))); } std::set visitedU; @@ -589,7 +589,7 @@ void EditPatchMod::BalanceSelPatch () } if (holdNeeded) - theHold.Accept("Balance tile"); + theHold.Accept(_M("Balance tile")); else { ip->DisplayTempPrompt(GetString(IDS_TH_NOPATCHESSEL), PROMPT_TIME); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_remember.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_remember.cpp index 3ab9a629b..0fc1fabba 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_remember.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_remember.cpp @@ -149,7 +149,7 @@ void EditPatchMod::ChangeRememberedPatch(int type) theHold.Begin(); if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeRememberedPatch")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeRememberedPatch"))); // Call the patch type change function ChangePatchType(patch, rememberedIndex, type); patchData->UpdateChanges(patch, rpatch, FALSE); @@ -299,7 +299,7 @@ void EditPatchMod::ChangeRememberedVert(int type) theHold.Begin(); if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeRememberedVert")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeRememberedVert"))); // Call the vertex type change function patch->ChangeVertType(rememberedIndex, type); patchData->UpdateChanges(patch, rpatch, FALSE); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp index 0b15b63e7..03409c374 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp @@ -71,18 +71,15 @@ void EditPatchMod::RefreshSelType() */ if (selLevel == EP_PATCH) { - hSurfPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_SURF), - PatchSurfDlgProc, GetString(IDS_TH_SURFACEPROPERTIES), (LPARAM) this, rsSurf ? 0 : APPENDROLL_CLOSED); + hSurfPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_SURF), PatchSurfDlgProc, GetString(IDS_TH_SURFACEPROPERTIES), (LPARAM) this, rsSurf ? 0 : APPENDROLL_CLOSED); } if (selLevel == EP_TILE) { - hTilePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_TILE), - PatchTileDlgProc, "Tile Properties", (LPARAM) this, rsTile ? 0 : APPENDROLL_CLOSED); + hTilePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_TILE), PatchTileDlgProc, _M("Tile Properties"), (LPARAM) this, rsTile ? 0 : APPENDROLL_CLOSED); } if (selLevel == EP_EDGE) { - hEdgePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_EDGE), - PatchEdgeDlgProc, "Edge Properties", (LPARAM) this, rsEdge ? 0 : APPENDROLL_CLOSED); + hEdgePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_EDGE), PatchEdgeDlgProc, _M("Edge Properties"), (LPARAM) this, rsEdge ? 0 : APPENDROLL_CLOSED); } SetSurfDlgEnables(); SetTileDlgEnables(); @@ -262,7 +259,7 @@ void EditPatchMod::SelectSubPatch(int index) patchData->BeginEdit(t); if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SelectSubComponent"))); patch->patchSel.Set(index); @@ -311,7 +308,7 @@ void EditPatchMod::SelectSubPatch(int index) patchData->BeginEdit(t); if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SelectSubComponent"))); switch (selLevel) { @@ -636,7 +633,7 @@ void EditPatchMod::ClearSelection(int selLevel) patchData->BeginEdit(ip->GetTime()); if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ClearSelection")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ClearSelection"))); } switch (selLevel) @@ -744,7 +741,7 @@ void EditPatchMod::SelectAll(int selLevel) patchData->BeginEdit(ip->GetTime()); if (theHold.Holding()) { - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectAll")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SelectAll"))); } switch (selLevel) @@ -813,7 +810,7 @@ void EditPatchMod::InvertSelection(int selLevel) patchData->BeginEdit(ip->GetTime()); if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "InvertSelection")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("InvertSelection"))); switch (selLevel) { @@ -1004,7 +1001,7 @@ void EditPatchMod::ChangeSelPatches(int type) { altered = holdNeeded = TRUE; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeSelPatches")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeSelPatches"))); // Call the vertex type change function ChangePatchType(patch, -1, type); patchData->UpdateChanges(patch, rpatch, FALSE); @@ -1077,7 +1074,7 @@ void EditPatchMod::ChangeSelVerts(int type) { altered = holdNeeded = TRUE; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeSelVerts")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeSelVerts"))); // Call the vertex type change function patch->ChangeVertType(-1, type); patchData->UpdateChanges(patch, rpatch, FALSE); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_subdivide.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_subdivide.cpp index b67153e07..644b508a8 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_subdivide.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_subdivide.cpp @@ -1237,7 +1237,7 @@ void EditPatchMod::DoEdgeSubdivide() { altered = holdNeeded = 1; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoEdgeSubdivide")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoEdgeSubdivide"))); // Call the patch add function SubdividePatch(SUBDIV_EDGES, propagate, patch, rpatch); patchData->UpdateChanges(patch, rpatch); @@ -1304,7 +1304,7 @@ void EditPatchMod::DoPatchSubdivide() { altered = holdNeeded = 1; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchSubdivide")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoPatchSubdivide"))); // Call the patch add function SubdividePatch(SUBDIV_PATCHES, propagate, patch, rpatch); patchData->UpdateChanges(patch, rpatch); @@ -1441,7 +1441,7 @@ void EditPatchMod::DoPatchTurn(bool ccw) { altered = holdNeeded = 1; if (theHold.Holding()) - theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoTurnPatch")); + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoTurnPatch"))); // Call the patch add function TurnPatch (patch, rpatch, ccw); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_gui_bind.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_gui_bind.cpp index 4b3d4b6b4..af533c4c8 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_gui_bind.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_gui_bind.cpp @@ -165,7 +165,11 @@ int EPM_BindMouseProc::proc( int flags, IPoint2 m) { - ViewExp *vpt = ip->GetViewport(hwnd); +#if MAX_VERSION_MAJOR >= 19 + ViewExp *vpt = &ip->GetViewExp(hwnd); +#else + ViewExp *vpt = ip->GetViewport(hwnd); +#endif int res = TRUE; static PatchMesh *shape1 = NULL; static int poly1, vert1, seg1; @@ -302,8 +306,11 @@ int EPM_BindMouseProc::proc( break; } - if (vpt) +#if MAX_VERSION_MAJOR < 19 + if (vpt) ip->ReleaseViewport(vpt); +#endif + return res; } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_main.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_main.cpp index 2a36cf070..bbe8e95a9 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_main.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_main.cpp @@ -160,24 +160,21 @@ void EditPatchMod::BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev) */ if (selLevel == EP_PATCH) { - hSurfPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_SURF), - PatchSurfDlgProc, GetString(IDS_TH_SURFACEPROPERTIES), (LPARAM) this, rsSurf ? 0 : APPENDROLL_CLOSED); + hSurfPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_SURF), PatchSurfDlgProc, GetString(IDS_TH_SURFACEPROPERTIES), (LPARAM) this, rsSurf ? 0 : APPENDROLL_CLOSED); } else hSurfPanel = NULL; if (selLevel == EP_TILE) { - hTilePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_TILE), - PatchTileDlgProc, "Tile Properties", (LPARAM) this, rsTile ? 0 : APPENDROLL_CLOSED); + hTilePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_TILE), PatchTileDlgProc, _M("Tile Properties"), (LPARAM) this, rsTile ? 0 : APPENDROLL_CLOSED); } else hTilePanel = NULL; if (selLevel == EP_EDGE) { - hEdgePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_EDGE), - PatchEdgeDlgProc, "Edge Properties", (LPARAM) this, rsEdge ? 0 : APPENDROLL_CLOSED); + hEdgePanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_EDGE), PatchEdgeDlgProc, _M("Edge Properties"), (LPARAM) this, rsEdge ? 0 : APPENDROLL_CLOSED); } else hEdgePanel = NULL; @@ -329,7 +326,7 @@ ISubObjType *EditPatchMod::GetSubObjType(int i) SOT_Vertex.SetName(GetString(IDS_TH_VERTEX)); SOT_Edge.SetName(GetString(IDS_TH_EDGE)); SOT_Patch.SetName(GetString(IDS_TH_PATCH)); - SOT_Tile.SetName("Tile"); + SOT_Tile.SetName(_M("Tile")); // SOT_Element.SetName(GetString(IDS_TH_ELEMENT)); // SOT_Handle.SetName(GetString(IDS_TH_HANDLE)); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp index 0d16dd149..bb134c871 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp @@ -70,7 +70,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) //------------------------------------------------------ __declspec( dllexport ) const TCHAR *LibDescription() { - return "NeL Patch Edit"; + return _T("NeL Patch Edit"); } /// MUST CHANGE THIS NUMBER WHEN ADD NEW CLASS diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_rollup.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_rollup.cpp index 649b3b051..ede7215f9 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_rollup.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_rollup.cpp @@ -35,7 +35,7 @@ extern void LoadImages(); INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - static char string[64]; + static TCHAR string[64]; EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); ICustToolbar *iToolbar; if (!ep && message != WM_INITDIALOG) @@ -50,7 +50,7 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR if (hModule) { // Get module file name - char moduldeFileName[512]; + TCHAR moduldeFileName[512]; if (GetModuleFileName (hModule, moduldeFileName, 512)) { // Get version info size @@ -59,22 +59,22 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR if (versionInfoSize) { // Alloc the buffer - char *buffer=new char[versionInfoSize]; + TCHAR *buffer = new TCHAR[versionInfoSize]; // Find the verion resource if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer)) { uint *versionTab; uint versionSize; - if (VerQueryValue (buffer, "\\", (void**)&versionTab, &versionSize)) + if (VerQueryValue (buffer, _T("\\"), (void**)&versionTab, &versionSize)) { // Get the pointer on the structure VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab; if (info) { // Setup version number - char version[512]; - sprintf (version, "Version %d.%d.%d.%d", + TCHAR version[512]; + _stprintf(version, _T("Version %d.%d.%d.%d"), info->dwFileVersionMS>>16, info->dwFileVersionMS&0xffff, info->dwFileVersionLS>>16, @@ -82,25 +82,25 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR SetWindowText (GetDlgItem (hDlg, IDC_VERSION), version); } else - SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "VS_FIXEDFILEINFO * is NULL"); + SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("VS_FIXEDFILEINFO * is NULL")); } else - SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "VerQueryValue failed"); + SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("VerQueryValue failed")); } else - SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetFileVersionInfo failed"); + SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetFileVersionInfo failed")); // Free the buffer delete [] buffer; } else - SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetFileVersionInfoSize failed"); + SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetFileVersionInfoSize failed")); } else - SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetModuleFileName failed"); + SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetModuleFileName failed")); } else - SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetModuleHandle failed"); + SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetModuleHandle failed")); ep =(EditPatchMod *)lParam; ep->hSelectPanel = hDlg; @@ -122,7 +122,7 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR CheckDlgButton(hDlg, IDC_LOCK_HANDLES, lockedHandles); ep->SetSelDlgEnables(); - sprintf(string,"%s - %s",__DATE__,__TIME__); + _stprintf(string, _T("%s - %s"), _T(__DATE__), _T(__TIME__)); SetDlgItemText(hDlg,ID_VERSION,string); return TRUE; } @@ -224,7 +224,7 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR lpttt->lpszText = GetString(IDS_TH_PATCH); break; case EP_TILE: - lpttt->lpszText = "Tile"; + lpttt->lpszText = _T("Tile"); break; } } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp index a0697ac79..5dd6cd5a7 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp @@ -53,7 +53,7 @@ float bindWhere[BIND_COUNT]= #define RK_APPDATA_TILEFILE 0 #define RK_APPDATA_LAND 1 -#define REGKEY_TILEDIT "Software\\Nevrax\\Ryzom\\Tile_Edit" +#define REGKEY_TILEDIT _T("Software\\Nevrax\\Ryzom\\Tile_Edit") //#define CHECK_VALIDITY // check validity @@ -103,11 +103,11 @@ std::string GetBankPathName () HKEY hKey; if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_TILEDIT, 0, KEY_READ, &hKey)==ERROR_SUCCESS) { - char path[256]; - DWORD len=256; + TCHAR path[256]; + DWORD len=256 * sizeof(TCHAR); DWORD type; - if (RegQueryValueEx(hKey, "Bank Path", 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS) - return std::string (path); + if (RegQueryValueEx(hKey, _T("Bank Path"), 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS) + return tStrToUtf8(path); RegCloseKey (hKey); } return ""; @@ -121,7 +121,7 @@ int GetBankTileSetSet () int tileSetSet; DWORD len=256; DWORD type; - if (RegQueryValueEx(hKey, "Tileset Set", 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS) + if (RegQueryValueEx(hKey, _T("Tileset Set"), 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS) return tileSetSet; RegCloseKey (hKey); } @@ -143,7 +143,7 @@ void SetBankTileSetSet (int tileSetSet) HKEY hKey; if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS) { - RegSetValueEx(hKey, "Tileset Set", 0, REG_DWORD, (LPBYTE)&tileSetSet, 4); + RegSetValueEx(hKey, _T("Tileset Set"), 0, REG_DWORD, (LPBYTE)&tileSetSet, 4); RegCloseKey (hKey); } } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp index 3acaf28bb..3f2363a16 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp @@ -43,9 +43,9 @@ class RPOClassDesc:public ClassDesc { return new RPO; } - const TCHAR * ClassName() + const MCHAR * ClassName() { - return _T("RklPatch"); + return _M("RklPatch"); } SClass_ID SuperClassID() { @@ -55,9 +55,9 @@ class RPOClassDesc:public ClassDesc { return RYKOLPATCHOBJ_CLASS_ID; } - const TCHAR* Category() + const MCHAR* Category() { - return _T("Rykol Tools"); + return _M("Rykol Tools"); } }; @@ -304,10 +304,10 @@ void RPO::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel ) // ------------------------------------------------------------------------------------------------------------------------------------------------ //From ReferenceMaker -RefResult RPO::NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget,PartID& partID, RefMessage message ) +RefResult RPO::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget,PartID& partID, RefMessage message, BOOL propagate ) { //TODO: Implement, if the object makes references to other things - //return PatchObject::NotifyRefChanged( changeInt, hTarget, partID, message); + //return PatchObject::NotifyRefChanged( changeInt, hTarget, partID, message, propagate); return(REF_SUCCEED); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h index 4464ce10f..0faa95aa6 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h @@ -83,14 +83,14 @@ class RPO : public PatchObject int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt); void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt); //TODO: Return the name that will appear in the history browser (modifier stack) - const MCHAR *GetObjectName() { return _T("Rykol Patch Object");} + const MCHAR *GetObjectName() { return _M("Rykol Patch Object");} void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel ); //TODO: Return the default name of the node when it is created. - void InitNodeName(TSTR& s) { s.FromUTF8("Rykol Patch Object"); } + void InitNodeName(TSTR& s) { s = _M("Rykol Patch Object"); } // From Object BOOL HasUVW(); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h index 20009d0c7..d0e16bd11 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h @@ -422,8 +422,7 @@ class PaintPatchMod : public Modifier static bool automaticLighting; static bool lockBorders; - RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, - PartID& partID, RefMessage message ) { return REF_SUCCEED; } + RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) { return REF_SUCCEED; } bool includeMeshes; bool preloadTiles; @@ -482,7 +481,7 @@ class PaintPatchMod : public Modifier void BeginEditParams( IObjParam *ip, ULONG flags, Animatable *prev ); void EndEditParams( IObjParam *ip, ULONG flags, Animatable *next ); RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); - TCHAR *GetObjectName() { return "NeL Patch Painter"; } + const MCHAR *GetObjectName() { return _M("NeL Patch Painter"); } void RescaleWorldUnits(float f); @@ -500,10 +499,10 @@ class EditPatchClassDesc:public ClassDesc { { return new PaintPatchMod; } - const TCHAR * ClassName() { return "NeL Painter"; } + const MCHAR * ClassName() { return _M("NeL Painter"); } SClass_ID SuperClassID() { return OSM_CLASS_ID; } Class_ID ClassID() { return Class_ID(0xc49560f, 0x3c3d68e7); } - const TCHAR* Category() { return "NeL Tools";} + const MCHAR* Category() { return _M("NeL Tools");} void ResetClassParams(BOOL fileReset); }; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp index 9f5c7b4cb..b5894e9a8 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp @@ -47,7 +47,7 @@ using namespace NLLIGO; #define DEPTH_SEARCH_MAX 8 -#define REGKEY_EDIT_PATCH "Software\\Nevrax\\Ryzom\\edit_patch" +#define REGKEY_EDIT_PATCH _T("Software\\Nevrax\\Ryzom\\edit_patch") // Bank bitmaps CBankCont* bankCont; @@ -77,8 +77,7 @@ void WarningInvalidTileSet () if (!bWarningInvalidTileSet) { bWarningInvalidTileSet=true; - MessageBox (NULL, "The tile bank is not compatible with your zone.\nPlease use the good bank or erase and repaint the zone.", - "Tile paint", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, _T("The tile bank is not compatible with your zone.\nPlease use the good bank or erase and repaint the zone."), _T("Tile paint"), MB_OK|MB_ICONEXCLAMATION); } } @@ -105,13 +104,13 @@ void enterPainter (CTileBank& banktoLoad) { DWORD len=4; DWORD type; - RegQueryValueEx (hKey, "Background", 0, &type, (LPBYTE)&backGround, &len); - RegQueryValueEx (hKey, "Color1", 0, &type, (LPBYTE)&color1, &len); - RegQueryValueEx (hKey, "Color2", 0, &type, (LPBYTE)&color2, &len); - RegQueryValueEx (hKey, "Opa1", 0, &type, (LPBYTE)&opa1, &len); - RegQueryValueEx (hKey, "Opa2", 0, &type, (LPBYTE)&opa2, &len); - RegQueryValueEx (hKey, "Hard1", 0, &type, (LPBYTE)&hard1, &len); - RegQueryValueEx (hKey, "Hard2", 0, &type, (LPBYTE)&hard2, &len); + RegQueryValueEx (hKey, _T("Background"), 0, &type, (LPBYTE)&backGround, &len); + RegQueryValueEx (hKey, _T("Color1"), 0, &type, (LPBYTE)&color1, &len); + RegQueryValueEx (hKey, _T("Color2"), 0, &type, (LPBYTE)&color2, &len); + RegQueryValueEx (hKey, _T("Opa1"), 0, &type, (LPBYTE)&opa1, &len); + RegQueryValueEx (hKey, _T("Opa2"), 0, &type, (LPBYTE)&opa2, &len); + RegQueryValueEx (hKey, _T("Hard1"), 0, &type, (LPBYTE)&hard1, &len); + RegQueryValueEx (hKey, _T("Hard2"), 0, &type, (LPBYTE)&hard2, &len); RegCloseKey (hKey); } } @@ -126,13 +125,13 @@ void exitPainter () HKEY hKey; if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_EDIT_PATCH, &hKey)==ERROR_SUCCESS) { - RegSetValueEx(hKey, "Background", 0, REG_DWORD, (LPBYTE)&backGround, 4); - RegSetValueEx(hKey, "Color1", 0, REG_DWORD, (LPBYTE)&color1, 4); - RegSetValueEx(hKey, "Color2", 0, REG_DWORD, (LPBYTE)&color2, 4); - RegSetValueEx(hKey, "Opa1", 0, REG_DWORD, (LPBYTE)&opa1, 4); - RegSetValueEx(hKey, "Opa2", 0, REG_DWORD, (LPBYTE)&opa2, 4); - RegSetValueEx(hKey, "Hard1", 0, REG_DWORD, (LPBYTE)&hard1, 4); - RegSetValueEx(hKey, "Hard2", 0, REG_DWORD, (LPBYTE)&hard2, 4); + RegSetValueEx(hKey, _T("Background"), 0, REG_DWORD, (LPBYTE)&backGround, 4); + RegSetValueEx(hKey, _T("Color1"), 0, REG_DWORD, (LPBYTE)&color1, 4); + RegSetValueEx(hKey, _T("Color2"), 0, REG_DWORD, (LPBYTE)&color2, 4); + RegSetValueEx(hKey, _T("Opa1"), 0, REG_DWORD, (LPBYTE)&opa1, 4); + RegSetValueEx(hKey, _T("Opa2"), 0, REG_DWORD, (LPBYTE)&opa2, 4); + RegSetValueEx(hKey, _T("Hard1"), 0, REG_DWORD, (LPBYTE)&hard1, 4); + RegSetValueEx(hKey, _T("Hard2"), 0, REG_DWORD, (LPBYTE)&hard2, 4); RegCloseKey (hKey); } } @@ -2816,12 +2815,12 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi if (AsyncListener.isKeyPushed ((TKey)PainterKeys[SelectColorBrush])) { // Create a dialog filter - static char szFilter[] = - "Targa Files (*.tga)\0*.tga\0" - "All Files (*.*)\0*.*\0\0"; + static TCHAR szFilter[] = + _T("Targa Files (*.tga)\0*.tga\0") + _T("All Files (*.*)\0*.*\0\0"); // Filename buffer - char buffer[65535]; + TCHAR buffer[65535]; buffer[0]=0; // Fill the (big) struct @@ -2834,13 +2833,13 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi openFile.lpstrFile = buffer; openFile.nMaxFile = 65535; openFile.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ENABLESIZING|OFN_EXPLORER; - openFile.lpstrDefExt = "*.tga"; + openFile.lpstrDefExt = _T("*.tga"); // Open the dialog if (GetOpenFileName(&openFile)) { // Load the file - paintColor.loadBrush (buffer); + paintColor.loadBrush (tStrToUtf8(buffer)); paintColor.setBrushMode (true); } } @@ -3721,7 +3720,7 @@ void EPM_PaintCMode::DoPaint () { std::string error = NLMISC::toString("Invalid edge '%i' with value '%i' in patch '%i' in PatchMesh", p, mYedge, e); nlwarning(error.c_str()); - MessageBox(NULL, error.c_str(), "NeL Patch Painter", MB_OK | MB_ICONSTOP); + MessageBox(NULL, utf8ToTStr(error), _T("NeL Patch Painter"), MB_OK | MB_ICONSTOP); return; } #if (MAX_RELEASE < 4000) @@ -3884,8 +3883,8 @@ void EPM_PaintCMode::DoPaint () } if (patchVoisin.patch!=-1) { - std::string first = vectMesh[i].Node->GetName(); - std::string second = vectMesh[patchVoisin.Mesh].Node->GetName(); + std::string first = tStrToUtf8(vectMesh[i].Node->GetName()); + std::string second = tStrToUtf8(vectMesh[patchVoisin.Mesh].Node->GetName()); int rot = (2-((vectMesh[i].Symmetry)?(2-e):e)+((vectMesh[patchVoisin.Mesh].Symmetry)?(2-edgeVoisin):edgeVoisin))&3; int nU = 1 << rpatch->getUIPatch (p).NbTilesU; int nV = 1 << rpatch->getUIPatch (p).NbTilesV; @@ -4035,7 +4034,7 @@ void EPM_PaintCMode::DoPaint () patchData->SetFlag(EPD_BEENDONE, TRUE); } - theHold.Accept("Patch change"); + theHold.Accept(_M("Patch change")); nodes.DisposeTemporary(); pobj->ClearPatchDataFlag(mcList, EPD_BEENDONE); @@ -4076,9 +4075,7 @@ bool loadLigoConfigFile (CLigoConfig& config, Interface& it) catch (const Exception& e) { // Print an error message - char msg[512]; - smprintf (msg, 512, "Error loading the config file ligoscape.cfg: %s", e.what()); - nlwarning (msg); + nlwarning("Error loading the config file ligoscape.cfg: %s", e.what()); } } } @@ -4259,9 +4256,8 @@ DWORD WINAPI myThread (LPVOID vData) } else { - char message[512]; - smprintf (message, 512, "Can't build the zone named %s", pData->VectMesh[i].Node->GetName()); - MessageBox (pData->eproc->ip->GetMAXHWnd(), message, "NeL Painter", MB_OK|MB_ICONEXCLAMATION); + std::string message = toString("Can't build the zone named %s", tStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str()); + MessageBox (pData->eproc->ip->GetMAXHWnd(), utf8ToTStr(message), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); } } @@ -4363,14 +4359,14 @@ DWORD WINAPI myThread (LPVOID vData) } catch (EDru& druExcept) { - MessageBox (NULL, druExcept.what(), "NeL driver utility", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, utf8ToTStr(druExcept.what()), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION); } delete pData; } catch (const Exception& e) { - MessageBox (NULL, e.what(), "NeL Painter", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); } return 0; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_main.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_main.cpp index a4c22cbaf..a05fc67b7 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_main.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_main.cpp @@ -47,8 +47,7 @@ void PaintPatchMod::BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev CreatePatchDataTempData(); - hOpsPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_OPS), - PatchOpsDlgProc, "Geometry", (LPARAM) this, rsOps ? 0 : APPENDROLL_CLOSED); + hOpsPanel = ip->AddRollupPage(hInstance, MAKEINTRESOURCE(IDD_EDPATCH_OPS), PatchOpsDlgProc, _M("Geometry"), (LPARAM) this, rsOps ? 0 : APPENDROLL_CLOSED); // Create sub object editing modes. paintMode = new EPM_PaintCMode(this, ip); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp index 7f6fec25c..59b7897db 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp @@ -7,7 +7,7 @@ #include "nel/3d/texture_mem.h" #include "nel/misc/config_file.h" -#define REGKEY_EDIT_PATCH "Software\\Nevrax\\Ryzom\\edit_patch" +#define REGKEY_EDIT_PATCH _T("Software\\Nevrax\\Ryzom\\edit_patch") /*-------------------------------------------------------------------*/ @@ -318,9 +318,8 @@ void getColors (COLORREF *array) { DWORD len=4; DWORD type; - char regName[100]; - smprintf (regName, 100, "Color%d", i); - RegQueryValueEx (hKey, regName, 0, &type, (LPBYTE)(array+i), &len); + std::string regName = toString("Color%u", i); + RegQueryValueEx (hKey, utf8ToTStr(regName), 0, &type, (LPBYTE)(array+i), &len); } RegCloseKey (hKey); } @@ -337,9 +336,8 @@ void setColors (const COLORREF *array) for (uint i=0; i<16; i++) { DWORD len=4; - char regName[100]; - smprintf (regName, 100, "Color%d", i); - RegSetValueEx (hKey, regName, 0, REG_DWORD, (LPBYTE)(array+i), 4); + std::string regName = toString("Color%u", i); + RegSetValueEx (hKey, utf8ToTStr(regName), 0, REG_DWORD, (LPBYTE)(array+i), 4); } RegCloseKey (hKey); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp index e29b00999..7d0a4a3df 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp @@ -378,7 +378,7 @@ void CPaintColor::setVertexColor (int mesh, int patch, int s, int t, const CRGBA /*-------------------------------------------------------------------*/ -bool CPaintColor::loadBrush (const char *brushFileName) +bool CPaintColor::loadBrush (const std::string &brushFileName) { // Open the file try @@ -401,9 +401,8 @@ bool CPaintColor::loadBrush (const char *brushFileName) else { // Error message - char msg[512]; - smprintf (msg, 512, "Can't open the file %s.", brushFileName); - MessageBox ((HWND)CNELU::Driver->getDisplay(), msg, "NeL Painter", MB_OK|MB_ICONEXCLAMATION); + std::string msg = toString("Can't open the file %s.", brushFileName.c_str()); + MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(msg), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); // Return false return false; @@ -412,7 +411,7 @@ bool CPaintColor::loadBrush (const char *brushFileName) catch (const Exception &e) { // Error message - MessageBox ((HWND)CNELU::Driver->getDisplay(), e.what(), "NeL Painter", MB_OK|MB_ICONEXCLAMATION); + MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); // Return false return false; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.h b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.h index 594d0f5bb..204b36d47 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.h @@ -81,7 +81,7 @@ public: } // Load a brush - bool loadBrush (const char *brushFileName); + bool loadBrush (const std::string &brushFileName); private: diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp index 045d8489d..3d58b8027 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp @@ -41,10 +41,10 @@ class VertexPaintClassDesc :public ClassDesc public: int IsPublic() { return 1; } void * Create(BOOL loading = FALSE) { return new VertexPaint(); } - const TCHAR * ClassName() { return GetString(IDS_CLASS_NAME); } + const MCHAR * ClassName() { return GetString(IDS_CLASS_NAME); } SClass_ID SuperClassID() { return OSM_CLASS_ID; } Class_ID ClassID() { return VERTEX_TREE_PAINT_CLASS_ID; } - const TCHAR* Category() { return GetString(IDS_CATEGORY); } + const MCHAR* Category() { return GetString(IDS_CATEGORY); } void ResetClassParams(BOOL fileReset) {} }; diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h index 510828754..7c751899e 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h @@ -131,7 +131,7 @@ public: void GetClassName(TSTR& s) { s= TSTR(GetString(IDS_CLASS_NAME)); } virtual Class_ID ClassID() { return VERTEX_TREE_PAINT_CLASS_ID;} RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); - TCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } + const MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } IOResult Load(ILoad *iload); IOResult Save(ISave *isave); IOResult LoadLocalData(ILoad *iload, LocalModData **pld); @@ -161,9 +161,7 @@ public: Animatable* SubAnim(int i); TSTR SubAnimName(int i); - RefResult NotifyRefChanged( Interval changeInt,RefTargetHandle hTarget, - PartID& partID, RefMessage message); - + RefResult NotifyRefChanged(const Interval& changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;} void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev); diff --git a/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp b/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp index a024c962c..db1f22b39 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp @@ -85,8 +85,7 @@ class RGBAdd: public Texmap { int RemapRefOnLoad(int iref); RefTargetHandle Clone(RemapDir &remap = DefaultRemapDir()); - RefResult NotifyRefChanged( Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message ); + RefResult NotifyRefChanged(const Interval &changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); // IO IOResult Save(ISave *isave); @@ -107,10 +106,10 @@ class RGBAddClassDesc:public ClassDesc2 { const TCHAR * ClassName() { return GetString(IDS_DS_RGBMULT_CDESC); } // mjm - 2.3.99 SClass_ID SuperClassID() { return TEXMAP_CLASS_ID; } Class_ID ClassID() { return RGBAddClassID; } - const TCHAR* Category() { return TEXMAP_CAT_COMP; } + const MCHAR* Category() { return TEXMAP_CAT_COMP; } // JBW: new descriptor data accessors added. Note that the // internal name is hardwired since it must not be localized. - const TCHAR* InternalName() { return _T("RGBAdd"); } // returns fixed parsable name (scripter-visible name) + const MCHAR* InternalName() { return _M("RGBAdd"); } // returns fixed parsable name (scripter-visible name) HINSTANCE HInstance() { return hInstance; } // returns owning module handle }; @@ -136,36 +135,36 @@ static ParamBlockDesc2 RGBAdd_param_blk ( RGBAdd_params, _T("parameters"), 0, & RGBAdd_color1, _T("color1"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR1, p_default, Color(0,0,0), p_ui, TYPE_COLORSWATCH, IDC_MULT_COL1, - end, + p_end, RGBAdd_color2, _T("color2"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR2, p_default, Color(0.5,0.5,0.5), p_ui, TYPE_COLORSWATCH, IDC_MULT_COL2, - end, + p_end, RGBAdd_map1, _T("map1"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP1, p_refno, 1, p_subtexno, 0, p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX1, - end, + p_end, RGBAdd_map2, _T("map2"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP2, p_refno, 2, p_subtexno, 1, p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX2, - end, + p_end, RGBAdd_map1_on, _T("map1Enabled"), TYPE_BOOL, 0, IDS_JW_MAP1ENABLE, p_default, TRUE, p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON1, - end, + p_end, RGBAdd_map2_on, _T("map2Enabled"), TYPE_BOOL, 0, IDS_JW_MAP2ENABLE, p_default, TRUE, p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON2, - end, + p_end, RGBAdd_type, _T("alphaFrom"), TYPE_INT, 0, IDS_PW_ALPHAFROM, p_default, 2, p_range, 0, 2, p_ui, TYPE_RADIO, 3, IDC_MULT_ALPHA1, IDC_MULT_ALPHA2, IDC_MULT_ALPHA3, - end, + p_end, - end + p_end ); @@ -365,9 +364,10 @@ TSTR RGBAdd::SubAnimName(int i) { } } -RefResult RGBAdd::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, - PartID& partID, RefMessage message ) { - switch (message) { +RefResult RGBAdd::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) +{ + switch (message) + { case REFMSG_CHANGE: ivalid.SetEmpty(); if (hTarget == pblock) diff --git a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp index 37dca5ac9..c77a027a9 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp @@ -75,8 +75,8 @@ class Tile_utilityClassDesc:public ClassDesc2 const TCHAR * ClassName() {return _T("NeL Tile Bank");} SClass_ID SuperClassID() {return UTILITY_CLASS_ID;} Class_ID ClassID() {return TILE_UTILITY_CLASS_ID;} - const TCHAR* Category() {return _T("NeL Tools");} - const TCHAR* InternalName() { return _T("NeL tile bank utility"); } // returns fixed parsable name (scripter-visible name) + const MCHAR* Category() {return _M("NeL Tools");} + const MCHAR* InternalName() { return _M("NeL tile bank utility"); } // returns fixed parsable name (scripter-visible name) HINSTANCE HInstance() { return hInstance; } // returns owning module handle }; @@ -120,7 +120,7 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam, { // Setup version number TCHAR version[512]; - _tcprintf (version, "Version %d.%d.%d.%d", + _stprintf (version, _T("Version %d.%d.%d.%d"), info->dwFileVersionMS>>16, info->dwFileVersionMS&0xffff, info->dwFileVersionLS>>16, @@ -378,9 +378,9 @@ void Tile_utility::SetupUI () // Static text TCHAR sTmp[256]; - _tcprintf (sTmp, "%d diffuse tiles.", Bank.getNumBitmap (CTile::diffuse)); + _stprintf (sTmp, _T("%d diffuse tiles."), Bank.getNumBitmap (CTile::diffuse)); SetWindowText (hwndStatic1, sTmp); - _tcprintf (sTmp, "%d additive tiles.", Bank.getNumBitmap (CTile::additive)); + _stprintf (sTmp, _T("%d additive tiles."), Bank.getNumBitmap (CTile::additive)); SetWindowText (hwndStatic2, sTmp); } else diff --git a/code/nel/tools/3d/tile_edit/Browse.cpp b/code/nel/tools/3d/tile_edit/Browse.cpp index aaaa17a58..89e45c62d 100644 --- a/code/nel/tools/3d/tile_edit/Browse.cpp +++ b/code/nel/tools/3d/tile_edit/Browse.cpp @@ -778,7 +778,7 @@ void Browse::OnCancel() // TODO: Add your control notification handler code here if (thread_actif) return; - if (::MessageBox (NULL, "Are you sure you want to cancel?", "Cancel", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) + if (::MessageBox (NULL, _T("Are you sure you want to cancel?"), _T("Cancel"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) { this->SendMessage(WM_CLOSE); CDialog::OnCancel(); @@ -884,8 +884,7 @@ void Browse::OnChangeVariety() void Browse::OnBatchLoad () { - CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, - "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); + CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL); if (sFile.DoModal()==IDOK) { @@ -896,15 +895,16 @@ void Browse::OnBatchLoad () std::string ext = NLMISC::CFile::getExtension(fullPath); // look for some numbers.. - char *sNumber=sName+strlen(sName)-1; - while ((sNumber>sName)&&(*sNumber>='0')&&(*sNumber<='9')) + std::string::size_type pos = filename.find_last_not_of("0123456789"); + + if (pos != std::string::npos) { - sNumber--; + filename = filename.substr(0, pos + 1); } - sNumber[1]=0; bool rotate=false; - if (::MessageBox (NULL, "Do you want to use rotation to reuse alpha tiles ?", "Import rotated tiles", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) + + if (::MessageBox (NULL, _T("Do you want to use rotation to reuse alpha tiles ?"), _T("Import rotated tiles"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) rotate=true; for (int i=0; isetBorder (m_ctrl.Texture==1?CTile::diffuse:CTile::additive, border); // Message - MessageBox ("The border has been changed.", "Import border", MB_OK|MB_ICONINFORMATION); + MessageBox (_T("The border has been changed."), _T("Import border"), MB_OK|MB_ICONINFORMATION); } } diff --git a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp index eb7738411..15b9a5b7d 100644 --- a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp +++ b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp @@ -361,11 +361,11 @@ void SelectionTerritoire::OnSelect() { POSITION p = sFile.GetStartPosition(); CString str = sFile.GetNextPathName(p); - char *temp = str.GetBuffer(256); - if (temp) + std::string temp = tStrToUtf8(str); + if (!temp.empty()) { CIFile stream; - if (stream.open ((const char*)str)) + if (stream.open (temp)) { list->ResetContent (); list2->ResetContent (); @@ -377,13 +377,13 @@ void SelectionTerritoire::OnSelect() for (i=0; iAddString(tileBank.getLand(i)->getName().c_str()); + list->AddString(utf8ToTStr(tileBank.getLand(i)->getName())); } for (i=0; iAddString(tileBank.getTileSet(i)->getName().c_str()); + list2->AddString(utf8ToTStr(tileBank.getTileSet(i)->getName())); } MainFileName = CString(utf8ToTStr(NLMISC::CFile::getFilename(temp))); @@ -400,7 +400,7 @@ void SelectionTerritoire::OnSelect() button->EnableWindow(true); // Change the bouton text path - GetDlgItem (IDC_PATH)->SetWindowText (tileBank.getAbsPath().c_str()); + GetDlgItem (IDC_PATH)->SetWindowText (utf8ToTStr(tileBank.getAbsPath())); } } diff --git a/code/nel/tools/3d/tile_edit/View.cpp b/code/nel/tools/3d/tile_edit/View.cpp index db4c52828..9a0907aa3 100644 --- a/code/nel/tools/3d/tile_edit/View.cpp +++ b/code/nel/tools/3d/tile_edit/View.cpp @@ -466,7 +466,7 @@ int TileList::setDisplacement (int tile, const std::string& name) // Error: bitmap not in the absolute path.. char msg[512]; sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); - MessageBox (NULL, msg, "Load error", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION); } return 1; @@ -536,7 +536,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot // Error: bitmap not in the absolute path.. char msg[512]; sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); - MessageBox (NULL, msg, "Load error", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION); } return 1; @@ -753,7 +753,7 @@ void CTView::Init(int _land, int n) pImList = new CImageList; pImList->Create(sizetile_x,sizetile_y,ILC_COLOR24,0,1); pImList->Add(bmp,(CBitmap*)NULL); - char *defautpath = ((SelectionTerritoire*)GetParent()->GetParent())->DefautPath.GetBuffer(256); + TCHAR *defautpath = ((SelectionTerritoire*)GetParent()->GetParent())->DefautPath.GetBuffer(256); count_=1; } @@ -1123,8 +1123,8 @@ void CTView::OnDropFiles(HDROP hDropInfo) if (!lockInsertion) { Browse *parent = (Browse*)this->GetParent(); - char FileName[256]; - int count=DragQueryFile(hDropInfo,0xffffffff,FileName,256); //count = files number in drop queue + TCHAR FileName[256]; + int count=DragQueryFile(hDropInfo, 0xffffffff, FileName, 256); //count = files number in drop queue POINT pos; @@ -1138,7 +1138,7 @@ void CTView::OnDropFiles(HDROP hDropInfo) case 0: { int index=InfoList.addTile128 (); - if (InfoList.setTile128 (index, FileName, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) + if (InfoList.setTile128 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) { tilelist::iterator it = InfoList.GetLast(parent->m_128x128); it--; @@ -1152,7 +1152,7 @@ void CTView::OnDropFiles(HDROP hDropInfo) case 1: { int index=InfoList.addTile256 (); - if (InfoList.setTile256 (index, FileName, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) + if (InfoList.setTile256 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) { tilelist::iterator it = InfoList.GetLast(parent->m_128x128); it--; @@ -1527,9 +1527,8 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) else if ((id==ID_MENU_ADD)||(id==ID_MENU_REPLACE)) { _chdir (LastPath.c_str()); - CFileDialog load(true, NULL, LastPath.c_str(), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, - "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); - load.m_ofn.lpstrFile = new char[10000]; // buffer contains filenames list + CFileDialog load(true, NULL, utf8ToTStr(LastPath), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL); + load.m_ofn.lpstrFile = new TCHAR[10000]; // buffer contains filenames list load.m_ofn.lpstrFile[0] = 0; // with 10 KB we should be large enough... // if all files are exceeding 10000 characters, insert would be skipped @@ -1684,10 +1683,10 @@ void CTView::OnRButtonDown(UINT nFlags, CPoint point) if (!ViewTileMode) { - popup.AppendMenu(parent->m_128x128<2 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_ADD,"Add..."); - popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_REPLACE, "Replace..."); - popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_BITMAP, "Del bitmap"); - popup.AppendMenu((c>0 && parent->m_128x128<2) ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_TILE, "Del tile"); + popup.AppendMenu(parent->m_128x128<2 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_ADD, _T("Add...")); + popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_REPLACE, _T("Replace...")); + popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_BITMAP, _T("Del bitmap")); + popup.AppendMenu((c>0 && parent->m_128x128<2) ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_TILE, _T("Del tile")); } else { diff --git a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp index 2d1ca4cbe..a6ca57fd3 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp @@ -434,7 +434,7 @@ void CTile_browser_dlg::on_batchLoadPushButton_clicked() QString batchNumber = transitionNumber.rightJustified(2, '0'); QString nextBaseName = baseName + batchNumber; QString nextFileName = QDir::toNativeSeparators(fi.absolutePath()) + QDir::separator() + nextBaseName + QString(".") + fi.suffix(); - FILE *pFile=fopen (nextFileName.toUtf8().constData(), "rb"); + FILE *pFile = nlfopen (nextFileName.toUtf8().constData(), "rb"); // Close the file and add the tile if opened if (pFile) @@ -471,8 +471,7 @@ void CTile_browser_dlg::on_batchLoadPushButton_clicked() // char sName2[256]; // char sFinal[256]; // sprintf (sName2, "%s%02d", sName, (int)transition); - // _makepath (sFinal, sDrive, sPath, sName2, sExt); - // FILE *pFile=fopen (sFinal, "rb"); + // FILE *pFile = nlfopen (sFinal, "rb"); // // Close the file and add the tile if opened // if (pFile) diff --git a/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp b/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp index b109c2db2..846902cde 100644 --- a/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp +++ b/code/nel/tools/3d/zone_dependencies/zone_dependencies.cpp @@ -522,7 +522,7 @@ int main (int argc, char* argv[]) // Write the dependencies file FILE *outputFile; - if ((outputFile=fopen (toLower (outputFileName).c_str(), "w"))) + if ((outputFile = nlfopen (toLower (outputFileName), "w"))) { // Add a dependency entry fprintf (outputFile, "dependencies =\n{\n"); diff --git a/code/nel/tools/3d/zone_lighter/zone_lighter.cpp b/code/nel/tools/3d/zone_lighter/zone_lighter.cpp index b3c6807c1..c8cf250b3 100644 --- a/code/nel/tools/3d/zone_lighter/zone_lighter.cpp +++ b/code/nel/tools/3d/zone_lighter/zone_lighter.cpp @@ -160,7 +160,7 @@ static void loadIGFromVillage(const NLGEORGES::UFormElm *villageItem, const std: } catch(const NLMISC::Exception &) { - nlwarning ("Error while loading instance group %s\n", igName.c_str()); + nlwarning ("Error while loading instance group %s", igName.c_str()); continue; } inputFile.close(); diff --git a/code/nel/tools/georges/georges2csv/georges2csv.cpp b/code/nel/tools/georges/georges2csv/georges2csv.cpp index 29fb393c9..131e5961c 100644 --- a/code/nel/tools/georges/georges2csv/georges2csv.cpp +++ b/code/nel/tools/georges/georges2csv/georges2csv.cpp @@ -179,7 +179,7 @@ void setOutputFile(const CSString &filename) { if (Outf!=NULL) fclose(Outf); - Outf=fopen(filename.c_str(), "wt"); + Outf = nlfopen(filename.c_str(), "wt"); if (Outf == NULL) { fprintf(stderr, "Can't open output file '%s' ! aborting.", filename.c_str()); diff --git a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp index 594942ddb..f62c0b5b1 100644 --- a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp +++ b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp @@ -131,10 +131,10 @@ void CPlugInSelector::OnSelchangeList1() if ( ! LibInst ) { CString s; - char msg [300]; + TCHAR msg [300]; FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), msg, 299, NULL ); - s.Format( "Can't load %s: %s", dllName, msg ); + s.Format(_T("Can't load %s: %s"), dllName, msg ); AfxMessageBox( s ); AnalyseFunc = NULL; return; @@ -144,7 +144,7 @@ void CPlugInSelector::OnSelchangeList1() TInfoFunc infoFunc = (TInfoFunc)GetProcAddress( LibInst, "getInfoString" ); if ( ! infoFunc ) { - AfxMessageBox( "Can't find function getInfoString in dll" ); + AfxMessageBox( _T("Can't find function getInfoString in dll") ); return; } GetDlgItem( IDC_GROUP_INFO )->SetWindowText( getFilename( string(dllName)).c_str() ); @@ -154,7 +154,7 @@ void CPlugInSelector::OnSelchangeList1() AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" ); if ( ! AnalyseFunc ) { - AfxMessageBox( "Can't find function doAnalyse in dll" ); + AfxMessageBox( _T("Can't find function doAnalyse in dll") ); return; } diff --git a/code/nel/tools/misc/log_analyser/ViewDialog.cpp b/code/nel/tools/misc/log_analyser/ViewDialog.cpp index c750cbd83..0e524ff31 100644 --- a/code/nel/tools/misc/log_analyser/ViewDialog.cpp +++ b/code/nel/tools/misc/log_analyser/ViewDialog.cpp @@ -483,7 +483,7 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) if ( LogSessionStartDate.IsEmpty() ) actualFilenames += ":\r\n"; else - actualFilenames += " for Session of " + LogSessionStartDate + ":\r\n"; + actualFilenames += " for Session of " + tStrToUtf8(LogSessionStartDate) + ":\r\n"; bool corruptionDetectionEnabled = (((CButton*)(((CLog_analyserDlg*)GetParent())->GetDlgItem( IDC_DetectCorruptedLines )))->GetCheck() == 1); HasCorruptedLines = false; vector corruptedLines; diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 306e4dca6..ce8de0e35 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -147,6 +147,10 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR cm int main(int argc, char **argv) #endif { +#if defined(_MSC_VER) && defined(_DEBUG) + _CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#endif + // init the Nel context CApplicationContext *appContext = new CApplicationContext; @@ -403,6 +407,10 @@ int main(int argc, char **argv) quitCrashReport (); #endif // FINAL_VERSION + // delete all logs and displayers when we're not using logs macros anymore + destroyDebug(); + CLog::releaseProcessName(); + // delete the Nel context delete appContext; diff --git a/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp b/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp index 5fe4cc569..ac75afc82 100644 --- a/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp +++ b/code/ryzom/client/src/interface_v3/interface_expr_user_fct_game.cpp @@ -146,12 +146,19 @@ static DECLARE_INTERFACE_USER_FCT(getCompassText) return false; } + // helper + union C64BitsParts + { + sint64 i64; + double d; + }; + //get the direction // sint64 in the databae. - sint64 angleInt= args[0].getInteger(); + C64BitsParts angle; + angle.i64 = args[0].getInteger(); // cast as double now. - double angle= (double&)angleInt; - sint direction =(sint) floor( 0.5 + ( 8.0 * (angle + NLMISC::Pi)/(NLMISC::Pi) ) ); + sint direction =(sint) floor( 0.5 + ( 8.0 * (angle.d + NLMISC::Pi)/(NLMISC::Pi) ) ); direction = ((direction%16)+16)%16; static const string txts[]= { diff --git a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp index 9e7c42888..e639338df 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -1303,12 +1303,12 @@ public: if (pMCM->EditCmd->CurrentEditCmdNb != -1) // Edit mode ? { pMCM->CurrentEditMacro.delCommand(pMCM->EditCmd->CurrentEditCmdNb); - pMCM->CurrentEditMacro.addCommand (pMCM->EditCmd->CurrentEditCmdLine.ActionName.Name.c_str(),pMCM->EditCmd->CurrentEditCmdLine.ActionName.Argu.c_str(), + pMCM->CurrentEditMacro.addCommand (pMCM->EditCmd->CurrentEditCmdLine.ActionName.Name, pMCM->EditCmd->CurrentEditCmdLine.ActionName.Argu, pMCM->EditCmd->CurrentEditCmdNb); } else { - pMCM->CurrentEditMacro.addCommand(pMCM->EditCmd->CurrentEditCmdLine.ActionName.Name.c_str(),pMCM->EditCmd->CurrentEditCmdLine.ActionName.Argu.c_str()); + pMCM->CurrentEditMacro.addCommand(pMCM->EditCmd->CurrentEditCmdLine.ActionName.Name, pMCM->EditCmd->CurrentEditCmdLine.ActionName.Argu); } CAHManager::getInstance()->runActionHandler("new_macro_open", pCaller); pMCM->EditCmd->deactivate(); diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 4636da11f..659844a57 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -143,7 +143,8 @@ CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_st CheckThread = NULL; InstallThread = NULL; ScanDataThread = NULL; - thread = NULL; + DownloadThread = NULL; + Thread = NULL; LogSeparator = "\n"; ValidDescFile = false; @@ -364,7 +365,7 @@ void CPatchManager::startCheckThread(bool includeBackgroundPatch) nlwarning ("check thread is already running"); return; } - if (thread != NULL) + if (Thread != NULL) { nlwarning ("a thread is already running"); return; @@ -375,9 +376,9 @@ void CPatchManager::startCheckThread(bool includeBackgroundPatch) CheckThread = new CCheckThread(includeBackgroundPatch); nlassert (CheckThread != NULL); - thread = IThread::create (CheckThread); - nlassert (thread != NULL); - thread->start (); + Thread = IThread::create (CheckThread); + nlassert (Thread != NULL); + Thread->start (); } // **************************************************************************** @@ -402,11 +403,11 @@ bool CPatchManager::isCheckThreadEnded(bool &ok) // **************************************************************************** void CPatchManager::stopCheckThread() { - if(CheckThread && thread) + if(CheckThread && Thread) { - thread->wait(); - delete thread; - thread = NULL; + Thread->wait(); + delete Thread; + Thread = NULL; delete CheckThread; CheckThread = NULL; } @@ -534,7 +535,7 @@ void CPatchManager::startPatchThread(const vector &CategoriesSelected, b nlwarning ("check thread is already running"); return; } - if (thread != NULL) + if (Thread != NULL) { nlwarning ("a thread is already running"); return; @@ -622,9 +623,9 @@ void CPatchManager::startPatchThread(const vector &CategoriesSelected, b } // Launch the thread - thread = IThread::create (PatchThread); - nlassert (thread != NULL); - thread->start (); + Thread = IThread::create (PatchThread); + nlassert (Thread != NULL); + Thread->start (); } // **************************************************************************** @@ -685,11 +686,11 @@ bool CPatchManager::getThreadState (ucstring &stateOut, vector &stateL // **************************************************************************** void CPatchManager::stopPatchThread() { - if(PatchThread && thread) + if(PatchThread && Thread) { - thread->wait(); - delete thread; - thread = NULL; + Thread->wait(); + delete Thread; + Thread = NULL; delete PatchThread; PatchThread = NULL; } @@ -1944,7 +1945,7 @@ void CPatchManager::startScanDataThread() nlwarning ("scan data thread is already running"); return; } - if (thread != NULL) + if (Thread != NULL) { nlwarning ("a thread is already running"); return; @@ -1962,9 +1963,9 @@ void CPatchManager::startScanDataThread() ScanDataThread = new CScanDataThread(); nlassert (ScanDataThread != NULL); - thread = IThread::create (ScanDataThread); - nlassert (thread != NULL); - thread->start (); + Thread = IThread::create (ScanDataThread); + nlassert (Thread != NULL); + Thread->start (); } // **************************************************************************** @@ -1989,11 +1990,11 @@ bool CPatchManager::isScanDataThreadEnded(bool &ok) // **************************************************************************** void CPatchManager::stopScanDataThread() { - if(ScanDataThread && thread) + if(ScanDataThread && Thread) { - thread->wait(); - delete thread; - thread = NULL; + Thread->wait(); + delete Thread; + Thread = NULL; delete ScanDataThread; ScanDataThread = NULL; } @@ -3044,18 +3045,18 @@ IAsyncDownloader* CPatchManager::getAsyncDownloader() const // **************************************************************************** void CPatchManager::startInstallThread(const std::vector& entries) { - CInstallThread* installThread = new CInstallThread(entries); - thread = IThread::create (installThread); - nlassert (thread != NULL); - thread->start (); + InstallThread = new CInstallThread(entries); + Thread = IThread::create (InstallThread); + nlassert (Thread != NULL); + Thread->start (); } void CPatchManager::startDownloadThread(const std::vector& entries) { - CDownloadThread* downloadThread = new CDownloadThread(entries); - thread = IThread::create (downloadThread); - nlassert (thread != NULL); - thread->start (); + DownloadThread = new CDownloadThread(entries); + Thread = IThread::create (DownloadThread); + nlassert (Thread != NULL); + Thread->start (); } diff --git a/code/ryzom/client/src/login_patch.h b/code/ryzom/client/src/login_patch.h index 1de6f03f0..0daf83b46 100644 --- a/code/ryzom/client/src/login_patch.h +++ b/code/ryzom/client/src/login_patch.h @@ -238,7 +238,7 @@ public: CProductDescriptionForClient &getDescFile() { return DescFile; } - NLMISC::IThread *getCurrThread() const { return thread; } + NLMISC::IThread *getCurrThread() const { return Thread; } // set an external state listener (enable to log) infos void setStateListener(IPatchManagerStateListener* stateListener); @@ -410,7 +410,8 @@ private: CCheckThread *CheckThread; CScanDataThread *ScanDataThread; CInstallThread *InstallThread; - NLMISC::IThread *thread; + CDownloadThread *DownloadThread; + NLMISC::IThread *Thread; // State struct CState diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index a1e8c66cb..6e90d2d3d 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -603,7 +603,7 @@ void release() // Delete the driver. delete Driver; - Driver = 0; + Driver = NULL; } NetMngr.getConnection().close(); @@ -663,6 +663,7 @@ void release() CLuaManager::releaseInstance(); NLGUI::CDBManager::release(); CWidgetManager::release(); + CViewRenderer::release(); #if FINAL_VERSION // openURL ("http://ryzom.com/exit/"); diff --git a/code/ryzom/client/src/session_browser.cpp b/code/ryzom/client/src/session_browser.cpp index 4cae87fee..46ef37a0a 100644 --- a/code/ryzom/client/src/session_browser.cpp +++ b/code/ryzom/client/src/session_browser.cpp @@ -119,6 +119,7 @@ CSessionBrowser::~CSessionBrowser() _CommThread->wait(); // ok, we can leave + delete _CommThread; } /** Set auth info */ diff --git a/code/ryzom/common/src/game_share/inventories.h b/code/ryzom/common/src/game_share/inventories.h index 3d2bbae90..ef093bd2b 100644 --- a/code/ryzom/common/src/game_share/inventories.h +++ b/code/ryzom/common/src/game_share/inventories.h @@ -412,13 +412,18 @@ private: struct COneProp { - TItemPropId ItemPropId; + union + { + TItemPropId ItemPropId; + uint32 ItemPropIdUint32; + }; + sint32 ItemPropValue; void serial( NLMISC::CBitMemStream& bms ) { - bms.serial( (uint32&)ItemPropId, NbBitsForItemPropId ); - bms.serial( (uint32&)ItemPropValue, CItemSlot::DataBitSize[ItemPropId] ); + bms.serial((uint32&)ItemPropIdUint32, NbBitsForItemPropId); + bms.serial((uint32&)ItemPropValue, CItemSlot::DataBitSize[ItemPropId]); } }; diff --git a/code/ryzom/common/src/game_share/persistent_data_inline.h b/code/ryzom/common/src/game_share/persistent_data_inline.h index a2d575eef..9c7b46522 100644 --- a/code/ryzom/common/src/game_share/persistent_data_inline.h +++ b/code/ryzom/common/src/game_share/persistent_data_inline.h @@ -18,6 +18,20 @@ // inlines CPersistentDataRecord //----------------------------------------------------------------------------- +union C64BitParts +{ + struct + { + uint32 i32_1; + uint32 i32_2; + }; + + sint64 s64; + uint64 u64; + double d; + float f; +}; + inline void CPersistentDataRecord::addString(const std::string& name,uint16 &result) { // check whether the value of 'result' is already correct @@ -96,11 +110,8 @@ inline void CPersistentDataRecord::push(TToken token,sint32 val) inline void CPersistentDataRecord::push(TToken token,sint64 val) { // create a union for splitting the i64 value into 2 32bit parts and map the union onto the input value - struct C64BitParts - { - uint32 i32_1; - uint32 i32_2; - } &valueInBits= *(C64BitParts*)&val; + C64BitParts valueInBits; + valueInBits.s64 = val; // make sure the token is valid #ifdef NL_DEBUG @@ -153,11 +164,8 @@ inline void CPersistentDataRecord::push(TToken token,uint32 val) inline void CPersistentDataRecord::push(TToken token,uint64 val) { // create a union for splitting the i64 value into 2 32bit parts and map the union onto the input value - struct C64BitParts - { - uint32 i32_1; - uint32 i32_2; - } &valueInBits= *(C64BitParts*)&val; + C64BitParts valueInBits; + valueInBits.u64 = val; // make sure the token is valid #ifdef NL_DEBUG @@ -173,6 +181,9 @@ inline void CPersistentDataRecord::push(TToken token,uint64 val) inline void CPersistentDataRecord::push(TToken token,float val) { + C64BitParts valueInBits; + valueInBits.f = val; + // make sure the token is valid #ifdef NL_DEBUG BOMB_IF( ((token<<3)>>3)!= token, "Invalid token - Insufficient numeric precision", return); @@ -180,17 +191,14 @@ inline void CPersistentDataRecord::push(TToken token,float val) // store the token and value to the relavent data buffers _TokenTable.push_back((token<<3)+CArg::FLOAT_TOKEN); - _ArgTable.push_back(*(sint32*)&val); + _ArgTable.push_back(valueInBits.i32_1); } inline void CPersistentDataRecord::push(TToken token,double val) { // create a union for splitting the i64 value into 2 32bit parts and map the union onto the input value - struct C64BitParts - { - uint32 i32_1; - uint32 i32_2; - } &valueInBits= *(C64BitParts*)&val; + C64BitParts valueInBits; + valueInBits.d = val; // make sure the token is valid #ifdef NL_DEBUG diff --git a/code/ryzom/common/src/game_share/persistent_data_template.h b/code/ryzom/common/src/game_share/persistent_data_template.h index ce5cd485c..2587c3864 100644 --- a/code/ryzom/common/src/game_share/persistent_data_template.h +++ b/code/ryzom/common/src/game_share/persistent_data_template.h @@ -359,7 +359,7 @@ void PERSISTENT_CLASS::store(CPersistentDataRecord &pdr _PERSISTENT_STORE_ARGS) // this class has been configured to use a specific token family. This means that it is not possible // to store the class to a pdr that is not using the same token family. BOMB_IF(pdr.getTokenFamily()!=NL_MACRO_TO_STR(PERSISTENT_TOKEN_FAMILY), - NL_MACRO_TO_STR(PERSISTENT_CLASS)"::store() requires token family '"NL_MACRO_TO_STR(PERSISTENT_TOKEN_FAMILY)"'" + NL_MACRO_TO_STR(PERSISTENT_CLASS) "::store() requires token family '" NL_MACRO_TO_STR(PERSISTENT_TOKEN_FAMILY) "'" " but pdr is using token family '"+pdr.getTokenFamily()+"'", return); #endif diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index fbeb5516f..f16d7c9d8 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -1002,30 +1002,38 @@ IPrimitive* CServerAnimationModule::getAction(CObject* action, const std::string if(param.splitLines(result) ) { - if (result.size() == 0) - { - nlwarning("ERROR: npc_say but no parameters !!! %d in session ", scenarioId.asInt()); - } + std::vector res; - if(result.size()>=1) + if (result.empty()) { - NLMISC::CSString name(result[0]); - if(name.find(":",0)!=string::npos) - { - result[0] = prefix+result[0]; - } + nlwarning("ERROR: npc_say but no parameters !!! %u in session ", scenarioId.asInt()); } - - if(result.size()>=2) - result[1] = "DSS_"+toString(scenarioId)+" "+result[1].c_str(); - if(result.size()>=3) + else { - for(uint32 i=2;i= 1) { - result[i] = prefix + result[i]; + std::string name(result[0]); + + if (name.find(":", 0) != string::npos) + { + res[0] = prefix + name; + } + + if (result.size() >= 2) + { + res[1] = toString("DSS_%u %s", scenarioId.asInt(), result[1].c_str()); + + for (uint32 i = 2, len = result.size(); iaddPropertyByName("parameters", new CPropertyStringArray( (std::vector &)result )); + + pAction->addPropertyByName("parameters", new CPropertyStringArray(res)); } } diff --git a/code/ryzom/common/src/game_share/utils.h b/code/ryzom/common/src/game_share/utils.h index 96099a466..c4c0fe26f 100644 --- a/code/ryzom/common/src/game_share/utils.h +++ b/code/ryzom/common/src/game_share/utils.h @@ -320,7 +320,7 @@ inline ucstring capitalize(const ucstring & s) public:\ virtual void displayEntry(NLMISC::CLog& log) const\ {\ - log.displayNL(">>"__FILE__":%d",__LINE__);\ + log.displayNL(">>" __FILE__ ":%d", __LINE__);\ }\ }\ __callStackEntry##__LINE__; @@ -331,7 +331,7 @@ inline ucstring capitalize(const ucstring & s) public:\ virtual void displayEntry(NLMISC::CLog& log) const\ {\ - log.displayNL(">>"__FILE__":%d: %s",__LINE__,msg);\ + log.displayNL(">>" __FILE__ ":%d: %s", __LINE__,msg);\ }\ }\ __callStackEntry##__LINE__; @@ -345,7 +345,7 @@ inline ucstring capitalize(const ucstring & s) }\ virtual void displayEntry(NLMISC::CLog& log) const\ {\ - log.displayNL(">>"__FILE__":%d: %s=[%s]",__LINE__,#var,NLMISC::toString(_Val).c_str());\ + log.displayNL(">>" __FILE__ ":%d: %s=[%s]", __LINE__, #var, NLMISC::toString(_Val).c_str());\ }\ const type _Val;\ }\ @@ -360,7 +360,7 @@ inline ucstring capitalize(const ucstring & s) }\ virtual void displayEntry(NLMISC::CLog& log) const\ {\ - log.displayNL(">>"__FILE__":%d: %s=>[%s]",__LINE__,#var,NLMISC::toString(_Var).c_str());\ + log.displayNL(">>" __FILE__ ":%d: %s=>[%s]", __LINE__, #var, NLMISC::toString(_Var).c_str());\ }\ const type& _Var;\ }\ diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp index e97043a9d..29cd11892 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp @@ -49,7 +49,7 @@ using namespace std; NLMISC_COMMAND( forceMissionProgress,"debug command used to trigger debug commands","" ) { - if (args.empty() || args.size() > 3) + if (args.size() != 1) return false; CEntityId id; id.fromString( args[0].c_str() ); @@ -530,7 +530,7 @@ NLMISC_COMMAND(removeMission,"Remove mission of character"," ") { diff --git a/code/ryzom/server/src/entities_game_service/player_manager/admin_properties.cpp b/code/ryzom/server/src/entities_game_service/player_manager/admin_properties.cpp index 9f7589408..b455ec368 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/admin_properties.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/admin_properties.cpp @@ -78,26 +78,27 @@ void CAdminProperties::updateCSRJournal( CCharacter * user, CMission * mission,u ///TODO NICO test no list } -CMission * CAdminProperties::getMission( uint indexInJournal ) const +CMission* CAdminProperties::getMission(uint indexInJournal) const { - /// todo mission - /* - if ( !_Data ) return NULL; - CCharacter * user = PlayerManager.getChar( _Data->MissionUser ); - if ( !user ) + if (!_Data) return NULL; + + CCharacter *user = PlayerManager.getChar(_Data->MissionUser); + if (!user) return NULL; - - CMission * mission = NULL; - if ( indexInJournal < user->getMissions().size() ) - return (CMission*) user->getMissions()[indexInJournal]; - indexInJournal-= MaxSoloMissionCount; + CMission *mission = NULL; + if (indexInJournal < user->getMissions().size()) + return (CMission*)user->getMissions()[indexInJournal]; + +/* + indexInJournal -= MaxSoloMissionCount; CTeam * team = TeamManager.getTeam( user->getTeamId() ); - if (team ) + if (team) { if ( indexInJournal < team->getMissions().size() ) return (CMission*) team->getMissions()[indexInJournal]; - } + } + indexInJournal-= ( MaxGroupMissionCount); CGuild * guild = user->getGuild(); if (guild ) @@ -105,6 +106,6 @@ CMission * CAdminProperties::getMission( uint indexInJournal ) const if ( indexInJournal < guild->getMissions().size() ) return(CMission*) guild->getMissions()[indexInJournal]; } - */ +*/ return NULL; } diff --git a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp index 7d1f58e55..a2cf3c559 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp @@ -254,10 +254,10 @@ void CBaseDialog::onOpenSelected() void CBaseDialog::registerLastControl () { RECT rect = {0, 0, 0, 0}; - DummyStatic0.Create ("Coucou", WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 30); + DummyStatic0.Create (_T("Coucou"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 30); DummyStatic0.Dlg = this; DummyStatic0.Index = 0; - DummyStatic1.Create ("Coucou", WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 31); + DummyStatic1.Create (_T("Coucou"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 31); DummyStatic1.Dlg = this; DummyStatic1.Index = 1; } diff --git a/code/ryzom/tools/leveldesign/georges_dll/color_wnd.cpp b/code/ryzom/tools/leveldesign/georges_dll/color_wnd.cpp index 9be44082e..3d401d9be 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/color_wnd.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/color_wnd.cpp @@ -78,7 +78,7 @@ void CColorWnd::create (DWORD wStyle, RECT &pos, CWnd *parent, uint dialogIndex) LPCTSTR className = AfxRegisterWndClass(CS_DBLCLKS); // Create this window - if (CWnd::Create (className, "empty", wStyle, pos, parent, dialogIndex)) + if (CWnd::Create (className, _T("empty"), wStyle, pos, parent, dialogIndex)) { } } @@ -118,8 +118,8 @@ void CColorWnd::setColor (const NLMISC::CRGBA &color) { Color = color; - char buffer[256]; - sprintf(buffer, "%d,%d,%d", Color.R, Color.G, Color.B); + CString buffer; + buffer.Format(_T("%d,%d,%d"), (int)Color.R, (int)Color.G, (int)Color.B); SetWindowText(buffer); Invalidate (); @@ -160,8 +160,8 @@ void CColorWnd::colorChanged () updateEdit(); Invalidate (); - char buffer[256]; - sprintf(buffer, "%d,%d,%d", Color.R, Color.G, Color.B); + CString buffer; + buffer.Format(_T("%d,%d,%d"), (int)Color.R, (int)Color.G, (int)Color.B); SetWindowText(buffer); CWnd *wnd = GetParent (); @@ -174,7 +174,7 @@ void CColorWnd::colorChanged () void CColorWnd::updateEdit() { - char buffer[256]; - sprintf(buffer, "%d,%d,%d", Color.R, Color.G, Color.B); + CString buffer; + buffer.Format(_T("%d,%d,%d"), (int)Color.R, (int)Color.G, (int)Color.B); pEdit->SetWindowText(buffer); } \ No newline at end of file diff --git a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp index 3c12eb254..22c556faa 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp @@ -96,7 +96,7 @@ BOOL CDfnDialog::OnInitDialog() setListSize (currentPos, SmallWidget, ParentHeight); Parents.create (WS_TABSTOP, currentPos, this, LtParents); - Parents.insertColumn (0, "Parent Dfn"); + Parents.insertColumn (0, _T("Parent Dfn")); Parents.Dialog = this; Parents.recalcColumn (); initWidget (Parents); @@ -111,11 +111,11 @@ BOOL CDfnDialog::OnInitDialog() setListSize (currentPos, Width, DfnHeight); Struct.create (WS_TABSTOP, currentPos, this, LtStruct); - Struct.insertColumn (0, "Name"); - Struct.insertColumn (1, "Type"); - Struct.insertColumn (2, "Value"); - Struct.insertColumn (3, "Default"); - Struct.insertColumn (4, "FilenameExt"); + Struct.insertColumn (0, _T("Name")); + Struct.insertColumn (1, _T("Type")); + Struct.insertColumn (2, _T("Value")); + Struct.insertColumn (3, _T("Default")); + Struct.insertColumn (4, _T("FilenameExt")); Struct.Dialog = this; Struct.recalcColumn (); initWidget (Struct); @@ -342,7 +342,7 @@ void CDfnEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string if (subItem == 0) { browse = false; - regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Label MemCombo"; + regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Label MemCombo")); } else if (subItem == 2) { @@ -351,19 +351,19 @@ void CDfnEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string // Get type string string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); if ((type == "Type") || (type == "Type array")) - regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Type MemCombo"; + regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Type MemCombo")); else if ((type == "Dfn") || (type == "Dfn array")) - regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Dfn MemCombo"; + regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Dfn MemCombo")); } else if (subItem == 3) { browse = false; - regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Default MemCombo"; + regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Default MemCombo")); } else if (subItem == 3) { browse = false; - regAdr = GEORGES_EDIT_BASE_REG_KEY"\\FilenameExt MemCombo"; + regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\FilenameExt MemCombo")); } } @@ -609,7 +609,7 @@ CEditListCtrl::TItemEdit CDfnParentEditListCtrl::getItemEditMode (uint item, uin void CDfnParentEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string ®Adr, bool &browse) { browse = true; - regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Dfn MemCombo"; + regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Dfn MemCombo")); } // *************************************************************************** diff --git a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp index aac663c1f..4efdf0c16 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp @@ -45,7 +45,7 @@ bool CEditListCtrl::create (DWORD wStyle, RECT &rect, CWnd *parent, uint dialog_ LPCTSTR className = AfxRegisterWndClass( 0 ); // Create this window - if (CWnd::Create (className, "empty", WS_CHILD|wStyle, rect, parent, dialog_index)) + if (CWnd::Create (className, _T("empty"), WS_CHILD|wStyle, rect, parent, dialog_index)) { RECT subRect; subRect.left = 0; @@ -122,11 +122,11 @@ BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) // Insert an item at the end string text; getNewItemText (ListCtrl.GetItemCount (), 0, text); - ListCtrl.InsertItem (ListCtrl.GetItemCount (), text.c_str ()); + ListCtrl.InsertItem (ListCtrl.GetItemCount (), utf8ToTStr(text)); for (uint i=1; igetBrowseInfo (Ctrl->Item, Ctrl->SubItem, defExt, defFilename, defDir, filter); - CFileDialog dlgFile (TRUE, defExt.c_str (), defFilename.c_str (), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter.c_str (), theApp.m_pMainWnd); - dlgFile.m_ofn.lpstrInitialDir = defDir.c_str (); + TCHAR buffer[MAX_PATH]; + _tcscpy(buffer, utf8ToTStr(defDir)); + + CFileDialog dlgFile (TRUE, utf8ToTStr(defExt), utf8ToTStr(defFilename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, utf8ToTStr(filter), theApp.m_pMainWnd); + dlgFile.m_ofn.lpstrInitialDir = buffer; Ctrl->OnBrowse = true; if (dlgFile.DoModal () == IDOK) { @@ -431,7 +434,7 @@ void CEditListCtrl::editItem (uint item, uint subitem) { // Move the editbox Edit.SetWindowPos (NULL, subItemRect.left, subItemRect.top, subItemRect.right-subItemRect.left, subItemRect.bottom-subItemRect.top, SWP_SHOWWINDOW); - char tmp[512]; + TCHAR tmp[512]; ListCtrl.GetItemText (Item, SubItem, tmp, 512); Edit.SetWindowText (tmp); Edit.SetSel( 0, -1); @@ -440,7 +443,7 @@ void CEditListCtrl::editItem (uint item, uint subitem) else if (editMode == EditFixedCombo) { // Get item string - char tmp[512]; + TCHAR tmp[512]; ListCtrl.GetItemText (Item, SubItem, tmp, 512); // Get the combo string @@ -450,8 +453,8 @@ void CEditListCtrl::editItem (uint item, uint subitem) getComboBoxStrings (Item, SubItem, retStrings); for (uint i=0; iInsertItem (0, "Type"); - TabFile->InsertItem (1, "Dfn"); + TabFile->InsertItem (0, _T("Type")); + TabFile->InsertItem (1, _T("Dfn")); tabCount += 2; TreeCtrlType.create( sz, TabFile, 0); @@ -96,7 +96,7 @@ BOOL CFileBrowserDialog::OnInitDialog() TreeCtrlDfn.setNotifyWindow (m_hWnd, 1); } - TabFile->InsertItem (tabCount, "Form"); + TabFile->InsertItem (tabCount, _T("Form")); TabFile->SetCurSel (tabCount); TreeCtrlForm.create( sz, TabFile, 2); @@ -279,7 +279,7 @@ void CFileBrowserDialog::openDocument () string pathName = CPath::lookup (filename.c_str (), false, false); if (pathName.empty ()) pathName = filename; - theApp.OpenDocumentFile (pathName.c_str()); + theApp.OpenDocumentFile (utf8ToTStr(pathName)); } } else if (IsWindow (TreeCtrlType) && TreeCtrlDfn.IsWindowVisible ()) @@ -289,7 +289,7 @@ void CFileBrowserDialog::openDocument () string pathName = CPath::lookup (filename.c_str (), false, false); if (pathName.empty ()) pathName = filename; - theApp.OpenDocumentFile (pathName.c_str()); + theApp.OpenDocumentFile (utf8ToTStr(pathName)); } } else if (TreeCtrlForm.IsWindowVisible ()) @@ -299,7 +299,7 @@ void CFileBrowserDialog::openDocument () string pathName = CPath::lookup (filename.c_str (), false, false); if (pathName.empty ()) pathName = filename; - theApp.OpenDocumentFile (pathName.c_str()); + theApp.OpenDocumentFile (utf8ToTStr(pathName)); } } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp b/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp index fac4cb052..3a0616fe1 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp @@ -441,11 +441,11 @@ bool CFileTreeCtrl::enumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolde pParentFolder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidl, &pItemInfo->dwFlags); // Convert display name in file system path - char name[MAX_PATH]; + TCHAR name[MAX_PATH]; nlverify ( SHGetPathFromIDList ( pidl, name ) ); // Save it - pItemInfo->displayName = name; + pItemInfo->displayName = tStrToUtf8(name); // Is a folder ? bool folder = (pItemInfo->dwFlags&SFGAO_FOLDER) !=0; @@ -720,7 +720,7 @@ bool CFileTreeCtrl::getCurrentFilename (std::string &result) if (curSel) { CString str = _TreeCtrl.GetItemText (curSel); - result = str; + result = tStrToUtf8(str); return true; } return false; diff --git a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp index 76421972b..25d10f9d2 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp @@ -770,7 +770,7 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam) colorEdit->Edit.GetWindowText (str); sint r, g, b; - if (sscanf (str, "%d,%d,%d", &r, &g, &b) == 3) + if (_stscanf (str, _T("%d,%d,%d"), &r, &g, &b) == 3) { clamp (r, 0, 255); clamp (g, 0, 255); @@ -1352,18 +1352,18 @@ void IFormWidget::updateLabel () if (node->getForm () == doc->getFormPtr ()) { // The node exist - Label.SetWindowText (SavedLabel.c_str()); + Label.SetWindowText (utf8ToTStr(SavedLabel)); } else { // The node exist in the parent form - Label.SetWindowText ((SavedLabel+" (in parent form)").c_str()); + Label.SetWindowText (utf8ToTStr(SavedLabel + " (in parent form)")); } } else { // The node is empty - Label.SetWindowText ((SavedLabel+" (undefined)").c_str()); + Label.SetWindowText (utf8ToTStr(SavedLabel + " (undefined)")); } } @@ -1509,10 +1509,10 @@ void IFormWidget::onOpenSelected () string str; getValue (str); - std::string str2=CPath::lookup (str.c_str (), false, false); + std::string str2 = CPath::lookup (str, false, false); if (str2.empty()) - str2 = str.c_str (); - theApp.OpenDocumentFile (str2.c_str ()); + str2 = str; + theApp.OpenDocumentFile (utf8ToTStr(str2)); } // *************************************************************************** diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp index d11e33a5a..1860096aa 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp @@ -74,10 +74,10 @@ CGeorgesEditApp::CGeorgesEditApp() : MemStream (false, false, 1024*1024) ExeStandalone = false; StartExpanded = true; - FormClipBoardFormatStruct = RegisterClipboardFormat ("GeorgesFormStruct"); - FormClipBoardFormatVirtualStruct = RegisterClipboardFormat ("GeorgesFormVirtualStruct"); - FormClipBoardFormatArray = RegisterClipboardFormat ("GeorgesFormArray"); - FormClipBoardFormatType = RegisterClipboardFormat ("GeorgesFormType"); + FormClipBoardFormatStruct = RegisterClipboardFormat (_T("GeorgesFormStruct")); + FormClipBoardFormatVirtualStruct = RegisterClipboardFormat (_T("GeorgesFormVirtualStruct")); + FormClipBoardFormatArray = RegisterClipboardFormat (_T("GeorgesFormArray")); + FormClipBoardFormatType = RegisterClipboardFormat (_T("GeorgesFormType")); nlassert (FormClipBoardFormatStruct); nlassert (FormClipBoardFormatVirtualStruct); nlassert (FormClipBoardFormatArray); @@ -159,7 +159,7 @@ BOOL CGeorgesEditApp::initInstance (int nCmdShow, bool exeStandalone, int x, int if (!isInitialized && exeStandalone) { m_nCmdShow = nCmdShow; - ExePath = GetCommandLine (); + ExePath = tStrToUtf8(GetCommandLine ()); if (ExePath.size()>0) { if (ExePath[0] == '\"') @@ -673,11 +673,11 @@ bool CGeorgesEditApp::getColor (NLMISC::CRGBA &color) // Get custom colors COLORREF arrayColor[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; HKEY hKey; - if (RegOpenKeyEx(HKEY_CURRENT_USER, GEORGES_EDIT_BASE_REG_KEY"\\Custom Colors", 0, KEY_READ, &hKey)==ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T(GEORGES_EDIT_BASE_REG_KEY "\\Custom Colors"), 0, KEY_READ, &hKey)==ERROR_SUCCESS) { DWORD len=sizeof(arrayColor); DWORD type; - RegQueryValueEx (hKey, "", 0, &type, (LPBYTE)(arrayColor), &len); + RegQueryValueEx (hKey, _T(""), 0, &type, (LPBYTE)(arrayColor), &len); RegCloseKey (hKey); } @@ -698,9 +698,9 @@ bool CGeorgesEditApp::getColor (NLMISC::CRGBA &color) // Save the custom colors HKEY hKey; - if (RegCreateKey(HKEY_CURRENT_USER, GEORGES_EDIT_BASE_REG_KEY"\\Custom Colors", &hKey)==ERROR_SUCCESS) + if (RegCreateKey(HKEY_CURRENT_USER, _T(GEORGES_EDIT_BASE_REG_KEY "\\Custom Colors"), &hKey)==ERROR_SUCCESS) { - RegSetValueEx (hKey, "", 0, REG_BINARY, (LPBYTE)(arrayColor), sizeof(arrayColor)); + RegSetValueEx (hKey, _T(""), 0, REG_BINARY, (LPBYTE)(arrayColor), sizeof(arrayColor)); RegCloseKey (hKey); } return true; @@ -711,9 +711,9 @@ bool CGeorgesEditApp::getColor (NLMISC::CRGBA &color) bool CGeorgesEditApp::yesNo (const char* message) { if (m_pMainWnd) - return m_pMainWnd->MessageBox (message, "Georges Edit", MB_YESNO|MB_ICONQUESTION) != IDNO; + return m_pMainWnd->MessageBox (message, _T("Georges Edit"), MB_YESNO|MB_ICONQUESTION) != IDNO; else - return MessageBox (NULL, message, "Georges Edit", MB_YESNO|MB_ICONQUESTION) != IDNO; + return MessageBox (NULL, message, _T("Georges Edit"), MB_YESNO|MB_ICONQUESTION) != IDNO; } void CGeorgesEditApp::loadPlugins () @@ -722,7 +722,7 @@ void CGeorgesEditApp::loadPlugins () for (i=0; igetChild (i); int image = child->getItemImage (doc); - TabCtrl.InsertItem (i, child->getName ().c_str(), image); + TabCtrl.InsertItem (i, utf8ToTStr(child->getName()), image); // This is the selection ? if (subObject == child) diff --git a/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp b/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp index 949c084d6..7380a3d31 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp @@ -157,7 +157,7 @@ void CMemoryComboBox::pushString (const std::string &str) if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) { // Set the value - RegSetValue (hKey, "0", REG_SZ, str.c_str (), str.size ()); + RegSetValue (hKey, _T("0"), REG_SZ, str.c_str (), str.size ()); // Close RegCloseKey (hKey); @@ -366,14 +366,14 @@ void CMemoryComboBox::pushString () { CString str; GetWindowText (str); - if (str != "") + if (!str.IsEmpty()) { // Look for an existing static uint i; for (i=0; i0) { _ComboBox.GetLBText( i, value); - if (value == (const char*)str) + if (value == str) break; } } @@ -443,7 +443,7 @@ void CMemoryComboBox::refreshStrings () int count = Commands.size(); for (i=0; i diff --git a/code/ryzom/tools/leveldesign/prim_export/main.cpp b/code/ryzom/tools/leveldesign/prim_export/main.cpp index f9c33d953..be875b350 100644 --- a/code/ryzom/tools/leveldesign/prim_export/main.cpp +++ b/code/ryzom/tools/leveldesign/prim_export/main.cpp @@ -1115,7 +1115,7 @@ int main (int argc, char**argv) outString ("REMOVE " + CFile::getFilename (igFilename) + " \n"); // Remove it - if (remove (igFilename.c_str ()) != 0) + if (!CFile::deleteFile(igFilename)) { // Error in the log nlwarning ("Error : Can't remove the file (%s)", igFilename.c_str ()); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp index 531b58e89..09756ddbf 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp @@ -466,7 +466,7 @@ void CMemoryComboBox::refreshStrings () // *************************************************************************** -void CMemoryComboBox::setRegisterAdress (const char *registerAdress) +void CMemoryComboBox::setRegisterAdress(const std::string ®isterAdress) { RegisterAdress = registerAdress; refreshStrings (); @@ -474,7 +474,7 @@ void CMemoryComboBox::setRegisterAdress (const char *registerAdress) // *************************************************************************** -void CMemoryComboBox::addCommand (const char* commandLabel, uint commandId) +void CMemoryComboBox::addCommand(const std::string &commandLabel, uint commandId) { Commands.push_back (CCommand ()); Commands[Commands.size()-1].Label = commandLabel; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.h b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.h index 8199358aa..768ddfa90 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.h @@ -47,9 +47,9 @@ public: void onCancel (); void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const TCHAR *registerAdress, int memoryCount); void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId); - void setRegisterAdress (const char *registerAdress); + void setRegisterAdress(const std::string ®isterAdress); void clearCommand (); - void addCommand (const char* commandLabel, uint commandId); + void addCommand (const std::string &commandLabel, uint commandId); void clearStaticStrings (); void addStaticStrings (const char* strings); uint getCommandCount () const; diff --git a/code/ryzom/tools/stats_scan/character_scan_job.cpp b/code/ryzom/tools/stats_scan/character_scan_job.cpp index 4ee45f037..47593ba81 100644 --- a/code/ryzom/tools/stats_scan/character_scan_job.cpp +++ b/code/ryzom/tools/stats_scan/character_scan_job.cpp @@ -52,7 +52,7 @@ CCharacterScanJob::CCharacterScanJob() // open the output file for the character table std::string filename= "char_tbl.csv"; - _CharTblFile=fopen(filename.c_str(),"wb"); + _CharTblFile = nlfopen(filename, "wb"); if (_CharTblFile==NULL) { nlwarning("Failed to open output file: %s",filename.c_str()); @@ -73,7 +73,7 @@ CCharacterScanJob::~CCharacterScanJob() { // create the output file name and open the file for writing std::string filename="char_stats_"+(*it).first+".csv"; - FILE* f=fopen(filename.c_str(),"wb"); + FILE* f = nlfopen(filename, "wb"); if (f==NULL) { nlwarning("Failed to open output file: %s",filename.c_str()); diff --git a/dist/snap/setup/gui/ryzom.desktop b/dist/snap/setup/gui/ryzom.desktop new file mode 100644 index 000000000..039a43d76 --- /dev/null +++ b/dist/snap/setup/gui/ryzom.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Name=Ryzom +Type=Application +GenericName=ryzom +Exec=ryzom.ryzom +Icon=${SNAP}/meta/gui/ryzom.png +Terminal=false +Hidden=false +Keywords=ryzom,mmorpg,game +Categories=Game;RolePlaying; diff --git a/dist/snap/setup/gui/ryzom.png b/dist/snap/setup/gui/ryzom.png new file mode 100644 index 000000000..a51ce87ab Binary files /dev/null and b/dist/snap/setup/gui/ryzom.png differ diff --git a/dist/snap/snapcraft.yaml b/dist/snap/snapcraft.yaml new file mode 100644 index 000000000..0a8f5486d --- /dev/null +++ b/dist/snap/snapcraft.yaml @@ -0,0 +1,55 @@ +name: ryzom +version: "3.0.2" +summary: Ryzom science-fantasy MMORPG +description: | + Ryzom is a science-fantasy MMORPG. +grade: devel # stable +confinement: strict + +apps: + ryzom: + command: desktop-launch $SNAP/bin/ryzom_installer_qt + plugs: + - home + - unity7 + - x11 + - opengl + +parts: + ryzom: + source: https://bitbucket.org/ryzom/ryzomcore + source-type: hg + source-branch: compatibility-develop + source-subdir: code + plugin: cmake + configflags: + - -DCMAKE_BUILD_TYPE=Release + - -DWITH_3D=OFF + - -DWITH_GUI=OFF + - -DWITH_NET=OFF + - -DWITH_PACS=OFF + - -DWITH_GEORGES=OFF + - -DWITH_LIGO=OFF + - -DWITH_LOGIC=OFF + - -DWITH_SOUND=OFF + - -DWITH_RYZOM_SERVER=OFF + - -DWITH_RYZOM_TOOLS=OFF + - -DWITH_RYZOM_CLIENT=OFF + - -DWITH_RYZOM_INSTALLER=ON + - -DWITH_NEL_TESTS=OFF + - -DWITH_NEL_TOOLS=OFF + - -DWITH_NEL_SAMPLES=OFF + - -DWITH_QT5=ON + - -DWITH_STATIC=ON + - -DWITH_INSTALL_LIBRARIES=OFF + - -DRYZOM_GAMES_PREFIX=bin + build-packages: + - zlib1g-dev + - libpng-dev + - libjpeg8-dev + - qttools5-dev-tools + stage-packages: + - libqt5widgets5 + + after: [desktop-qt5] +