correction du merge

This commit is contained in:
deed 2017-03-21 21:20:08 +01:00
parent 3e9c116530
commit 6a92d08499
91 changed files with 155477 additions and 183810 deletions

View file

@ -48,7 +48,7 @@ MACRO(NL_CONFIGURE_CHECKS)
SET(COPYRIGHT "${YEAR} ${AUTHOR}")
IF(NOT RYZOM_CLIENT_ICON)
SET(RYZOM_CLIENT_ICON "khanat_client")
SET(RYZOM_CLIENT_ICON "ryzom_client")
ENDIF()
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)

View file

@ -1,54 +0,0 @@
# - Locate MFC libraries
# This module defines
# MFC_FOUND, if false, do not try to link to MFC
# MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF()
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF()
FIND_PATH(MFC_DIR
include/afxwin.h
HINTS
${MFC_STANDARD_DIR}
)
ENDIF()
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE()
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF()
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
# Set definitions for using MFC in DLL
<<<<<<< HEAD
SET(MFC_DEFINITIONS -D_AFXDLL)
=======
SET(MFC_DEFINITIONS -D_AFXDLL -DUNICODE -D_UNICODE)
>>>>>>> ryzomcore
# Set CMake flag to use MFC DLL
SET(CMAKE_MFC_FLAG 2)
ENDIF()
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project

View file

@ -1,50 +0,0 @@
# - Locate MFC libraries
# This module defines
# MFC_FOUND, if false, do not try to link to MFC
# MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF()
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF()
FIND_PATH(MFC_DIR
include/afxwin.h
HINTS
${MFC_STANDARD_DIR}
)
ENDIF()
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE()
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF()
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
# Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL)
# Set CMake flag to use MFC DLL
SET(CMAKE_MFC_FLAG 2)
ENDIF()
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project

View file

@ -1,50 +0,0 @@
# - Locate MFC libraries
# This module defines
# MFC_FOUND, if false, do not try to link to MFC
# MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF()
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF()
FIND_PATH(MFC_DIR
include/afxwin.h
HINTS
${MFC_STANDARD_DIR}
)
ENDIF()
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE()
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF()
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
# Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL -DUNICODE -D_UNICODE)
# Set CMake flag to use MFC DLL
SET(CMAKE_MFC_FLAG 2)
ENDIF()
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -865,7 +865,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
}
// make sure the CSheetId singleton has been properly initialised
NLMISC::CSheetId::init(updatePackedSheet);
// NLMISC::CSheetId::init(updatePackedSheet);
// load the packed sheet if exists
try

View file

@ -224,9 +224,6 @@ public:
// ** Atom element methods
/// Returns the type of the atom. NULL otherwise.
virtual const class UType *getType () = 0;
/// Returns the type of the atom. NULL otherwise.
virtual const class UType *getType () = 0;

View file

@ -1,875 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __PRIMITIVE_H__
#define __PRIMITIVE_H__
#include "nel/misc/vector.h"
#include "nel/misc/rgba.h"
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
#include <vector>
namespace NLLIGO
{
#ifdef NL_DEBUG
# define NLLIGO_DEBUG
#endif
/**
* Ligo primitives are used to add logical geometrical gameplay information.
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
* Ligo primitives have a CLASS.
*
* The primitive class defines the properties attached to the primitive
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
*/
class CPrimitives;
class CLigoConfig;
// ***************************************************************************
void Register ();
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
*/
class IProperty : public NLMISC::IStreamable
{
public:
IProperty ()
{
Default = false;
}
// This property is set to default
bool Default;
// Force class to be polymorphic
virtual void foo () const = 0;
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a simple string
*/
class CPropertyString : public IProperty
{
public:
CPropertyString () {}
<<<<<<< HEAD
CPropertyString (const char *str);
CPropertyString (const std::string &str);
CPropertyString (const char *str, bool _default);
=======
CPropertyString (const std::string &str);
CPropertyString (const std::string &str, bool _default);
>>>>>>> ryzomcore
virtual ~CPropertyString () {}
std::string String;
NLMISC_DECLARE_CLASS (CPropertyString)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(String);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyStringArray : public IProperty
{
public:
CPropertyStringArray () {}
virtual ~CPropertyStringArray () {}
CPropertyStringArray (const std::vector<std::string> &stringArray);
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
std::vector<std::string> StringArray;
NLMISC_DECLARE_CLASS (CPropertyStringArray)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serialCont(StringArray);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyColor : public IProperty
{
public:
NLMISC::CRGBA Color;
NLMISC_DECLARE_CLASS (CPropertyColor)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(Color);
}
// Force class to be polymorphic
virtual void foo () const {}
// ctors
CPropertyColor() {}
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
};
// ***************************************************************************
class CPrimVector : public NLMISC::CVector
{
public:
CPrimVector ()
{
Selected = false;
}
CPrimVector (const NLMISC::CVector &v)
{
CVector::operator= (v);
Selected = false;
}
void serial(NLMISC::IStream &f)
{
CVector::serial(f);
f.serial(Selected);
}
bool Selected;
};
// ***************************************************************************
/*
* This class is the base class for ligo primitive.
*
* Provide access to common properties.
* Provide access to the primitive hierachy
*/
class IPrimitive : public NLMISC::IStreamable
{
friend class CPrimitives;
public:
// Deprecated
// std::string Layer;
// Deprecated
// std::string Name;
// Expended in the tree view
// bool Expanded;
enum
{
NotAnArray,
AtTheEnd = 0xffffffff,
};
/// \name Hierarchy
IPrimitive ();
virtual ~IPrimitive ();
IPrimitive (const IPrimitive &node);
virtual void operator= (const IPrimitive &node);
/** Get the children primitive count */
uint getNumChildren () const
{
return (uint)_Children.size ();
}
/** Get a child primitive */
bool getChild (const IPrimitive *&result, uint childId) const;
/** Get a child primitive */
bool getChild (IPrimitive *&result, uint childId);
/** Get the parent primitive */
IPrimitive *getParent ()
{
return _Parent;
}
const IPrimitive *getParent () const
{
return _Parent;
}
/** Get the primitive relative to this and the given path */
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
/** Get the id of the child, return 0xffffffff if not found */
bool getChildId (uint &childId, const IPrimitive *child) const;
/** Remove and delete a child primitive */
bool removeChild (IPrimitive *child);
/** Remove and delete a child primitive */
bool removeChild (uint childId);
/// Remove the child primitive from the children list, don't delete it
bool unlinkChild(IPrimitive *child);
/** Remove and delete all children primitives */
void removeChildren ();
/**
* Insert a child primitive before the index.
* The pointer will be deleted by the parent primitive using the ::delete operator.
* return false if the index is invalid
*/
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
/// \name Properties
/**
* Get a num properties
**/
uint getNumProperty () const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, IProperty *&result);
/** Check the existence of a named property */
bool checkProperty(const std::string &property_name) const;
/**
* Add a property
* If the property already exist, the method does nothing and returns false.
* The pointer will be deleted by the primitive using the ::delete operator.
**/
<<<<<<< HEAD
bool addPropertyByName (const char *property_name, IProperty *result);
=======
bool addPropertyByName (const std::string &property_name, IProperty *result);
>>>>>>> ryzomcore
/**
* Get a property with its name
**/
<<<<<<< HEAD
bool getPropertyByName (const char *property_name, const IProperty *&result) const;
=======
bool getPropertyByName (const std::string &property_name, const IProperty *&result) const;
>>>>>>> ryzomcore
/**
* Get a property with its name
**/
<<<<<<< HEAD
bool getPropertyByName (const char *property_name, IProperty *&result) const;
=======
bool getPropertyByName (const std::string &property_name, IProperty *&result) const;
>>>>>>> ryzomcore
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
<<<<<<< HEAD
bool getPropertyByName (const char *property_name, std::string *&result) const;
=======
bool getPropertyByName (const std::string &property_name, std::string *&result) const;
>>>>>>> ryzomcore
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
<<<<<<< HEAD
bool getPropertyByName (const char *property_name, std::vector<std::string> *&result) const;
=======
bool getPropertyByName (const std::string &property_name, std::vector<std::string> *&result) const;
>>>>>>> ryzomcore
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
<<<<<<< HEAD
bool getPropertyByName (const char *property_name, std::string &result) const;
=======
bool getPropertyByName (const std::string &property_name, std::string &result) const;
>>>>>>> ryzomcore
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
<<<<<<< HEAD
bool getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const;
=======
bool getPropertyByName (const std::string &property_name, const std::vector<std::string> *&result) const;
>>>>>>> ryzomcore
/**
* Get a color property with its name. Return false if the property is not found or is not a string array property.
**/
<<<<<<< HEAD
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const;
=======
bool getPropertyByName (const std::string &property_name, NLMISC::CRGBA &result) const;
>>>>>>> ryzomcore
/**
* Remove a property
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
**/
bool removeProperty (uint index);
/**
* Remove a property by its name
**/
<<<<<<< HEAD
bool removePropertyByName (const char *property_name);
=======
bool removePropertyByName (const std::string &property_name);
>>>>>>> ryzomcore
/**
* Remove all the properties
**/
void removeProperties ();
/* Init default primitive's parameters
*
* This method will add all the properties declared in the primitive class and create default properties.
*/
void initDefaultValues (CLigoConfig &config);
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
<<<<<<< HEAD
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
=======
virtual bool read (xmlNodePtr xmlNode, const std::string &property_name, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &property_name) const;
>>>>>>> ryzomcore
// Get the vertices
virtual uint getNumVector () const = 0;
virtual const CPrimVector *getPrimVector () const = 0;
virtual CPrimVector *getPrimVector () = 0;
// Make a copy
virtual IPrimitive *copy () const = 0;
// used for fast binary save/load (exploitation mode)
void serial(NLMISC::IStream &f);
// shortcut to getPropertyByName("name", ret); return ret;
std::string getName() const;
const std::string &getUnparsedProperties() const;
void setUnparsedProperties(const std::string &unparsedProperties) const;
private:
// callback called just after the node is attach under a parent
virtual void onLinkToParent() {}
// callback called just before the node is removed from it's parent
virtual void onUnlinkFromParent() {}
/// Callback called just after an ancestor is linked
virtual void onBranchLink() {}
/// Callback called just before an ancestor is unlinked
virtual void onBranchUnlink() {}
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
// internal recusive call
void branchLink();
void branchUnlink();
// Update child Id
void updateChildId (uint index);
// Child id
uint32 _ChildId;
// Parent
IPrimitive *_Parent;
// Children
std::vector<IPrimitive*> _Children;
// Single properties
std::map<std::string, IProperty*> _Properties;
// Editor specific properties (unparsed)
mutable std::string _UnparsedProperties;
#ifdef NLLIGO_DEBUG
std::string _DebugClassName;
std::string _DebugPrimitiveName;
#endif
};
// ***************************************************************************
// Simple primitive node
class CPrimNode : public IPrimitive
{
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimNode)
protected:
// void operator= (const CPrimNode &node);
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
<<<<<<< HEAD
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
=======
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
>>>>>>> ryzomcore
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPoint : public IPrimitive
{
public:
CPrimPoint ()
{
Angle = 0;
}
CPrimVector Point;
float Angle; // Angle on OZ, CCW
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPoint &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPoint);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
<<<<<<< HEAD
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
=======
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
>>>>>>> ryzomcore
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPath : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPath &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPath);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
<<<<<<< HEAD
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
=======
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
>>>>>>> ryzomcore
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimZone : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
public:
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
// void operator= (const CPrimZone &node);
void serial (NLMISC::IStream &f);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
NLMISC::CVector getBarycentre() const;
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
/// Return the area of the axis-aligned box containing the zone
float getAreaOfAABox() const;
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimZone);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
<<<<<<< HEAD
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
=======
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
>>>>>>> ryzomcore
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
/** This primitive type is used to handle unique alias across a primitive file.
* Usage of this primitive imply the setting of the appropriate 'ligo context'
* before reading or copy/pasting alias.
*/
class CPrimAlias : public IPrimitive
{
friend class CPrimitives;
/// The 'dynamic' part of the alias
uint32 _Alias;
/// The primitive container
class CPrimitives *_Container;
// Needed overloads (not used)
virtual uint getNumVector () const
{
return 0;
};
virtual const CPrimVector *getPrimVector () const
{
return NULL;
}
virtual CPrimVector *getPrimVector ()
{
return NULL;
}
virtual void onBranchLink();
// callback called just before the node is removed from it's parent
virtual void onBranchUnlink();
void regenAlias();
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimAlias);
// private default constructor
CPrimAlias();
// copy constructor needed
CPrimAlias(const CPrimAlias &other);
~CPrimAlias();
// return the dynamic part of the alias
uint32 getAlias() const;
// Return the full alias, merge of the static and dynamic part
uint32 getFullAlias() const;
// Read the primitive
<<<<<<< HEAD
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
=======
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
>>>>>>> ryzomcore
// Create a copy of this primitive
virtual IPrimitive *copy () const;
// serial for binary save
virtual void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/*
This class is deprecated.
*/
class CPrimRegion
{
public:
std::string Name;
std::vector<CPrimPoint> VPoints;
std::vector<CPrimZone> VZones;
std::vector<CPrimPath> VPaths;
std::vector<bool> VHidePoints;
std::vector<bool> VHideZones;
std::vector<bool> VHidePaths;
public:
void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/**
* This class is a ligo primitives set
*/
class CPrimitives
{
public:
CPrimitives ();
CPrimitives (const CPrimitives &other);
~CPrimitives ();
// Operator copy
CPrimitives& operator= (const CPrimitives &other);
// Convert from old format to the new one
void convert (const CPrimRegion &region);
// Read the primitive
<<<<<<< HEAD
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config);
// Write the primitive
void write (xmlDocPtr xmlNode, const char *filename) const;
// Write the primitive
void write (xmlNodePtr root, const char *filename) const;
=======
bool read (xmlNodePtr xmlNode, const std::string &filename, CLigoConfig &config);
// Write the primitive
void write (xmlDocPtr xmlNode, const std::string &filename) const;
// Write the primitive
void write (xmlNodePtr root, const std::string &filename) const;
>>>>>>> ryzomcore
// serial the primitive. Used for binary files.
void serial(NLMISC::IStream &f);
// Root primitive hierarchy
CPrimNode *RootNode;
// get the static alias part for this primitive
uint32 getAliasStaticPart();
// set the static alias part for this primitive
void setAliasStaticPart(uint32 staticPart);
// Build an alias by combining the static and dynamic part
uint32 buildFullAlias(uint32 dynamicPart);
// Generate a new unique alias (dynamic part only)
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
// Reserve an alias and store it in the used alias list (dynamic part only)
// void reserveAlias(uint32 dynamicAlias);
// Remove an alias from the list of alias in use (dynamic part only)
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
// Force the assignation of the specified alias to the primitive. If another primitive
// already hold the alias, this other primitive is assigned a new alias.
void forceAlias(CPrimAlias *prim, uint32 alias);
// get the last generated alias value (for debug only)
uint32 getLastGeneratedAlias();
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
private:
// Conversion internal methods
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
void convertPrimitive (const IPrimitive *prim, bool hidden);
/// Optional context information
CLigoConfig *_LigoConfig;
/// Static part alias mapping (can be 0 if no mapping is defined)
uint32 _AliasStaticPart;
/// Last generated Alias, used to compute the next alias
uint32 _LastGeneratedAlias;
/// List of alias in use in the primitive (dynamic part only)
std::map<uint32, IPrimitive*> _AliasInUse;
// Store the filename
// This allows to retrieve the static alias when reloading from binary file
std::string _Filename;
};
// ***************************************************************************
/** Singleton to manage special loading feature related to
* unique alias assignment
*/
class CPrimitiveContext
{
static CPrimitiveContext *_Instance;
// private ctor
CPrimitiveContext();
public:
// get the singleton reference
static CPrimitiveContext &instance()
{
if (!_Instance)
{
_Instance = new CPrimitiveContext;
}
return *_Instance;
}
/// The current ligo configuration file.
CLigoConfig *CurrentLigoConfig;
/// The current primitives container.
CPrimitives *CurrentPrimitive;
};
} // namespace NLLIGO
#endif // __PRIMITIVE_H__

View file

@ -1,781 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __PRIMITIVE_H__
#define __PRIMITIVE_H__
#include "nel/misc/vector.h"
#include "nel/misc/rgba.h"
// Include from libxml2
#include <libxml/parser.h>
#include <vector>
namespace NLLIGO
{
#ifdef NL_DEBUG
# define NLLIGO_DEBUG
#endif
/**
* Ligo primitives are used to add logical geometrical gameplay informations.
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
* Ligo primitives have a CLASS.
*
* The primitive class defines the properties attached to the primitive
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
*/
class CPrimitives;
class CLigoConfig;
// ***************************************************************************
void Register ();
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
*/
class IProperty : public NLMISC::IStreamable
{
public:
IProperty ()
{
Default = false;
}
// This property is set to default
bool Default;
// Force class to be polymorphic
virtual void foo () const = 0;
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a simple string
*/
class CPropertyString : public IProperty
{
public:
CPropertyString () {}
CPropertyString (const char *str);
CPropertyString (const std::string &str);
CPropertyString (const char *str, bool _default);
virtual ~CPropertyString () {}
std::string String;
NLMISC_DECLARE_CLASS (CPropertyString)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(String);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyStringArray : public IProperty
{
public:
CPropertyStringArray () {}
virtual ~CPropertyStringArray () {}
CPropertyStringArray (const std::vector<std::string> &stringArray);
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
std::vector<std::string> StringArray;
NLMISC_DECLARE_CLASS (CPropertyStringArray)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serialCont(StringArray);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyColor : public IProperty
{
public:
NLMISC::CRGBA Color;
NLMISC_DECLARE_CLASS (CPropertyColor)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(Color);
}
// Force class to be polymorphic
virtual void foo () const {}
// ctors
CPropertyColor() {}
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
};
// ***************************************************************************
class CPrimVector : public NLMISC::CVector
{
public:
CPrimVector ()
{
Selected = false;
}
CPrimVector (const NLMISC::CVector &v)
{
CVector::operator= (v);
Selected = false;
}
void serial(NLMISC::IStream &f)
{
CVector::serial(f);
f.serial(Selected);
}
bool Selected;
};
// ***************************************************************************
/*
* This class is the base class for ligo primitive.
*
* Provide access to common properties.
* Provide access to the primitive hierachy
*/
class IPrimitive : public NLMISC::IStreamable
{
friend class CPrimitives;
public:
// Deprecated
// std::string Layer;
// Deprecated
// std::string Name;
// Expended in the tree view
// bool Expanded;
enum
{
NotAnArray,
AtTheEnd = 0xffffffff,
};
/// \name Hierarchy
IPrimitive ();
virtual ~IPrimitive ();
IPrimitive (const IPrimitive &node);
virtual void operator= (const IPrimitive &node);
/** Get the children primitive count */
uint getNumChildren () const
{
return _Children.size ();
}
/** Get a child primitive */
bool getChild (const IPrimitive *&result, uint childId) const;
/** Get a child primitive */
bool getChild (IPrimitive *&result, uint childId);
/** Get the parent primitive */
IPrimitive *getParent ()
{
return _Parent;
}
const IPrimitive *getParent () const
{
return _Parent;
}
/** Get the primitive relative to this and the given path */
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
/** Get the id of the child, return 0xffffffff if not found */
bool getChildId (uint &childId, const IPrimitive *child) const;
/** Remove and delete a child primitive */
bool removeChild (IPrimitive *child);
/** Remove and delete a child primitive */
bool removeChild (uint childId);
/// Remove the child primitive from the children list, don't delete it
bool unlinkChild(IPrimitive *child);
/** Remove and delete all children primitives */
void removeChildren ();
/**
* Insert a child primitive before the index.
* The pointer will be deleted by the parent primitive using the ::delete operator.
* return false if the index is invalid
*/
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
/// \name Properties
/**
* Get a num properties
**/
uint getNumProperty () const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, IProperty *&result);
/** Check the existence of a named property */
bool checkProperty(const std::string &property_name) const;
/**
* Add a property
* If the property already exist, the method does nothing and returns false.
* The pointer will be deleted by the primitive using the ::delete operator.
**/
bool addPropertyByName (const char *property_name, IProperty *result);
/**
* Get a property with its name
**/
bool getPropertyByName (const char *property_name, const IProperty *&result) const;
/**
* Get a property with its name
**/
bool getPropertyByName (const char *property_name, IProperty *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const char *property_name, std::string *&result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, std::vector<std::string> *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const char *property_name, std::string &result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const;
/**
* Get a color property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const;
/**
* Remove a property
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
**/
bool removeProperty (uint index);
/**
* Remove a property by its name
**/
bool removePropertyByName (const char *property_name);
/**
* Remove all the properties
**/
void removeProperties ();
/* Init default primitive's parameters
*
* This method will add all the properties declared in the primitive class and create default properties.
*/
void initDefaultValues (CLigoConfig &config);
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// Get the vertices
virtual uint getNumVector () const = 0;
virtual const CPrimVector *getPrimVector () const = 0;
virtual CPrimVector *getPrimVector () = 0;
// Make a copy
virtual IPrimitive *copy () const = 0;
// used for fast binary save/load (exploitation mode)
void serial(NLMISC::IStream &f);
// shortcut to getPropertyByName("name", ret); return ret;
std::string getName() const;
const std::string &getUnparsedProperties() const;
void setUnparsedProperties(const std::string &unparsedProperties) const;
private:
// callback called just after the node is attach under a parent
virtual void onLinkToParent() {}
// callback called just before the node is removed from it's parent
virtual void onUnlinkFromParent() {}
/// Callback called just after an ancestor is linked
virtual void onBranchLink() {}
/// Callback called just before an ancestor is unlinked
virtual void onBranchUnlink() {}
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
// internal recusive call
void branchLink();
void branchUnlink();
// Update child Id
void updateChildId (uint index);
// Child id
uint32 _ChildId;
// Parent
IPrimitive *_Parent;
// Children
std::vector<IPrimitive*> _Children;
// Single properties
std::map<std::string, IProperty*> _Properties;
// Editor specific properties (unparsed)
mutable std::string _UnparsedProperties;
#ifdef NLLIGO_DEBUG
std::string _DebugClassName;
std::string _DebugPrimitiveName;
#endif
};
// ***************************************************************************
// Simple primitive node
class CPrimNode : public IPrimitive
{
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimNode)
protected:
// void operator= (const CPrimNode &node);
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPoint : public IPrimitive
{
public:
CPrimPoint ()
{
Angle = 0;
}
CPrimVector Point;
float Angle; // Angle on OZ, CCW
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPoint &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPoint);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPath : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPath &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPath);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimZone : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
public:
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
// void operator= (const CPrimZone &node);
void serial (NLMISC::IStream &f);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
NLMISC::CVector getBarycentre() const;
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
/// Return the area of the axis-aligned box containing the zone
float getAreaOfAABox() const;
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimZone);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
/** This primitive type is used to handle unique alias across a primitive file.
* Usage of this primitive imply the setting of the appropriate 'ligo context'
* before reading or copy/pasting alias.
*/
class CPrimAlias : public IPrimitive
{
friend class CPrimitives;
/// The 'dynamic' part of the alias
uint32 _Alias;
/// The primitive container
class CPrimitives *_Container;
// Needed overloads (not used)
virtual uint getNumVector () const
{
return 0;
};
virtual const CPrimVector *getPrimVector () const
{
return NULL;
}
virtual CPrimVector *getPrimVector ()
{
return NULL;
}
virtual void onBranchLink();
// callback called just before the node is removed from it's parent
virtual void onBranchUnlink();
void regenAlias();
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimAlias);
// private default constructor
CPrimAlias();
// copy constructor needed
CPrimAlias(const CPrimAlias &other);
~CPrimAlias();
// return the dynamic part of the alias
uint32 getAlias() const;
// Return the full alias, merge of the static and dynamic part
uint32 getFullAlias() const;
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// Create a copy of this primitive
virtual IPrimitive *copy () const;
// serial for binary save
virtual void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/*
This class is deprecated.
*/
class CPrimRegion
{
public:
std::string Name;
std::vector<CPrimPoint> VPoints;
std::vector<CPrimZone> VZones;
std::vector<CPrimPath> VPaths;
std::vector<bool> VHidePoints;
std::vector<bool> VHideZones;
std::vector<bool> VHidePaths;
public:
void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/**
* This class is a ligo primitives set
*/
class CPrimitives
{
public:
CPrimitives ();
CPrimitives (const CPrimitives &other);
~CPrimitives ();
// Operator copy
CPrimitives& operator= (const CPrimitives &other);
// Convert from old format to the new one
void convert (const CPrimRegion &region);
// Read the primitive
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config);
// Write the primitive
void write (xmlDocPtr xmlNode, const char *filename) const;
// Write the primitive
void write (xmlNodePtr root, const char *filename) const;
// serial the primitive. Used for binary files.
void serial(NLMISC::IStream &f);
// Root primitive hierarchy
CPrimNode *RootNode;
// get the static alias part for this primitive
uint32 getAliasStaticPart();
// set the static alias part for this primitive
void setAliasStaticPart(uint32 staticPart);
// Build an alias by combining the static and dynamic part
uint32 buildFullAlias(uint32 dynamicPart);
// Generate a new unique alias (dynamic part only)
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
// Reserve an alias and store it in the used alias list (dynamic part only)
// void reserveAlias(uint32 dynamicAlias);
// Remove an alias from the list of alias in use (dynamic part only)
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
// Force the assignation of the specified alias the the primitive. If another primitive
// already hold the alias, this other primitive is assigned a new alias.
void forceAlias(CPrimAlias *prim, uint32 alias);
// get the last generated alias value (for debug only)
uint32 getLastGeneratedAlias();
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
private:
// Conversion internal methods
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
void convertPrimitive (const IPrimitive *prim, bool hidden);
/// Optional context information
CLigoConfig *_LigoConfig;
/// Static part alias mapping (can be 0 if no mapping is defined)
uint32 _AliasStaticPart;
/// Last generated Alias, used to compute the next alias
uint32 _LastGeneratedAlias;
/// List of alias in use in the primitive (dynamic part only)
std::map<uint32, IPrimitive*> _AliasInUse;
// Store the filename
// This allows to retrieve the static alias when reloading from binary file
std::string _Filename;
};
// ***************************************************************************
/** Singleton to manage special loading feature related to
* unique alias assignment
*/
class CPrimitiveContext
{
static CPrimitiveContext *_Instance;
// private ctor
CPrimitiveContext();
public:
// get the singleton reference
static CPrimitiveContext &instance()
{
if (!_Instance)
{
_Instance = new CPrimitiveContext;
}
return *_Instance;
}
/// The current ligo configuration file.
CLigoConfig *CurrentLigoConfig;
/// The current primitives container.
CPrimitives *CurrentPrimitive;
};
} // namespace NLLIGO
#endif // __PRIMITIVE_H__

View file

@ -1,786 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __PRIMITIVE_H__
#define __PRIMITIVE_H__
#include "nel/misc/vector.h"
#include "nel/misc/rgba.h"
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
#include <vector>
namespace NLLIGO
{
#ifdef NL_DEBUG
# define NLLIGO_DEBUG
#endif
/**
* Ligo primitives are used to add logical geometrical gameplay information.
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
* Ligo primitives have a CLASS.
*
* The primitive class defines the properties attached to the primitive
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
*/
class CPrimitives;
class CLigoConfig;
// ***************************************************************************
void Register ();
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
*/
class IProperty : public NLMISC::IStreamable
{
public:
IProperty ()
{
Default = false;
}
// This property is set to default
bool Default;
// Force class to be polymorphic
virtual void foo () const = 0;
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a simple string
*/
class CPropertyString : public IProperty
{
public:
CPropertyString () {}
CPropertyString (const char *str);
CPropertyString (const std::string &str);
CPropertyString (const char *str, bool _default);
virtual ~CPropertyString () {}
std::string String;
NLMISC_DECLARE_CLASS (CPropertyString)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(String);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyStringArray : public IProperty
{
public:
CPropertyStringArray () {}
virtual ~CPropertyStringArray () {}
CPropertyStringArray (const std::vector<std::string> &stringArray);
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
std::vector<std::string> StringArray;
NLMISC_DECLARE_CLASS (CPropertyStringArray)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serialCont(StringArray);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyColor : public IProperty
{
public:
NLMISC::CRGBA Color;
NLMISC_DECLARE_CLASS (CPropertyColor)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(Color);
}
// Force class to be polymorphic
virtual void foo () const {}
// ctors
CPropertyColor() {}
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
};
// ***************************************************************************
class CPrimVector : public NLMISC::CVector
{
public:
CPrimVector ()
{
Selected = false;
}
CPrimVector (const NLMISC::CVector &v)
{
CVector::operator= (v);
Selected = false;
}
void serial(NLMISC::IStream &f)
{
CVector::serial(f);
f.serial(Selected);
}
bool Selected;
};
// ***************************************************************************
/*
* This class is the base class for ligo primitive.
*
* Provide access to common properties.
* Provide access to the primitive hierachy
*/
class IPrimitive : public NLMISC::IStreamable
{
friend class CPrimitives;
public:
// Deprecated
// std::string Layer;
// Deprecated
// std::string Name;
// Expended in the tree view
// bool Expanded;
enum
{
NotAnArray,
AtTheEnd = 0xffffffff,
};
/// \name Hierarchy
IPrimitive ();
virtual ~IPrimitive ();
IPrimitive (const IPrimitive &node);
virtual void operator= (const IPrimitive &node);
/** Get the children primitive count */
uint getNumChildren () const
{
return (uint)_Children.size ();
}
/** Get a child primitive */
bool getChild (const IPrimitive *&result, uint childId) const;
/** Get a child primitive */
bool getChild (IPrimitive *&result, uint childId);
/** Get the parent primitive */
IPrimitive *getParent ()
{
return _Parent;
}
const IPrimitive *getParent () const
{
return _Parent;
}
/** Get the primitive relative to this and the given path */
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
/** Get the id of the child, return 0xffffffff if not found */
bool getChildId (uint &childId, const IPrimitive *child) const;
/** Remove and delete a child primitive */
bool removeChild (IPrimitive *child);
/** Remove and delete a child primitive */
bool removeChild (uint childId);
/// Remove the child primitive from the children list, don't delete it
bool unlinkChild(IPrimitive *child);
/** Remove and delete all children primitives */
void removeChildren ();
/**
* Insert a child primitive before the index.
* The pointer will be deleted by the parent primitive using the ::delete operator.
* return false if the index is invalid
*/
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
/// \name Properties
/**
* Get a num properties
**/
uint getNumProperty () const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, IProperty *&result);
/** Check the existence of a named property */
bool checkProperty(const std::string &property_name) const;
/**
* Add a property
* If the property already exist, the method does nothing and returns false.
* The pointer will be deleted by the primitive using the ::delete operator.
**/
bool addPropertyByName (const char *property_name, IProperty *result);
/**
* Get a property with its name
**/
bool getPropertyByName (const char *property_name, const IProperty *&result) const;
/**
* Get a property with its name
**/
bool getPropertyByName (const char *property_name, IProperty *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const char *property_name, std::string *&result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, std::vector<std::string> *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const char *property_name, std::string &result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, const std::vector<std::string> *&result) const;
/**
* Get a color property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const;
/**
* Remove a property
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
**/
bool removeProperty (uint index);
/**
* Remove a property by its name
**/
bool removePropertyByName (const char *property_name);
/**
* Remove all the properties
**/
void removeProperties ();
/* Init default primitive's parameters
*
* This method will add all the properties declared in the primitive class and create default properties.
*/
void initDefaultValues (CLigoConfig &config);
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// Get the vertices
virtual uint getNumVector () const = 0;
virtual const CPrimVector *getPrimVector () const = 0;
virtual CPrimVector *getPrimVector () = 0;
// Make a copy
virtual IPrimitive *copy () const = 0;
// used for fast binary save/load (exploitation mode)
void serial(NLMISC::IStream &f);
// shortcut to getPropertyByName("name", ret); return ret;
std::string getName() const;
const std::string &getUnparsedProperties() const;
void setUnparsedProperties(const std::string &unparsedProperties) const;
private:
// callback called just after the node is attach under a parent
virtual void onLinkToParent() {}
// callback called just before the node is removed from it's parent
virtual void onUnlinkFromParent() {}
/// Callback called just after an ancestor is linked
virtual void onBranchLink() {}
/// Callback called just before an ancestor is unlinked
virtual void onBranchUnlink() {}
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
// internal recusive call
void branchLink();
void branchUnlink();
// Update child Id
void updateChildId (uint index);
// Child id
uint32 _ChildId;
// Parent
IPrimitive *_Parent;
// Children
std::vector<IPrimitive*> _Children;
// Single properties
std::map<std::string, IProperty*> _Properties;
// Editor specific properties (unparsed)
mutable std::string _UnparsedProperties;
#ifdef NLLIGO_DEBUG
std::string _DebugClassName;
std::string _DebugPrimitiveName;
#endif
};
// ***************************************************************************
// Simple primitive node
class CPrimNode : public IPrimitive
{
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimNode)
protected:
// void operator= (const CPrimNode &node);
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPoint : public IPrimitive
{
public:
CPrimPoint ()
{
Angle = 0;
}
CPrimVector Point;
float Angle; // Angle on OZ, CCW
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPoint &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPoint);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPath : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPath &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPath);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimZone : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
public:
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
// void operator= (const CPrimZone &node);
void serial (NLMISC::IStream &f);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
NLMISC::CVector getBarycentre() const;
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
/// Return the area of the axis-aligned box containing the zone
float getAreaOfAABox() const;
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimZone);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
/** This primitive type is used to handle unique alias across a primitive file.
* Usage of this primitive imply the setting of the appropriate 'ligo context'
* before reading or copy/pasting alias.
*/
class CPrimAlias : public IPrimitive
{
friend class CPrimitives;
/// The 'dynamic' part of the alias
uint32 _Alias;
/// The primitive container
class CPrimitives *_Container;
// Needed overloads (not used)
virtual uint getNumVector () const
{
return 0;
};
virtual const CPrimVector *getPrimVector () const
{
return NULL;
}
virtual CPrimVector *getPrimVector ()
{
return NULL;
}
virtual void onBranchLink();
// callback called just before the node is removed from it's parent
virtual void onBranchUnlink();
void regenAlias();
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimAlias);
// private default constructor
CPrimAlias();
// copy constructor needed
CPrimAlias(const CPrimAlias &other);
~CPrimAlias();
// return the dynamic part of the alias
uint32 getAlias() const;
// Return the full alias, merge of the static and dynamic part
uint32 getFullAlias() const;
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const char *filename) const;
// Create a copy of this primitive
virtual IPrimitive *copy () const;
// serial for binary save
virtual void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/*
This class is deprecated.
*/
class CPrimRegion
{
public:
std::string Name;
std::vector<CPrimPoint> VPoints;
std::vector<CPrimZone> VZones;
std::vector<CPrimPath> VPaths;
std::vector<bool> VHidePoints;
std::vector<bool> VHideZones;
std::vector<bool> VHidePaths;
public:
void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/**
* This class is a ligo primitives set
*/
class CPrimitives
{
public:
CPrimitives ();
CPrimitives (const CPrimitives &other);
~CPrimitives ();
// Operator copy
CPrimitives& operator= (const CPrimitives &other);
// Convert from old format to the new one
void convert (const CPrimRegion &region);
// Read the primitive
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config);
// Write the primitive
void write (xmlDocPtr xmlNode, const char *filename) const;
// Write the primitive
void write (xmlNodePtr root, const char *filename) const;
// serial the primitive. Used for binary files.
void serial(NLMISC::IStream &f);
// Root primitive hierarchy
CPrimNode *RootNode;
// get the static alias part for this primitive
uint32 getAliasStaticPart();
// set the static alias part for this primitive
void setAliasStaticPart(uint32 staticPart);
// Build an alias by combining the static and dynamic part
uint32 buildFullAlias(uint32 dynamicPart);
// Generate a new unique alias (dynamic part only)
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
// Reserve an alias and store it in the used alias list (dynamic part only)
// void reserveAlias(uint32 dynamicAlias);
// Remove an alias from the list of alias in use (dynamic part only)
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
// Force the assignation of the specified alias to the primitive. If another primitive
// already hold the alias, this other primitive is assigned a new alias.
void forceAlias(CPrimAlias *prim, uint32 alias);
// get the last generated alias value (for debug only)
uint32 getLastGeneratedAlias();
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
private:
// Conversion internal methods
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
void convertPrimitive (const IPrimitive *prim, bool hidden);
/// Optional context information
CLigoConfig *_LigoConfig;
/// Static part alias mapping (can be 0 if no mapping is defined)
uint32 _AliasStaticPart;
/// Last generated Alias, used to compute the next alias
uint32 _LastGeneratedAlias;
/// List of alias in use in the primitive (dynamic part only)
std::map<uint32, IPrimitive*> _AliasInUse;
// Store the filename
// This allows to retrieve the static alias when reloading from binary file
std::string _Filename;
};
// ***************************************************************************
/** Singleton to manage special loading feature related to
* unique alias assignment
*/
class CPrimitiveContext
{
static CPrimitiveContext *_Instance;
// private ctor
CPrimitiveContext();
public:
// get the singleton reference
static CPrimitiveContext &instance()
{
if (!_Instance)
{
_Instance = new CPrimitiveContext;
}
return *_Instance;
}
/// The current ligo configuration file.
CLigoConfig *CurrentLigoConfig;
/// The current primitives container.
CPrimitives *CurrentPrimitive;
};
} // namespace NLLIGO
#endif // __PRIMITIVE_H__

View file

@ -1,785 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __PRIMITIVE_H__
#define __PRIMITIVE_H__
#include "nel/misc/vector.h"
#include "nel/misc/rgba.h"
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
#include <vector>
namespace NLLIGO
{
#ifdef NL_DEBUG
# define NLLIGO_DEBUG
#endif
/**
* Ligo primitives are used to add logical geometrical gameplay information.
* Ligo primitives are NODES, POINTS, PATHES or ZONES.
* Ligo primitives have a CLASS.
*
* The primitive class defines the properties attached to the primitive
* The primitive class are defined in the XML file specified in the LigoClass field of the CLigoConfig class.
*/
class CPrimitives;
class CLigoConfig;
// ***************************************************************************
void Register ();
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
*/
class IProperty : public NLMISC::IStreamable
{
public:
IProperty ()
{
Default = false;
}
// This property is set to default
bool Default;
// Force class to be polymorphic
virtual void foo () const = 0;
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a simple string
*/
class CPropertyString : public IProperty
{
public:
CPropertyString () {}
CPropertyString (const std::string &str);
CPropertyString (const std::string &str, bool _default);
virtual ~CPropertyString () {}
std::string String;
NLMISC_DECLARE_CLASS (CPropertyString)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(String);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyStringArray : public IProperty
{
public:
CPropertyStringArray () {}
virtual ~CPropertyStringArray () {}
CPropertyStringArray (const std::vector<std::string> &stringArray);
CPropertyStringArray (const std::vector<std::string> &stringArray, bool _default);
std::vector<std::string> StringArray;
NLMISC_DECLARE_CLASS (CPropertyStringArray)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serialCont(StringArray);
}
// Force class to be polymorphic
virtual void foo () const {}
};
// ***************************************************************************
/*
* This class is a property class for ligo primitive.
* This is a string array
*/
class CPropertyColor : public IProperty
{
public:
NLMISC::CRGBA Color;
NLMISC_DECLARE_CLASS (CPropertyColor)
virtual void serial(NLMISC::IStream &f)
{
f.serial(Default);
f.serial(Color);
}
// Force class to be polymorphic
virtual void foo () const {}
// ctors
CPropertyColor() {}
CPropertyColor(NLMISC::CRGBA col) : Color(col) {}
};
// ***************************************************************************
class CPrimVector : public NLMISC::CVector
{
public:
CPrimVector ()
{
Selected = false;
}
CPrimVector (const NLMISC::CVector &v)
{
CVector::operator= (v);
Selected = false;
}
void serial(NLMISC::IStream &f)
{
CVector::serial(f);
f.serial(Selected);
}
bool Selected;
};
// ***************************************************************************
/*
* This class is the base class for ligo primitive.
*
* Provide access to common properties.
* Provide access to the primitive hierachy
*/
class IPrimitive : public NLMISC::IStreamable
{
friend class CPrimitives;
public:
// Deprecated
// std::string Layer;
// Deprecated
// std::string Name;
// Expended in the tree view
// bool Expanded;
enum
{
NotAnArray,
AtTheEnd = 0xffffffff,
};
/// \name Hierarchy
IPrimitive ();
virtual ~IPrimitive ();
IPrimitive (const IPrimitive &node);
virtual void operator= (const IPrimitive &node);
/** Get the children primitive count */
uint getNumChildren () const
{
return (uint)_Children.size ();
}
/** Get a child primitive */
bool getChild (const IPrimitive *&result, uint childId) const;
/** Get a child primitive */
bool getChild (IPrimitive *&result, uint childId);
/** Get the parent primitive */
IPrimitive *getParent ()
{
return _Parent;
}
const IPrimitive *getParent () const
{
return _Parent;
}
/** Get the primitive relative to this and the given path */
const IPrimitive *getPrimitive (const std::string &absoluteOrRelativePath) const;
/** Get the id of the child, return 0xffffffff if not found */
bool getChildId (uint &childId, const IPrimitive *child) const;
/** Remove and delete a child primitive */
bool removeChild (IPrimitive *child);
/** Remove and delete a child primitive */
bool removeChild (uint childId);
/// Remove the child primitive from the children list, don't delete it
bool unlinkChild(IPrimitive *child);
/** Remove and delete all children primitives */
void removeChildren ();
/**
* Insert a child primitive before the index.
* The pointer will be deleted by the parent primitive using the ::delete operator.
* return false if the index is invalid
*/
bool insertChild (IPrimitive *primitive, uint index = AtTheEnd);
/// \name Properties
/**
* Get a num properties
**/
uint getNumProperty () const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const;
/**
* Get a properties by its index
* This method (iterate a list) is slower than getPropertyByName (look up in a map).
**/
bool getProperty (uint index, std::string &property_name, IProperty *&result);
/** Check the existence of a named property */
bool checkProperty(const std::string &property_name) const;
/**
* Add a property
* If the property already exist, the method does nothing and returns false.
* The pointer will be deleted by the primitive using the ::delete operator.
**/
bool addPropertyByName (const std::string &property_name, IProperty *result);
/**
* Get a property with its name
**/
bool getPropertyByName (const std::string &property_name, const IProperty *&result) const;
/**
* Get a property with its name
**/
bool getPropertyByName (const std::string &property_name, IProperty *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const std::string &property_name, std::string *&result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const std::string &property_name, std::vector<std::string> *&result) const;
/**
* Get a string property with its name. Return false if the property is not found or is not a string property.
**/
bool getPropertyByName (const std::string &property_name, std::string &result) const;
/**
* Get a string array property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const std::string &property_name, const std::vector<std::string> *&result) const;
/**
* Get a color property with its name. Return false if the property is not found or is not a string array property.
**/
bool getPropertyByName (const std::string &property_name, NLMISC::CRGBA &result) const;
/**
* Remove a property
* This is method (iterate a list) is slower than removePropertyByName (look up in a map).
**/
bool removeProperty (uint index);
/**
* Remove a property by its name
**/
bool removePropertyByName (const std::string &property_name);
/**
* Remove all the properties
**/
void removeProperties ();
/* Init default primitive's parameters
*
* This method will add all the properties declared in the primitive class and create default properties.
*/
void initDefaultValues (CLigoConfig &config);
// Read the primitive, calls initDefaultValue (CLigoConfig &config)
virtual bool read (xmlNodePtr xmlNode, const std::string &property_name, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &property_name) const;
// Get the vertices
virtual uint getNumVector () const = 0;
virtual const CPrimVector *getPrimVector () const = 0;
virtual CPrimVector *getPrimVector () = 0;
// Make a copy
virtual IPrimitive *copy () const = 0;
// used for fast binary save/load (exploitation mode)
void serial(NLMISC::IStream &f);
// shortcut to getPropertyByName("name", ret); return ret;
std::string getName() const;
const std::string &getUnparsedProperties() const;
void setUnparsedProperties(const std::string &unparsedProperties) const;
private:
// callback called just after the node is attach under a parent
virtual void onLinkToParent() {}
// callback called just before the node is removed from it's parent
virtual void onUnlinkFromParent() {}
/// Callback called just after an ancestor is linked
virtual void onBranchLink() {}
/// Callback called just before an ancestor is unlinked
virtual void onBranchUnlink() {}
/// Callback called when the primitive is updated, giving a chance to track the primitive's modifications during the loading
virtual void onModifyPrimitive(CPrimitives &/* primitives */) const {}
// internal recusive call
void branchLink();
void branchUnlink();
// Update child Id
void updateChildId (uint index);
// Child id
uint32 _ChildId;
// Parent
IPrimitive *_Parent;
// Children
std::vector<IPrimitive*> _Children;
// Single properties
std::map<std::string, IProperty*> _Properties;
// Editor specific properties (unparsed)
mutable std::string _UnparsedProperties;
#ifdef NLLIGO_DEBUG
std::string _DebugClassName;
std::string _DebugPrimitiveName;
#endif
};
// ***************************************************************************
// Simple primitive node
class CPrimNode : public IPrimitive
{
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimNode)
protected:
// void operator= (const CPrimNode &node);
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPoint : public IPrimitive
{
public:
CPrimPoint ()
{
Angle = 0;
}
CPrimVector Point;
float Angle; // Angle on OZ, CCW
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPoint &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPoint);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimPath : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
public:
void serial (NLMISC::IStream &f);
// void operator= (const CPrimPath &node);
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimPath);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
class CPrimZone : public IPrimitive
{
public:
std::vector<CPrimVector> VPoints;
static float getSegmentDist(const NLMISC::CVector v, const NLMISC::CVector &p1, const NLMISC::CVector &p2, NLMISC::CVector &nearPos);
public:
bool contains (const NLMISC::CVector &v) const { return CPrimZone::contains(v, VPoints); }
bool contains(const NLMISC::CVector &v, float &distance, NLMISC::CVector &nearPos, bool isPath) const { return CPrimZone::contains(v, VPoints, distance, nearPos, isPath); }
// void operator= (const CPrimZone &node);
void serial (NLMISC::IStream &f);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<NLMISC::CVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
// Returns true if the vector v is inside of the patatoid
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points);
// Returns true if the vector v is inside of the patatoid and set the distance of the nearest segment and the position of the nearest point.
static bool contains (const NLMISC::CVector &v, const std::vector<CPrimVector> &points, float &distance, NLMISC::CVector &nearPos, bool isPath);
/// Returns the barycenter of the zone (warning, it may be outside of the zone if it is not convex). Returns CVector::Null if there is no vertex.
NLMISC::CVector getBarycentre() const;
/// Returns the smallest axis-aligned box containing the zone (z is always set to 0)
void getAABox( NLMISC::CVector& cornerMin, NLMISC::CVector& cornerMax ) const;
/// Return the area of the axis-aligned box containing the zone
float getAreaOfAABox() const;
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimZone);
protected:
// Get the vertices
virtual uint getNumVector () const;
virtual const CPrimVector *getPrimVector () const;
virtual CPrimVector *getPrimVector ();
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// \name From IPrimitive
virtual IPrimitive *copy () const;
};
// ***************************************************************************
/** This primitive type is used to handle unique alias across a primitive file.
* Usage of this primitive imply the setting of the appropriate 'ligo context'
* before reading or copy/pasting alias.
*/
class CPrimAlias : public IPrimitive
{
friend class CPrimitives;
/// The 'dynamic' part of the alias
uint32 _Alias;
/// The primitive container
class CPrimitives *_Container;
// Needed overloads (not used)
virtual uint getNumVector () const
{
return 0;
};
virtual const CPrimVector *getPrimVector () const
{
return NULL;
}
virtual CPrimVector *getPrimVector ()
{
return NULL;
}
virtual void onBranchLink();
// callback called just before the node is removed from it's parent
virtual void onBranchUnlink();
void regenAlias();
public:
// \name From IClassable
NLMISC_DECLARE_CLASS (CPrimAlias);
// private default constructor
CPrimAlias();
// copy constructor needed
CPrimAlias(const CPrimAlias &other);
~CPrimAlias();
// return the dynamic part of the alias
uint32 getAlias() const;
// Return the full alias, merge of the static and dynamic part
uint32 getFullAlias() const;
// Read the primitive
virtual bool read (xmlNodePtr xmlNode, const std::string &filename, uint version, CLigoConfig &config);
// Write the primitive
virtual void write (xmlNodePtr xmlNode, const std::string &filename) const;
// Create a copy of this primitive
virtual IPrimitive *copy () const;
// serial for binary save
virtual void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/*
This class is deprecated.
*/
class CPrimRegion
{
public:
std::string Name;
std::vector<CPrimPoint> VPoints;
std::vector<CPrimZone> VZones;
std::vector<CPrimPath> VPaths;
std::vector<bool> VHidePoints;
std::vector<bool> VHideZones;
std::vector<bool> VHidePaths;
public:
void serial (NLMISC::IStream &f);
};
// ***************************************************************************
/**
* This class is a ligo primitives set
*/
class CPrimitives
{
public:
CPrimitives ();
CPrimitives (const CPrimitives &other);
~CPrimitives ();
// Operator copy
CPrimitives& operator= (const CPrimitives &other);
// Convert from old format to the new one
void convert (const CPrimRegion &region);
// Read the primitive
bool read (xmlNodePtr xmlNode, const std::string &filename, CLigoConfig &config);
// Write the primitive
void write (xmlDocPtr xmlNode, const std::string &filename) const;
// Write the primitive
void write (xmlNodePtr root, const std::string &filename) const;
// serial the primitive. Used for binary files.
void serial(NLMISC::IStream &f);
// Root primitive hierarchy
CPrimNode *RootNode;
// get the static alias part for this primitive
uint32 getAliasStaticPart();
// set the static alias part for this primitive
void setAliasStaticPart(uint32 staticPart);
// Build an alias by combining the static and dynamic part
uint32 buildFullAlias(uint32 dynamicPart);
// Generate a new unique alias (dynamic part only)
uint32 genAlias(IPrimitive *prim, uint32 preferedAlias = 0);
// Reserve an alias and store it in the used alias list (dynamic part only)
// void reserveAlias(uint32 dynamicAlias);
// Remove an alias from the list of alias in use (dynamic part only)
void releaseAlias(IPrimitive *prim, uint32 dynamicAlias);
// Force the assignation of the specified alias to the primitive. If another primitive
// already hold the alias, this other primitive is assigned a new alias.
void forceAlias(CPrimAlias *prim, uint32 alias);
// get the last generated alias value (for debug only)
uint32 getLastGeneratedAlias();
// Return the primitive indexed by the given alias (ie, it doesn't return the alias primitive, but its first parent)
IPrimitive *getPrimitiveByAlias(uint32 primAlias);
// Build the complete list of indexed primitive (ie all primitive that have a primalias child)
void buildPrimitiveWithAliasList(std::map<uint32, IPrimitive*> &result);
private:
// Conversion internal methods
void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden);
void convertPrimitive (const IPrimitive *prim, bool hidden);
/// Optional context information
CLigoConfig *_LigoConfig;
/// Static part alias mapping (can be 0 if no mapping is defined)
uint32 _AliasStaticPart;
/// Last generated Alias, used to compute the next alias
uint32 _LastGeneratedAlias;
/// List of alias in use in the primitive (dynamic part only)
std::map<uint32, IPrimitive*> _AliasInUse;
// Store the filename
// This allows to retrieve the static alias when reloading from binary file
std::string _Filename;
};
// ***************************************************************************
/** Singleton to manage special loading feature related to
* unique alias assignment
*/
class CPrimitiveContext
{
static CPrimitiveContext *_Instance;
// private ctor
CPrimitiveContext();
public:
// get the singleton reference
static CPrimitiveContext &instance()
{
if (!_Instance)
{
_Instance = new CPrimitiveContext;
}
return *_Instance;
}
/// The current ligo configuration file.
CLigoConfig *CurrentLigoConfig;
/// The current primitives container.
CPrimitives *CurrentPrimitive;
};
} // namespace NLLIGO
#endif // __PRIMITIVE_H__

View file

@ -521,20 +521,6 @@ public:
*/
static bool isAbsolutePath (const std::string &path);
/** Make path absolute
* \param relativePath - The relative path
* \param directory - the directory to which the path is relative to
* \param simplify - if we should simplify or not the path (convert . and .. in path)
* returns the absolute path, or empty if something went wrong.
*/
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory, bool simplify = false );
/** Return if a path is absolute or not.
* \param path - The path
* returns true if path is absolute or false if relative.
*/
static bool isAbsolutePath (const std::string &path);
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
*/
static void addIgnoredDoubleFile(const std::string &ignoredFile);

View file

@ -102,6 +102,10 @@ CBloomEffect::~CBloomEffect()
if (_Driver) _Driver->deleteMaterial(_BlurMat);
}
}
}
//-----------------------------------------------------------------------------------------------------------
void CBloomEffect::init()
{
if (!((CDriverUser *)_Driver)->getDriver()->supportBloomEffect())

View file

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

View file

@ -1,152 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../stdopengl.h"
#include "../driver_opengl.h"
#import "cocoa_opengl_view.h"
static void viewDidResize(NSView* view, CDriverGL* driver)
{
NSRect rect = [[view superview] frame];
driver->_CurrentMode.Height = rect.size.height;
driver->_CurrentMode.Width = rect.size.width;
}
@implementation CocoaOpenGLView
-(id)initWithFrame:(NSRect)frame
{
if((self = [super initWithFrame:frame]))
{
_characterStorage = [[NSMutableAttributedString alloc] initWithString:@""];
_driver = nil;
return self;
}
return nil;
}
-(void)dealloc
{
[_characterStorage release];
[super dealloc];
}
-(void)keyDown:(NSEvent*)event
{
#ifdef NL_MAC_VERSION_10_6_UP
[[self inputContext] handleEvent:event];
#endif
}
-(void)setDriver:(CDriverGL*)driver
{
_driver = driver;
}
-(void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize
{
[super resizeWithOldSuperviewSize:oldBoundsSize];
if(!_driver)
return;
viewDidResize(self, _driver);
}
/******************************************************************************/
/* NSTextInputClient Protocol */
-(BOOL)hasMarkedText
{
return (_markedRange.location == NSNotFound ? NO : YES);
}
-(NSRange)markedRange
{
return _markedRange;
}
-(NSRange)selectedRange
{
return NSMakeRange(NSNotFound, 0);
}
-(void)setMarkedText:(id)aString
selectedRange:(NSRange)newSelection
replacementRange:(NSRange)replacementRange
{
if(replacementRange.location == NSNotFound)
replacementRange = _markedRange;
if([aString length] == 0)
{
[_characterStorage deleteCharactersInRange:replacementRange];
[self unmarkText];
}
else
{
_markedRange = NSMakeRange(replacementRange.location, [aString length]);
[_characterStorage replaceCharactersInRange:replacementRange
withString:aString];
}
}
-(void)unmarkText
{
_markedRange = NSMakeRange(NSNotFound, 0);
[[self inputContext] discardMarkedText];
}
-(NSArray*)validAttributesForMarkedText
{
return [NSArray arrayWithObjects:
NSMarkedClauseSegmentAttributeName, NSGlyphInfoAttributeName, nil];
}
-(NSAttributedString*)attributedSubstringForProposedRange:(NSRange)aRange
actualRange:(NSRangePointer)actualRange
{
return [_characterStorage attributedSubstringFromRange:aRange];
}
-(void)insertText:(id)aString
replacementRange:(NSRange)replacementRange
{
if(replacementRange.location == NSNotFound)
replacementRange = _markedRange;
[_characterStorage replaceCharactersInRange:replacementRange
withString:aString];
}
-(NSUInteger)characterIndexForPoint:(NSPoint)aPoint
{
return 0;
}
-(NSRect)firstRectForCharacterRange:(NSRange)aRange
actualRange:(NSRangePointer)actualRange
{
return NSMakeRect(0, 0, 0, 0);
}
-(void)doCommandBySelector:(SEL)aSelector
{
[super doCommandBySelector:aSelector];
}
@end

View file

@ -34,7 +34,7 @@
#include "nel/3d/water_pool_manager.h"
#include "nel/3d/u_camera.h"
#include "nel/3d/debug_vb.h"
#include "nel/misc/event_emitter.h"
#include "nel/misc/hierarchical_timer.h"
#include "nel/misc/event_emitter.h"

View file

@ -3785,8 +3785,6 @@ uint CZoneLighter::getAPatch (uint process)
nlassert(index < _PatchInfo.size());
nlassert(index < _PatchInfo.size());
if (access.value().empty())
// no more patches
return 0xffffffff;

View file

@ -496,7 +496,6 @@ void CZoneBank::reset ()
_Selection.clear ();
}
#ifdef NL_OS_WINDOWS
// ---------------------------------------------------------------------------
bool CZoneBank::initFromPath(const std::string &sPathName, std::string &error)
{
@ -516,7 +515,6 @@ bool CZoneBank::initFromPath(const std::string &sPathName, std::string &error)
return true;
}
#endif // NL_OS_WINDOWS
// ---------------------------------------------------------------------------
bool CZoneBank::addElement (const std::string &elementName, std::string &error)

View file

@ -23,8 +23,6 @@
#include "nel/misc/o_xml.h"
#include "nel/misc/o_xml.h"
using namespace NLMISC;
using namespace std;

View file

@ -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
* <http://www.gnu.org/licenses/>.
*/
#include <nel/misc/types_nl.h>
#include <nel/misc/fast_id_map.h>
// STL includes
// NeL includes
// #include <nel/misc/debug.h>
// Project includes
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLMISC {
void dummytoavoidthecompilerwarningfastidmap() { }
} /* namespace NLMISC */
/* end of file */

View file

@ -1854,84 +1854,6 @@ std::string CFileContainer::getTemporaryDirectory()
return path;
}
std::string CPath::getApplicationDirectory(const std::string &appName, bool local)
{
return getInstance()->_FileContainer.getApplicationDirectory(appName, local);
}
std::string CFileContainer::getApplicationDirectory(const std::string &appName, bool local)
{
static std::string appPaths[2];
std::string &appPath = appPaths[local ? 1 : 0];
if (appPath.empty())
{
#ifdef NL_OS_WINDOWS
wchar_t buffer[MAX_PATH];
#ifdef CSIDL_LOCAL_APPDATA
if (local)
{
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_LOCAL_APPDATA, TRUE);
}
else
#endif
{
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE);
}
appPath = CPath::standardizePath(wideToUtf8(buffer));
#else
// get user home directory from HOME environment variable
const char* homePath = getenv("HOME");
appPath = CPath::standardizePath(homePath ? homePath : ".");
#if defined(NL_OS_MAC)
appPath += "Library/Application Support/";
#else
// recommended for applications data that are owned by user
appPath += ".local/share/";
#endif
#endif
}
return CPath::standardizePath(appPath + appName);
}
std::string CPath::getTemporaryDirectory()
{
return getInstance()->_FileContainer.getTemporaryDirectory();
}
std::string CFileContainer::getTemporaryDirectory()
{
static std::string path;
if (path.empty())
{
const char *temp = getenv("TEMP");
const char *tmp = getenv("TMP");
std::string tempDir;
if (temp)
tempDir = temp;
if (tempDir.empty() && tmp)
tempDir = tmp;
#ifdef NL_OS_UNIX
if (tempDir.empty())
tempDir = "/tmp";
#else
if (tempDir.empty())
tempDir = ".";
#endif
path = CPath::standardizePath(tempDir);
}
return path;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

View file

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

View file

@ -29,10 +29,6 @@ using namespace std;
const string DefaultColTitle = "name";
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLMISC {
NL_INSTANCE_COUNTER_IMPL(CWordsDictionary);

View file

@ -233,50 +233,6 @@ void EditPatchMod::SetSelLevel(DWORD level)
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SelectSubPatch(int index)
{
if (!ip)
return;
TimeValue t = ip->GetTime();
ip->ClearCurNamedSelSet();
ModContextList mcList;
INodeTab nodes;
ip->GetModContexts(mcList, nodes);
for (int i = 0; i < mcList.Count(); i++)
{
EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
if (!patchData)
return;
RPatchMesh *rpatch;
PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch);
if (!patch)
return;
patchData->BeginEdit(t);
if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent"));
patch->patchSel.Set(index);
patchData->UpdateChanges(patch, rpatch, FALSE);
if (patchData->tempData)
{
patchData->tempData->Invalidate(PART_SELECT);
}
}
PatchSelChanged();
UpdateSelectDisplay();
NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE);
}
// ------------------------------------------------------------------------------------------------------------------------------------------------------
void EditPatchMod::SelectSubPatch(int index)
{
if (!ip)

View file

@ -1,430 +0,0 @@
// Condition.cpp: implementation of the CCondition class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "logic_editor.h"
#include "condition.h"
#include "nel/logic/logic_condition.h"
#include <vector>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLLOGIC;
//////////////////////////////////////////////////////////////////////
// CConditionNode implementation
//////////////////////////////////////////////////////////////////////
CConditionNode::CConditionNode(const CConditionNode &node)
{
this->m_dComparand = node.m_dComparand;
this->m_pParentNode = node.m_pParentNode;
this->m_sConditionName = node.m_sConditionName;
this->m_sOperator = node.m_sOperator;
this->m_sVariableName = node.m_sVariableName;
this->m_type = node.m_type;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = node.m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctSubTree.AddTail( newNode );
newNode->m_pParentNode = this;
}
}
}
CConditionNode::~CConditionNode()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
const CString & CConditionNode::getNodeAsString() const
{
m_sNodeString.Empty();
if (m_type == NOT)
m_sNodeString = "NOT";
else if (m_type == TERMINATOR)
m_sNodeString = "term";
else if (m_type == SUB_CONDITION)
m_sNodeString = m_sConditionName;
else // comparison
{
<<<<<<< HEAD
m_sNodeString.Format("%s %s %g",LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
=======
m_sNodeString.Format(_T("%s %s %g"),LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
>>>>>>> ryzomcore
}
return m_sNodeString;
}
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName(old, newName);
}
}
//
if ( m_sConditionName == old)
m_sConditionName = newName;
}
void CConditionNode::conditionDeleted( const CString &name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctSubTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//////////////////////////////////////////////////////////////////////
// CCondition implementation
//////////////////////////////////////////////////////////////////////
CCondition::CCondition()
{
}
CCondition::CCondition( const CCondition &cond)
{
this->m_sName = cond.m_sName;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctConditionTree.AddTail( newNode );
}
}
}
CCondition::~CCondition()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
void CCondition::changeConditionName( CString old, const CString &newName) const
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName( old, newName);
}
}
}
void CCondition::conditionDeleted( CString name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctConditionTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//-----------------------------------------------------
// cConditionNodeToCLogicConditionNode (Editor --> Service)
//
//-----------------------------------------------------
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
{
// if this node is a terminator node
if( conditionNode->m_type == CConditionNode::TERMINATOR )
{
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
}
else
// this node is a logic node
{
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
// part 1 : a logic block(not/comparison/subcondition)
switch( conditionNode->m_type )
{
case CConditionNode::NOT :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
}
break;
case CConditionNode::COMPARISON :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
<<<<<<< HEAD
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = string( (LPCSTR)conditionNode->m_sVariableName );
logicConditionNode->LogicBlock.ComparisonBlock.Operator = string( (LPCSTR)conditionNode->m_sOperator );
=======
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = tStrToUtf8(conditionNode->m_sVariableName);
logicConditionNode->LogicBlock.ComparisonBlock.Operator = tStrToUtf8(conditionNode->m_sOperator);
>>>>>>> ryzomcore
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
}
break;
case CConditionNode::SUB_CONDITION :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
<<<<<<< HEAD
logicConditionNode->LogicBlock.SubCondition = string( (LPCSTR)conditionNode->m_sConditionName );
=======
logicConditionNode->LogicBlock.SubCondition = tStrToUtf8(conditionNode->m_sConditionName);
>>>>>>> ryzomcore
}
break;
}
// part 2 : a condition sub tree
POSITION pos;
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
{
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
logicConditionNode->addNode( logicConditionNodeTmp );
}
}
} // cConditionNodeToCLogicConditionNode //
//-----------------------------------------------------
// cConditionToCLogicCondition (Editor --> Service)
//
//-----------------------------------------------------
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
{
// condition name
<<<<<<< HEAD
logicCondition.setName( string( (LPCSTR)condition.m_sName ) );
=======
logicCondition.setName(tStrToUtf8(condition.m_sName));
>>>>>>> ryzomcore
// nodes
POSITION pos;
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
{
// get the node
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
// convert the node
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
// add the node
logicCondition.addNode( *logicConditionNode );
}
} // cConditionToCLogicCondition //
//-----------------------------------------------------
// cLogicConditionNodeToCConditionNode (Service --> Editor)
//
//-----------------------------------------------------
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
{
// terminator node
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
{
node->m_type = CConditionNode::TERMINATOR;
}
// logic block with condition sub tree
else
{
// part 1 : a logic block(not/comparison/subcondition)
switch( logicConditionNode->LogicBlock.Type )
{
case CLogicConditionLogicBlock::NOT :
{
node->m_type = CConditionNode::NOT;
};
break;
case CLogicConditionLogicBlock::COMPARISON :
{
node->m_type = CConditionNode::COMPARISON;
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
};
break;
case CLogicConditionLogicBlock::SUB_CONDITION :
{
node->m_type = CConditionNode::SUB_CONDITION;
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
};
break;
default :
{
node->m_type = CConditionNode::TERMINATOR;
}
}
// part 2 : a condition sub tree
vector<CLogicConditionNode *>::const_iterator itNode;
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
{
CConditionNode * nodeTmp = new CConditionNode();
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
nodeTmp->m_pParentNode = node;
node->m_ctSubTree.AddTail( nodeTmp );
}
}
} // cLogicConditionNodeToCConditionNode //
//-----------------------------------------------
// cLogicConditionToCCondition
//
//-----------------------------------------------
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
{
// condition name
condition.m_sName = CString( logicCondition.getName().c_str() );
// condition tree
vector<CLogicConditionNode>::const_iterator itNode;
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
{
// convert the node
CConditionNode * node = new CConditionNode();
cLogicConditionNodeToCConditionNode( &(*itNode), node );
// add the node
condition.m_ctConditionTree.AddTail( node );
}
} // cLogicConditionToCCondition //

View file

@ -1,413 +0,0 @@
// Condition.cpp: implementation of the CCondition class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "logic_editor.h"
#include "condition.h"
#include "nel/logic/logic_condition.h"
#include <vector>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLLOGIC;
//////////////////////////////////////////////////////////////////////
// CConditionNode implementation
//////////////////////////////////////////////////////////////////////
CConditionNode::CConditionNode(const CConditionNode &node)
{
this->m_dComparand = node.m_dComparand;
this->m_pParentNode = node.m_pParentNode;
this->m_sConditionName = node.m_sConditionName;
this->m_sOperator = node.m_sOperator;
this->m_sVariableName = node.m_sVariableName;
this->m_type = node.m_type;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = node.m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctSubTree.AddTail( newNode );
newNode->m_pParentNode = this;
}
}
}
CConditionNode::~CConditionNode()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
const CString & CConditionNode::getNodeAsString() const
{
m_sNodeString.Empty();
if (m_type == NOT)
m_sNodeString = "NOT";
else if (m_type == TERMINATOR)
m_sNodeString = "term";
else if (m_type == SUB_CONDITION)
m_sNodeString = m_sConditionName;
else // comparison
{
m_sNodeString.Format("%s %s %g",LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
}
return m_sNodeString;
}
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName(old, newName);
}
}
//
if ( m_sConditionName == old)
m_sConditionName = newName;
}
void CConditionNode::conditionDeleted( const CString &name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctSubTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//////////////////////////////////////////////////////////////////////
// CCondition implementation
//////////////////////////////////////////////////////////////////////
CCondition::CCondition()
{
}
CCondition::CCondition( const CCondition &cond)
{
this->m_sName = cond.m_sName;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctConditionTree.AddTail( newNode );
}
}
}
CCondition::~CCondition()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
void CCondition::changeConditionName( CString old, const CString &newName) const
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName( old, newName);
}
}
}
void CCondition::conditionDeleted( CString name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctConditionTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//-----------------------------------------------------
// cConditionNodeToCLogicConditionNode (Editor --> Service)
//
//-----------------------------------------------------
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
{
// if this node is a terminator node
if( conditionNode->m_type == CConditionNode::TERMINATOR )
{
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
}
else
// this node is a logic node
{
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
// part 1 : a logic block(not/comparison/subcondition)
switch( conditionNode->m_type )
{
case CConditionNode::NOT :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
}
break;
case CConditionNode::COMPARISON :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = string( (LPCSTR)conditionNode->m_sVariableName );
logicConditionNode->LogicBlock.ComparisonBlock.Operator = string( (LPCSTR)conditionNode->m_sOperator );
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
}
break;
case CConditionNode::SUB_CONDITION :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
logicConditionNode->LogicBlock.SubCondition = string( (LPCSTR)conditionNode->m_sConditionName );
}
break;
}
// part 2 : a condition sub tree
POSITION pos;
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
{
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
logicConditionNode->addNode( logicConditionNodeTmp );
}
}
} // cConditionNodeToCLogicConditionNode //
//-----------------------------------------------------
// cConditionToCLogicCondition (Editor --> Service)
//
//-----------------------------------------------------
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
{
// condition name
logicCondition.setName( string( (LPCSTR)condition.m_sName ) );
// nodes
POSITION pos;
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
{
// get the node
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
// convert the node
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
// add the node
logicCondition.addNode( *logicConditionNode );
}
} // cConditionToCLogicCondition //
//-----------------------------------------------------
// cLogicConditionNodeToCConditionNode (Service --> Editor)
//
//-----------------------------------------------------
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
{
// terminator node
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
{
node->m_type = CConditionNode::TERMINATOR;
}
// logic block with condition sub tree
else
{
// part 1 : a logic block(not/comparison/subcondition)
switch( logicConditionNode->LogicBlock.Type )
{
case CLogicConditionLogicBlock::NOT :
{
node->m_type = CConditionNode::NOT;
};
break;
case CLogicConditionLogicBlock::COMPARISON :
{
node->m_type = CConditionNode::COMPARISON;
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
};
break;
case CLogicConditionLogicBlock::SUB_CONDITION :
{
node->m_type = CConditionNode::SUB_CONDITION;
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
};
break;
default :
{
node->m_type = CConditionNode::TERMINATOR;
}
}
// part 2 : a condition sub tree
vector<CLogicConditionNode *>::const_iterator itNode;
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
{
CConditionNode * nodeTmp = new CConditionNode();
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
nodeTmp->m_pParentNode = node;
node->m_ctSubTree.AddTail( nodeTmp );
}
}
} // cLogicConditionNodeToCConditionNode //
//-----------------------------------------------
// cLogicConditionToCCondition
//
//-----------------------------------------------
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
{
// condition name
condition.m_sName = CString( logicCondition.getName().c_str() );
// condition tree
vector<CLogicConditionNode>::const_iterator itNode;
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
{
// convert the node
CConditionNode * node = new CConditionNode();
cLogicConditionNodeToCConditionNode( &(*itNode), node );
// add the node
condition.m_ctConditionTree.AddTail( node );
}
} // cLogicConditionToCCondition //

View file

@ -1,413 +0,0 @@
// Condition.cpp: implementation of the CCondition class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "logic_editor.h"
#include "condition.h"
#include "nel/logic/logic_condition.h"
#include <vector>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLLOGIC;
//////////////////////////////////////////////////////////////////////
// CConditionNode implementation
//////////////////////////////////////////////////////////////////////
CConditionNode::CConditionNode(const CConditionNode &node)
{
this->m_dComparand = node.m_dComparand;
this->m_pParentNode = node.m_pParentNode;
this->m_sConditionName = node.m_sConditionName;
this->m_sOperator = node.m_sOperator;
this->m_sVariableName = node.m_sVariableName;
this->m_type = node.m_type;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = node.m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctSubTree.AddTail( newNode );
newNode->m_pParentNode = this;
}
}
}
CConditionNode::~CConditionNode()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
const CString & CConditionNode::getNodeAsString() const
{
m_sNodeString.Empty();
if (m_type == NOT)
m_sNodeString = "NOT";
else if (m_type == TERMINATOR)
m_sNodeString = "term";
else if (m_type == SUB_CONDITION)
m_sNodeString = m_sConditionName;
else // comparison
{
m_sNodeString.Format("%s %s %g",LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
}
return m_sNodeString;
}
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName(old, newName);
}
}
//
if ( m_sConditionName == old)
m_sConditionName = newName;
}
void CConditionNode::conditionDeleted( const CString &name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctSubTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//////////////////////////////////////////////////////////////////////
// CCondition implementation
//////////////////////////////////////////////////////////////////////
CCondition::CCondition()
{
}
CCondition::CCondition( const CCondition &cond)
{
this->m_sName = cond.m_sName;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctConditionTree.AddTail( newNode );
}
}
}
CCondition::~CCondition()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
void CCondition::changeConditionName( CString old, const CString &newName) const
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName( old, newName);
}
}
}
void CCondition::conditionDeleted( CString name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctConditionTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//-----------------------------------------------------
// cConditionNodeToCLogicConditionNode (Editor --> Service)
//
//-----------------------------------------------------
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
{
// if this node is a terminator node
if( conditionNode->m_type == CConditionNode::TERMINATOR )
{
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
}
else
// this node is a logic node
{
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
// part 1 : a logic block(not/comparison/subcondition)
switch( conditionNode->m_type )
{
case CConditionNode::NOT :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
}
break;
case CConditionNode::COMPARISON :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = string( (LPCSTR)conditionNode->m_sVariableName );
logicConditionNode->LogicBlock.ComparisonBlock.Operator = string( (LPCSTR)conditionNode->m_sOperator );
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
}
break;
case CConditionNode::SUB_CONDITION :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
logicConditionNode->LogicBlock.SubCondition = string( (LPCSTR)conditionNode->m_sConditionName );
}
break;
}
// part 2 : a condition sub tree
POSITION pos;
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
{
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
logicConditionNode->addNode( logicConditionNodeTmp );
}
}
} // cConditionNodeToCLogicConditionNode //
//-----------------------------------------------------
// cConditionToCLogicCondition (Editor --> Service)
//
//-----------------------------------------------------
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
{
// condition name
logicCondition.setName( string( (LPCSTR)condition.m_sName ) );
// nodes
POSITION pos;
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
{
// get the node
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
// convert the node
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
// add the node
logicCondition.addNode( *logicConditionNode );
}
} // cConditionToCLogicCondition //
//-----------------------------------------------------
// cLogicConditionNodeToCConditionNode (Service --> Editor)
//
//-----------------------------------------------------
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
{
// terminator node
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
{
node->m_type = CConditionNode::TERMINATOR;
}
// logic block with condition sub tree
else
{
// part 1 : a logic block(not/comparison/subcondition)
switch( logicConditionNode->LogicBlock.Type )
{
case CLogicConditionLogicBlock::NOT :
{
node->m_type = CConditionNode::NOT;
};
break;
case CLogicConditionLogicBlock::COMPARISON :
{
node->m_type = CConditionNode::COMPARISON;
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
};
break;
case CLogicConditionLogicBlock::SUB_CONDITION :
{
node->m_type = CConditionNode::SUB_CONDITION;
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
};
break;
default :
{
node->m_type = CConditionNode::TERMINATOR;
}
}
// part 2 : a condition sub tree
vector<CLogicConditionNode *>::const_iterator itNode;
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
{
CConditionNode * nodeTmp = new CConditionNode();
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
nodeTmp->m_pParentNode = node;
node->m_ctSubTree.AddTail( nodeTmp );
}
}
} // cLogicConditionNodeToCConditionNode //
//-----------------------------------------------
// cLogicConditionToCCondition
//
//-----------------------------------------------
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
{
// condition name
condition.m_sName = CString( logicCondition.getName().c_str() );
// condition tree
vector<CLogicConditionNode>::const_iterator itNode;
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
{
// convert the node
CConditionNode * node = new CConditionNode();
cLogicConditionNodeToCConditionNode( &(*itNode), node );
// add the node
condition.m_ctConditionTree.AddTail( node );
}
} // cLogicConditionToCCondition //

View file

@ -1,413 +0,0 @@
// Condition.cpp: implementation of the CCondition class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "logic_editor.h"
#include "condition.h"
#include "nel/logic/logic_condition.h"
#include <vector>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
using namespace std;
using namespace NLLOGIC;
//////////////////////////////////////////////////////////////////////
// CConditionNode implementation
//////////////////////////////////////////////////////////////////////
CConditionNode::CConditionNode(const CConditionNode &node)
{
this->m_dComparand = node.m_dComparand;
this->m_pParentNode = node.m_pParentNode;
this->m_sConditionName = node.m_sConditionName;
this->m_sOperator = node.m_sOperator;
this->m_sVariableName = node.m_sVariableName;
this->m_type = node.m_type;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = node.m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctSubTree.AddTail( newNode );
newNode->m_pParentNode = this;
}
}
}
CConditionNode::~CConditionNode()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
const CString & CConditionNode::getNodeAsString() const
{
m_sNodeString.Empty();
if (m_type == NOT)
m_sNodeString = "NOT";
else if (m_type == TERMINATOR)
m_sNodeString = "term";
else if (m_type == SUB_CONDITION)
m_sNodeString = m_sConditionName;
else // comparison
{
m_sNodeString.Format(_T("%s %s %g"),LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
}
return m_sNodeString;
}
void CConditionNode::changeConditionName( const CString &old, const CString &newName)
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName(old, newName);
}
}
//
if ( m_sConditionName == old)
m_sConditionName = newName;
}
void CConditionNode::conditionDeleted( const CString &name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctSubTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctSubTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctSubTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//////////////////////////////////////////////////////////////////////
// CCondition implementation
//////////////////////////////////////////////////////////////////////
CCondition::CCondition()
{
}
CCondition::CCondition( const CCondition &cond)
{
this->m_sName = cond.m_sName;
// copy sub condition node tree
CConditionNode *pNode, *newNode;
POSITION pos = cond.m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
newNode = new CConditionNode( *pNode );
this->m_ctConditionTree.AddTail( newNode );
}
}
}
CCondition::~CCondition()
{
CConditionNode *pNode = NULL;
// delete all sub nodes
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
delete pNode;
pNode = NULL;
}
}
}
void CCondition::changeConditionName( CString old, const CString &newName) const
{
CConditionNode *pNode = NULL;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
pNode->changeConditionName( old, newName);
}
}
}
void CCondition::conditionDeleted( CString name)
{
CConditionNode *pNode = NULL;
POSITION oldpos;
POSITION pos = m_ctConditionTree.GetHeadPosition();
while (pos != NULL)
{
oldpos = pos;
pNode = m_ctConditionTree.GetNext( pos );
if (pNode != NULL)
{
if ( pNode->m_sConditionName != name)
pNode->conditionDeleted(name);
else
{
this->m_ctConditionTree.RemoveAt( oldpos );
delete pNode;
pNode = NULL;
}
}
}
}
//-----------------------------------------------------
// cConditionNodeToCLogicConditionNode (Editor --> Service)
//
//-----------------------------------------------------
void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicConditionNode * logicConditionNode )
{
// if this node is a terminator node
if( conditionNode->m_type == CConditionNode::TERMINATOR )
{
logicConditionNode->Type = CLogicConditionNode::TERMINATOR;
}
else
// this node is a logic node
{
logicConditionNode->Type = CLogicConditionNode::LOGIC_NODE;
// part 1 : a logic block(not/comparison/subcondition)
switch( conditionNode->m_type )
{
case CConditionNode::NOT :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::NOT;
}
break;
case CConditionNode::COMPARISON :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = tStrToUtf8(conditionNode->m_sVariableName);
logicConditionNode->LogicBlock.ComparisonBlock.Operator = tStrToUtf8(conditionNode->m_sOperator);
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
}
break;
case CConditionNode::SUB_CONDITION :
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
logicConditionNode->LogicBlock.SubCondition = tStrToUtf8(conditionNode->m_sConditionName);
}
break;
}
// part 2 : a condition sub tree
POSITION pos;
for( pos = conditionNode->m_ctSubTree.GetHeadPosition(); pos != NULL; )
{
CConditionNode * pConditionNode = conditionNode->m_ctSubTree.GetNext( pos );
CLogicConditionNode * logicConditionNodeTmp = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNodeTmp );
logicConditionNode->addNode( logicConditionNodeTmp );
}
}
} // cConditionNodeToCLogicConditionNode //
//-----------------------------------------------------
// cConditionToCLogicCondition (Editor --> Service)
//
//-----------------------------------------------------
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
{
// condition name
logicCondition.setName(tStrToUtf8(condition.m_sName));
// nodes
POSITION pos;
for( pos = condition.m_ctConditionTree.GetHeadPosition(); pos != NULL; )
{
// get the node
CConditionNode * pConditionNode = condition.m_ctConditionTree.GetNext( pos );
// convert the node
CLogicConditionNode * logicConditionNode = new CLogicConditionNode();
cConditionNodeToCLogicConditionNode( pConditionNode, logicConditionNode );
// add the node
logicCondition.addNode( *logicConditionNode );
}
} // cConditionToCLogicCondition //
//-----------------------------------------------------
// cLogicConditionNodeToCConditionNode (Service --> Editor)
//
//-----------------------------------------------------
void cLogicConditionNodeToCConditionNode( const CLogicConditionNode * logicConditionNode, CConditionNode * node )
{
// terminator node
if(logicConditionNode->Type == CLogicConditionNode::TERMINATOR)
{
node->m_type = CConditionNode::TERMINATOR;
}
// logic block with condition sub tree
else
{
// part 1 : a logic block(not/comparison/subcondition)
switch( logicConditionNode->LogicBlock.Type )
{
case CLogicConditionLogicBlock::NOT :
{
node->m_type = CConditionNode::NOT;
};
break;
case CLogicConditionLogicBlock::COMPARISON :
{
node->m_type = CConditionNode::COMPARISON;
node->m_sVariableName = CString(logicConditionNode->LogicBlock.ComparisonBlock.VariableName.c_str());
node->m_sOperator = CString(logicConditionNode->LogicBlock.ComparisonBlock.Operator.c_str());
node->m_dComparand = (double)logicConditionNode->LogicBlock.ComparisonBlock.Comparand;
};
break;
case CLogicConditionLogicBlock::SUB_CONDITION :
{
node->m_type = CConditionNode::SUB_CONDITION;
node->m_sConditionName = CString(logicConditionNode->LogicBlock.SubCondition.c_str());
};
break;
default :
{
node->m_type = CConditionNode::TERMINATOR;
}
}
// part 2 : a condition sub tree
vector<CLogicConditionNode *>::const_iterator itNode;
for( itNode = logicConditionNode->_Nodes.begin(); itNode != logicConditionNode->_Nodes.end(); ++itNode )
{
CConditionNode * nodeTmp = new CConditionNode();
cLogicConditionNodeToCConditionNode( *itNode, nodeTmp );
nodeTmp->m_pParentNode = node;
node->m_ctSubTree.AddTail( nodeTmp );
}
}
} // cLogicConditionNodeToCConditionNode //
//-----------------------------------------------
// cLogicConditionToCCondition
//
//-----------------------------------------------
void cLogicConditionToCCondition( const CLogicCondition& logicCondition, CCondition& condition )
{
// condition name
condition.m_sName = CString( logicCondition.getName().c_str() );
// condition tree
vector<CLogicConditionNode>::const_iterator itNode;
for( itNode = logicCondition.Nodes.begin(); itNode != logicCondition.Nodes.end(); ++itNode )
{
// convert the node
CConditionNode * node = new CConditionNode();
cLogicConditionNodeToCConditionNode( &(*itNode), node );
// add the node
condition.m_ctConditionTree.AddTail( node );
}
} // cLogicConditionToCCondition //

View file

@ -157,8 +157,6 @@ int main(int argc, char **argv)
// init the Nel context
CApplicationContext *appContext = new CApplicationContext;
DisableNLDebug = true;
#endif
// disable nldebug messages in logs in Release
#ifdef NL_RELEASE
@ -169,17 +167,12 @@ int main(int argc, char **argv)
createDebug(NULL, false);
INelContext::getInstance().setWindowedApplication(true);
INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD");
INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD");
INelContext::getInstance().getWarningLog()->removeDisplayer("DEFAULT_SD");
#endif // NL_DEBUG
#ifndef NL_DEBUG
INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD");
INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD");
INelContext::getInstance().getWarningLog()->removeDisplayer("DEFAULT_SD");
#endif // NL_DEBUG
Args.addAdditionalArg("shard_id", "Shard ID to use", true, false);
Args.setVersion(getDisplayVersion());
Args.setDescription("Ryzom client");
@ -207,12 +200,10 @@ int main(int argc, char **argv)
if (Args.haveAdditionalArg("login"))
{
LoginLogin = Args.getAdditionalArg("login").front();
LoginPassword = Args.getAdditionalArg("password").front();
if (Args.haveAdditionalArg("password"))
{
LoginPassword = Args.getAdditionalArg("password").front();
LoginShardId = std::numeric_limits<uint32>::max();
if (Args.haveAdditionalArg("shard_id"))
sLoginShardId = Args.getAdditionalArg("shard_id").front();
@ -226,11 +217,13 @@ int main(int argc, char **argv)
if (Args.haveArg("p") || !CFile::isExists("client_default.cfg"))
{
std::string currentPath = CPath::getApplicationDirectory("Khanat");
// create parent directory
if (!CFile::isExists(currentPath)) CFile::createDirectory(currentPath);
// append profile ID to directory
if (Args.haveArg("p"))
{
currentPath = NLMISC::CPath::standardizePath(currentPath) + Args.getArg("p").front();
if (!CFile::isExists(currentPath)) CFile::createDirectory(currentPath);

View file

@ -1198,52 +1198,6 @@ NLMISC_COMMAND(db, "Modify Database","<Property> <Value>")
return true;
}
NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc..","<sheet_id> <name> <desc> <desc2>")
{
if (args.size() < 2) return false;
CSheetId id(args[0]);
ucstring name;
name.fromUtf8(args[1]);
ucstring desc;
ucstring desc2;
if (args.size() > 2)
desc.fromUtf8(args[2]);
if (args.size() > 2)
desc2.fromUtf8(args[3]);
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
if (pSMC)
pSMC->replaceSBrickName(id, name, desc, desc2);
else
else
{
ChatMngr.updateChatModeAndButton(CChatGroup::dyn_chat, nb);
}
return false;
return true;
}
NLMISC_COMMAND(setMissingDynstringText, "set text of missing dynamic string"," <name> <text>")
{
if (args.size() < 2) return false;
ucstring name;
name.fromUtf8(args[0]);
ucstring text;
text.fromUtf8(args[1]);
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
if (pSMC)
pSMC->replaceDynString(name, text);
else
return false;
return true;
}
NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc..","<sheet_id> <name> <desc> <desc2>")
{
if (args.size() < 2) return false;
@ -4304,8 +4258,8 @@ NLMISC_COMMAND(debugItemInfo, "simulate a ItemInfo received from server", "itemS
itemInfo.DesertMagicResistance= 133;
itemInfo.ForestMagicResistance= 500;
itemInfo.PrimaryRootMagicResistance= 341;
itemInfo.Hp= 66;
itemInfo.HpMax= 100;
itemInfo.ChaScore1= 66;
itemInfo.ChaScore1Max= 100;
itemInfo.Range= 169;
itemInfo.SapLoadCurrent= 6;
itemInfo.SapLoadMax= 30;
@ -5747,74 +5701,7 @@ NLMISC_COMMAND(em, "emote command", "<emote phrase>")
return false;
}
NLMISC_COMMAND(me, "emote command", "<emote phrase>")
{
if (args.size() < 1) return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if( pIM )
{
string emotePhrase;
if( args.size() > 0 )
{
emotePhrase = args[0];
}
for(uint i = 1; i < args.size(); ++i )
{
emotePhrase += " ";
emotePhrase += args[i];
}
CAHManager::getInstance()->runActionHandler("emote", NULL, "nb=0|behav=255|custom_phrase="+emotePhrase);
return true;
}
return false;
}
NLMISC_COMMAND(emote, "emote command", "<emote phrase>")
{
if (args.size() < 1) return false;
NLMISC_COMMAND(guildmotd, "Set or see the guild message of the day","<msg of the day>")
if( pIM )
{
string emotePhrase;
if( args.size() > 0 )
{
emotePhrase = args[0];
}
for(uint i = 1; i < args.size(); ++i )
{
emotePhrase += " ";
emotePhrase += args[i];
}
CAHManager::getInstance()->runActionHandler("emote", NULL, "nb=0|behav=255|custom_phrase="+emotePhrase);
return true;
}
return false;
}
NLMISC_COMMAND(m, "emote command", "<emote phrase>")
{
if (args.size() < 1) return false;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if( pIM )
{
string emotePhrase;
if( args.size() > 0 )
{
emotePhrase = args[0];
}
for(uint i = 1; i < args.size(); ++i )
{
emotePhrase += " ";
emotePhrase += args[i];
}
CAHManager::getInstance()->runActionHandler("emote", NULL, "nb=0|behav=255|custom_phrase="+emotePhrase);
return true;
}
return false;
}
NLMISC_COMMAND(guildmotd, "Set or see the guild message of the day","<msg of the day>")

View file

@ -258,8 +258,6 @@ void CLoginStateMachine::run()
SM_END_EVENT_TABLE
}
else
{
if (LoginCustomParameters.empty())
{
// standard procedure
SM_BEGIN_EVENT_TABLE
@ -268,16 +266,6 @@ void CLoginStateMachine::run()
SM_EVENT(ev_quit, st_end);
SM_END_EVENT_TABLE
}
}
else
{
// alternate login procedure
SM_BEGIN_EVENT_TABLE
SM_EVENT(ev_init_done, st_alt_login);
SM_EVENT(ev_skip_all_login, st_ingame);
SM_EVENT(ev_quit, st_end);
SM_END_EVENT_TABLE
}
}
else
{

View file

@ -355,38 +355,15 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR
vt->setMultiLineSpace(getTextMultiLineSpace());
vt->setModulateGlobalColor(false);
ucstring cur_time;
if (showTimestamps())
{
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false);
if (node && node->getValueBool())
cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] ");
else
cur_time = CInterfaceManager::getTimestampHuman();
}
// if text contain any color code, set the text formated and white,
// otherwise, set text normal and apply global color
size_t codePos = msg.find(ucstring("@{"));
if (codePos != ucstring::npos)
if (msg.find(ucstring("@{")) != ucstring::npos)
{
// Prepend the current time (do it after the color if the color at first position.
if (codePos == 0)
{
codePos = msg.find(ucstring("}"));
msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos);
}
else
{
msg = cur_time + msg;
}
vt->setTextFormatTaged(msg);
vt->setColor(NLMISC::CRGBA::White);
}
else
{
msg = cur_time + msg;
vt->setText(msg);
vt->setColor(col);
}

View file

@ -134,13 +134,6 @@ int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls)
return 1;
}
// ***************************************************************************
int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls)
{
CLuaIHM::pushUIOnStack(ls, dynamic_cast<CInterfaceElement *>( dynamic_cast< CDBCtrlSheet* >( CCtrlDraggable::getDraggedSheet() ) ));
return 1;
}
// ***************************************************************************
int CDBCtrlSheet::luaGetChaScore1Buff(CLuaState &ls)
{

View file

@ -682,34 +682,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
}
else
pvpFactionLogo->setActive(false);
}
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFaction)
{
if (pPlayer->getPvpMode() & PVP_MODE::PvpZoneSafe)
pvpFactionBitmap->setTexture("pvp_neutral.tga");
else
pvpFactionBitmap->setTexture("pvp_enemy_tag.tga");
}
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged)
{
if (pPlayer->getPvpMode() & PVP_MODE::PvpChallenge)
pvpFactionBitmap->setTexture("ico_curse.tga");
else if (pPlayer->isNeutralPVP())
pvpFactionBitmap->setTexture("pvp_neutral.tga");
else if (pPlayer->isAlly() && (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged))
pvpFactionBitmap->setTexture("pvp_ally_flag.tga");
else if (pPlayer->isAlly() && (pPlayer->getPvpMode() & PVP_MODE::PvpFaction))
pvpFactionBitmap->setTexture("pvp_ally_tag.tga");
else if (pPlayer->isEnemy() && (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged))
pvpFactionBitmap->setTexture("pvp_enemy_flag.tga");
else if (pPlayer->isEnemy() && (pPlayer->getPvpMode() & PVP_MODE::PvpFaction))
pvpFactionBitmap->setTexture("pvp_enemy_tag.tga");
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFactionFlagged)
pvpFactionBitmap->setTexture("pvp_enemy_flag.tga");
else if (pPlayer->getPvpMode() & PVP_MODE::PvpFaction)
pvpFactionBitmap->setTexture("pvp_enemy_tag.tga");
else
pvpFactionLogo->setActive(false);
}
else
{
@ -733,7 +705,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
pvpFactionLogo->setActive(false);
}
}
}
}
if (pvpOutpostLogo)

View file

@ -1,125 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#include "nel/misc/types_nl.h"
#include "group_in_scene.h"
/**
* Compas group
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2003
*/
class CGroupInSceneUserInfo : public CGroupInScene
{
public:
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
// Constructor
CGroupInSceneUserInfo(const TCtorParam &param);
~CGroupInSceneUserInfo();
// Build the bar
// You must rebuild if guild or title change
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
// release a group in scene. The group is then put in cache for futur reuse
//static void release(CGroupInSceneUserInfo *group);
// Show or hide the bar group
void setLeftGroupActive( bool active );
// Update dynamic data : "Selection", "Bars"
// Call it at each frame for visible title
void updateDynamicData ();
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
bool needGuildNameId() const {return _NeedGuildNameId;}
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
virtual void serial(NLMISC::IStream &f);
protected:
enum TBar
{
// Living entity Forage source
<<<<<<< HEAD
ChaScore1 = 0, Time = ChaScore1, // If making changes to this enum, please update
ChaScore3, Amount = ChaScore3, // CForageSourceCL::updateVisualPropertyBars() and
ChaScore2, Life = ChaScore2, // updateVisiblePostPos() because the ChaScore1/ChaScore3/ChaScore2
ChaScore4, Danger = ChaScore4, // properties are *not* in an array in CEntityCL.
=======
HP = 0, Time = HP, // If making changes to this enum, please update
SAP, Amount = SAP, // CForageSourceCL::updateVisualPropertyBars() and
STA, Life = STA, // updateVisiblePostPos() because the HP/SAP/STA
Focus, Danger = Focus, // properties are *not* in an array in CEntityCL.
>>>>>>> ryzomcore
Action, Spawn = Action,
NumBars
};
/// Fill NumBars elements into bars and set dbEntry
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars );
// The entity (character or forage source)
CEntityCL *_Entity;
// View text
class CViewText *_Name;
class CViewText *_Title;
class CViewText *_GuildName;
class CViewText *_TribeName;
class CViewText *_EventFaction;
// for Ring, symbol of permanent content
class CViewBitmap *_PermanentContent;
class CViewBitmap *_Bars[NumBars];
class CViewBitmap *_Target;
class CViewBitmap *_MissionTarget;
static uint _BatLength;
static NLMISC::CRGBA BarColor[NumBars];
<<<<<<< HEAD
static NLMISC::CRGBA BarColorChaScore1Negative;
=======
static NLMISC::CRGBA BarColorHPNegative;
>>>>>>> ryzomcore
// Node user leaf
static NLMISC::CCDBNodeLeaf *_Value;
static NLMISC::CCDBNodeLeaf *_ValueBegin;
static NLMISC::CCDBNodeLeaf *_ValueEnd;
// Guild icon leafs
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
// Special guild
bool _NeedGuildNameId;
bool _NeedGuildSymbolId;
bool _IsLeftGroupActive;
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
};
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H

View file

@ -1,111 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#include "nel/misc/types_nl.h"
#include "group_in_scene.h"
/**
* Compas group
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2003
*/
class CGroupInSceneUserInfo : public CGroupInScene
{
public:
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
// Constructor
CGroupInSceneUserInfo(const TCtorParam &param);
~CGroupInSceneUserInfo();
// Build the bar
// You must rebuild if guild or title change
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
// release a group in scene. The group is then put in cache for futur reuse
//static void release(CGroupInSceneUserInfo *group);
// Show or hide the bar group
void setLeftGroupActive( bool active );
// Update dynamic data : "Selection", "Bars"
// Call it at each frame for visible title
void updateDynamicData ();
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
bool needGuildNameId() const {return _NeedGuildNameId;}
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
virtual void serial(NLMISC::IStream &f);
protected:
enum TBar
{
// Living entity Forage source
HP = 0, Time = HP, // If making changes to this enum, please update
SAP, Amount = SAP, // CForageSourceCL::updateVisualPropertyBars() and
STA, Life = STA, // updateVisiblePostPos() because the HP/SAP/STA
Focus, Danger = Focus, // properties are *not* in an array in CEntityCL.
Action, Spawn = Action,
NumBars
};
/// Fill NumBars elements into bars and set dbEntry
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, std::string& dbEntry, bool *bars );
// The entity (character or forage source)
CEntityCL *_Entity;
// View text
class CViewText *_Name;
class CViewText *_Title;
class CViewText *_GuildName;
class CViewText *_TribeName;
class CViewText *_EventFaction;
// for Ring, symbol of permanent content
class CViewBitmap *_PermanentContent;
class CViewBitmap *_Bars[NumBars];
class CViewBitmap *_Target;
class CViewBitmap *_MissionTarget;
static uint _BatLength;
static NLMISC::CRGBA BarColor[NumBars];
static NLMISC::CRGBA BarColorHPNegative;
// Node user leaf
static CCDBNodeLeaf *_Value;
static CCDBNodeLeaf *_ValueBegin;
static CCDBNodeLeaf *_ValueEnd;
// Special guild
bool _NeedGuildNameId;
bool _NeedGuildSymbolId;
bool _IsLeftGroupActive;
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
};
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H

View file

@ -1,114 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#include "nel/misc/types_nl.h"
#include "group_in_scene.h"
/**
* Compas group
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2003
*/
class CGroupInSceneUserInfo : public CGroupInScene
{
public:
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
// Constructor
CGroupInSceneUserInfo(const TCtorParam &param);
~CGroupInSceneUserInfo();
// Build the bar
// You must rebuild if guild or title change
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
// release a group in scene. The group is then put in cache for futur reuse
//static void release(CGroupInSceneUserInfo *group);
// Show or hide the bar group
void setLeftGroupActive( bool active );
// Update dynamic data : "Selection", "Bars"
// Call it at each frame for visible title
void updateDynamicData ();
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
bool needGuildNameId() const {return _NeedGuildNameId;}
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
virtual void serial(NLMISC::IStream &f);
protected:
enum TBar
{
// Living entity Forage source
ChaScore1 = 0, Time = ChaScore1, // If making changes to this enum, please update
ChaScore3, Amount = ChaScore3, // CForageSourceCL::updateVisualPropertyBars() and
ChaScore2, Life = ChaScore2, // updateVisiblePostPos() because the ChaScore1/ChaScore3/ChaScore2
ChaScore4, Danger = ChaScore4, // properties are *not* in an array in CEntityCL.
Action, Spawn = Action,
NumBars
};
/// Fill NumBars elements into bars and set dbEntry
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars );
// The entity (character or forage source)
CEntityCL *_Entity;
// View text
class CViewText *_Name;
class CViewText *_Title;
class CViewText *_GuildName;
class CViewText *_TribeName;
class CViewText *_EventFaction;
// for Ring, symbol of permanent content
class CViewBitmap *_PermanentContent;
class CViewBitmap *_Bars[NumBars];
class CViewBitmap *_Target;
class CViewBitmap *_MissionTarget;
static uint _BatLength;
static NLMISC::CRGBA BarColor[NumBars];
static NLMISC::CRGBA BarColorChaScore1Negative;
// Node user leaf
static NLMISC::CCDBNodeLeaf *_Value;
static NLMISC::CCDBNodeLeaf *_ValueBegin;
static NLMISC::CCDBNodeLeaf *_ValueEnd;
// Guild icon leafs
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
// Special guild
bool _NeedGuildNameId;
bool _NeedGuildSymbolId;
bool _IsLeftGroupActive;
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
};
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H

View file

@ -1,114 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#define CL_GROUP_IN_SCENE_USER_INFO_HELP_H
#include "nel/misc/types_nl.h"
#include "group_in_scene.h"
/**
* Compas group
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2003
*/
class CGroupInSceneUserInfo : public CGroupInScene
{
public:
DECLARE_UI_CLASS(CGroupInSceneUserInfo)
// Constructor
CGroupInSceneUserInfo(const TCtorParam &param);
~CGroupInSceneUserInfo();
// Build the bar
// You must rebuild if guild or title change
static CGroupInSceneUserInfo *build (class CEntityCL *entity);
// release a group in scene. The group is then put in cache for futur reuse
//static void release(CGroupInSceneUserInfo *group);
// Show or hide the bar group
void setLeftGroupActive( bool active );
// Update dynamic data : "Selection", "Bars"
// Call it at each frame for visible title
void updateDynamicData ();
// Tells if this group actually want guildName or guildSymbol => must rebuild interface if changes
bool needGuildNameId() const {return _NeedGuildNameId;}
bool needGuildSymbolId() const {return _NeedGuildSymbolId;}
bool isLeftGroupActive() const {return _IsLeftGroupActive;}
virtual void serial(NLMISC::IStream &f);
protected:
enum TBar
{
// Living entity Forage source
HP = 0, Time = HP, // If making changes to this enum, please update
SAP, Amount = SAP, // CForageSourceCL::updateVisualPropertyBars() and
STA, Life = STA, // updateVisiblePostPos() because the HP/SAP/STA
Focus, Danger = Focus, // properties are *not* in an array in CEntityCL.
Action, Spawn = Action,
NumBars
};
/// Fill NumBars elements into bars and set dbEntry
static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars );
// The entity (character or forage source)
CEntityCL *_Entity;
// View text
class CViewText *_Name;
class CViewText *_Title;
class CViewText *_GuildName;
class CViewText *_TribeName;
class CViewText *_EventFaction;
// for Ring, symbol of permanent content
class CViewBitmap *_PermanentContent;
class CViewBitmap *_Bars[NumBars];
class CViewBitmap *_Target;
class CViewBitmap *_MissionTarget;
static uint _BatLength;
static NLMISC::CRGBA BarColor[NumBars];
static NLMISC::CRGBA BarColorHPNegative;
// Node user leaf
static NLMISC::CCDBNodeLeaf *_Value;
static NLMISC::CCDBNodeLeaf *_ValueBegin;
static NLMISC::CCDBNodeLeaf *_ValueEnd;
// Guild icon leafs
static NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> _GuildIconLeaf[256];
// Special guild
bool _NeedGuildNameId;
bool _NeedGuildSymbolId;
bool _IsLeftGroupActive;
static CGroupInSceneUserInfo *newGroupInScene(const std::string &templateName, const std::string &id);
};
#endif // CL_GROUP_IN_SCENE_USER_INFO_HELP_H

View file

@ -1497,14 +1497,7 @@ void CInterfaceManager::updateFrameEvents()
// literal version
// str = CI18N::get("uiDate");
/* str += toString("%02d", (sint)RT.getRyzomTime()) + CI18N::get("uiMissionTimerHour") + " - ";
str += CI18N::get("ui"+WEEKDAY::toString( (WEEKDAY::EWeekDay)RT.getRyzomDayOfWeek() )) + ", ";
str += CI18N::get("ui"+MONTH::toString( (MONTH::EMonth)RT.getRyzomMonthInCurrentCycle() )) + " ";
str += toString("%02d", RT.getRyzomDayOfMonth()+1) + ", ";
str += CI18N::get("uiAtysianCycle" + toString(RT.getRyzomCycle()+1) + "Ordinal") + " " + CI18N::get("uiAtysianCycle") + " ";
str += toString("%04d", RT.getRyzomYear());*/
pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:time"));
str += toString("%02d", (sint)RT.getRyzomTime()) + CI18N::get("uiMissionTimerHour") + " - ";
str += toString("%d", (sint)RT.getRyzomWeek()) + " ";
str += CI18N::get("ui"+WEEKDAY::toString( (WEEKDAY::EWeekDay)RT.getRyzomDayOfWeek() )) + " - ";
ucstring year = RT.getRyzomYearStr();
@ -1529,8 +1522,6 @@ void CInterfaceManager::updateFrameEvents()
pVT->setText(str);
}
}
}
}
}
}
@ -1961,19 +1952,22 @@ bool CInterfaceManager::saveConfig (const string &filename)
{
nlwarning("Bad user dyn chat saving");
return false;
catch(const NLMISC::EStream &)
{
nlwarning("Bad user dyn chat saving");
return false;
}
f.close();
}
catch(const NLMISC::EStream &)
{
nlwarning("Config saving failed.");
return false;
}
ContinentMngr.serialFOWMaps();
return true;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::drawViews(NL3D::UCamera camera)
{
IngameDbMngr.flushObserverCalls();
@ -2062,6 +2056,7 @@ public:
{
this->reset = reset;
}
void visitGroup( CInterfaceGroup *group )
{
const std::vector< CViewBase* > &vs = group->getViews();

View file

@ -896,55 +896,6 @@ void initAltLogin()
LoginSM.pushEvent(CLoginStateMachine::ev_login_not_alt);
}
void initAltLogin()
{
// Check the alt param
if (!LoginCustomParameters.empty())
{
// don't use login and password for alternate login
string res = checkLogin("", "", ClientApp, LoginCustomParameters);
if (res.empty())
{
if (ClientCfg.R2Mode)
{
LoginSM.pushEvent(CLoginStateMachine::ev_login_ok);
}
else
{
// Select good shard
ShardSelected = -1;
for (uint32 i = 0; i < Shards.size(); ++i)
{
if (Shards[i].ShardId == LoginShardId)
{
ShardSelected = i;
break;
}
}
if (ShardSelected == -1)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->messageBoxWithHelp(CI18N::get("uiErrServerLost"), "ui:login");
LoginSM.pushEvent(CLoginStateMachine::ev_quit);
}
else
{
LoginSM.pushEvent(CLoginStateMachine::ev_login_ok);
}
}
return;
}
}
// close the socket in case of error
HttpClient.disconnect();
// ignore error
LoginSM.pushEvent(CLoginStateMachine::ev_login_not_alt);
}
// ***************************************************************************
// Called from client.cpp
@ -1195,7 +1146,7 @@ void initShardDisplay()
for (uint fff = 0; fff < 20; ++fff)
{
CShard s ( toString("%05d",fff), fff%3, fff+32, toString("%s%d","pipo",fff),
32*fff%46546, "32.32.32.32", "http://www.ryzomcore.org" );
32*fff%46546, "32.32.32.32", "http://www.ryzom.com" );
Shards.push_back(s);
}*/
@ -1322,7 +1273,7 @@ void onlogin(bool vanishScreen = true)
// for (uint fff = 0; fff < 20; ++fff)
// {
// CShard s ( toString("%05d",fff), fff%3, fff+32, toString("%s%d","pipo",fff),
// 32*fff%46546, "32.32.32.32", "http://www.ryzomcore.org" );
// 32*fff%46546, "32.32.32.32", "http://www.ryzom.com" );
// Shards.push_back(s);
// }*/
//

View file

@ -323,152 +323,6 @@ static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
UIntToStr_2(s, sec); s[2] = 0;
}
#ifdef _WIN32
#ifndef USE_WINDOWS_FILE
static UINT g_FileCodePage = CP_ACP;
#endif
#define MY_FILE_CODE_PAGE_PARAM ,g_FileCodePage
#else
#define MY_FILE_CODE_PAGE_PARAM
#endif
static WRes MyCreateDir(const UInt16 *name)
{
#ifdef USE_WINDOWS_FILE
return CreateDirectoryW((LPCWSTR)name, NULL) ? 0 : GetLastError();
#else
CBuf buf;
WRes res;
Buf_Init(&buf);
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
res =
#ifdef _WIN32
_mkdir((const char *)buf.data)
#else
mkdir((const char *)buf.data, 0777)
#endif
== 0 ? 0 : errno;
Buf_Free(&buf, &g_Alloc);
return res;
#endif
}
static WRes OutFile_OpenUtf16(CSzFile *p, const UInt16 *name)
{
#ifdef USE_WINDOWS_FILE
return OutFile_OpenW(p, (const WCHAR *)name);
#else
CBuf buf;
WRes res;
Buf_Init(&buf);
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
res = OutFile_Open(p, (const char *)buf.data);
Buf_Free(&buf, &g_Alloc);
return res;
#endif
}
static SRes PrintString(const UInt16 *s)
{
CBuf buf;
SRes res;
Buf_Init(&buf);
res = Utf16_To_Char(&buf, s
#ifndef _USE_UTF8
, CP_OEMCP
#endif
);
if (res == SZ_OK)
fputs((const char *)buf.data, stdout);
Buf_Free(&buf, &g_Alloc);
return res;
}
static void UInt64ToStr(UInt64 value, char *s)
{
char temp[32];
int pos = 0;
do
{
temp[pos++] = (char)('0' + (unsigned)(value % 10));
value /= 10;
}
while (value != 0);
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
}
static char *UIntToStr(char *s, unsigned value, int numDigits)
{
char temp[16];
int pos = 0;
do
temp[pos++] = (char)('0' + (value % 10));
while (value /= 10);
for (numDigits -= pos; numDigits > 0; numDigits--)
*s++ = '0';
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
return s;
}
static void UIntToStr_2(char *s, unsigned value)
{
s[0] = (char)('0' + (value / 10));
s[1] = (char)('0' + (value % 10));
}
#define PERIOD_4 (4 * 365 + 1)
#define PERIOD_100 (PERIOD_4 * 25 - 1)
#define PERIOD_400 (PERIOD_100 * 4 + 1)
static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
{
unsigned year, mon, hour, min, sec;
Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
unsigned t;
UInt32 v;
UInt64 v64 = nt->Low | ((UInt64)nt->High << 32);
v64 /= 10000000;
sec = (unsigned)(v64 % 60); v64 /= 60;
min = (unsigned)(v64 % 60); v64 /= 60;
hour = (unsigned)(v64 % 24); v64 /= 24;
v = (UInt32)v64;
year = (unsigned)(1601 + v / PERIOD_400 * 400);
v %= PERIOD_400;
t = v / PERIOD_100; if (t == 4) t = 3; year += t * 100; v -= t * PERIOD_100;
t = v / PERIOD_4; if (t == 25) t = 24; year += t * 4; v -= t * PERIOD_4;
t = v / 365; if (t == 4) t = 3; year += t; v -= t * 365;
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
ms[1] = 29;
for (mon = 0;; mon++)
{
unsigned d = ms[mon];
if (v < d)
break;
v -= d;
}
s = UIntToStr(s, year, 4); *s++ = '-';
UIntToStr_2(s, mon + 1); s[2] = '-'; s += 3;
UIntToStr_2(s, (unsigned)v + 1); s[2] = ' '; s += 3;
UIntToStr_2(s, hour); s[2] = ':'; s += 3;
UIntToStr_2(s, min); s[2] = ':'; s += 3;
UIntToStr_2(s, sec); s[2] = 0;
}
void PrintError(const char *sz)
{
printf("\nERROR: %s\n", sz);

View file

@ -1626,17 +1626,10 @@ Arguments: s(actionName),s(url) ->
()setUrl("Click on Me", "http://www.domain.com/script.pChaScore1");
@endcode
*/
// CGroup
void setUrl_ss_(CStateInstance* entity, CScriptStack& stack)
{
std::string url = (std::string)stack.top();stack.pop();
std::string actionName = (std::string)stack.top();stack.pop();
CSpawnBot* pbot = botIt->getSpawnObj();
if (pbot!=NULL)
{
msg.Entities.push_back(pbot->dataSetRow());
}
}
std::string url = (std::string)stack.top();stack.pop();
std::string actionName = (std::string)stack.top();stack.pop();

View file

@ -952,19 +952,19 @@ ENTITY_VARIABLE(ChaScore1, "ChaScore1 of a player")
}
}
ENTITY_VARIABLE(MaxHP, "Max hit points of a player")
ENTITY_VARIABLE(MaxChaScore1, "Max ChaScore1 of a player")
{
ENTITY_GET_ENTITY
if (get)
{
value = toString (e->maxHp());
value = toString (e->maxChaScore1());
}
else
{
sint32 v;
NLMISC::fromString(value, v);
e->getScores()._PhysicalScores[SCORES::hit_points].Max = v;
e->getScores()._PhysicalScores[SCORES::cha_score1].Max = v;
}
}
@ -2801,7 +2801,7 @@ NLMISC_COMMAND(respawnAfterDeath,"respawnAfterDeath at re-spawn point name, it m
//-----------------------------------------------
// Simulate Resurrection by other PC until UI is ready
//-----------------------------------------------
NLMISC_COMMAND(resurrected,"Another PC resurrect PC by giving some energy","<player id(id:type:crea:dyn)><Hp gived><Sta gived><Sap gived><Focus gived>")
NLMISC_COMMAND(resurrected,"Another PC resurrect PC by giving some energy","<player id(id:type:crea:dyn)><ChaScore1 removed><ChaScore2 removed><ChaScore3 removed><ChaScore4 gived>")
{
if( args.size() == 1 )
{

View file

@ -1359,16 +1359,6 @@ void addParam(const std::string &paramStr, std::vector<TBrickParam::IIdPtr> &Par
Params.push_back(new CSBrickParamChaScore3Aura2(tail));
break;
case TBrickParam::SP_SAP_AURA2:
// $*STRUCT CSBrickParamSapAura2 TBrickParam::SP_SAP_AURA2
// $*-i uint16 RegenMod // regen modifier (in %) proportionally to item level
// $*-f float Duration // duration in seconds
// $*-f float Radius // aura radius in meters
// $*-f float TargetDisableTime // disable life aura for x seconds on targets
// $*-f float UserDisableTime // disable life aura for x seconds on user
Params.push_back(new CSBrickParamSapAura2(tail));
break;
case TBrickParam::SP_SPEEDING_UP:
// $*STRUCT CSBrickParamSpeedingUp TBrickParam::SP_SPEEDING_UP
// $*-i uint16 SpeedMod // speed modifier (in %)

View file

@ -3851,53 +3851,7 @@ struct CSBrickParamChaScore1Aura : public TBrickParam::IId
struct CSBrickParamChaScore1Aura2 : public TBrickParam::IId
{
// regen modifier (in %)
uint16 RegenMod;
// duration in seconds
float Duration;
// aura radius in meters
float Radius;
// disable life aura for x seconds on targets
float TargetDisableTime;
// disable life aura for x seconds on user
float UserDisableTime;
CSBrickParamLifeAura2():
RegenMod(),
Duration(),
Radius(),
TargetDisableTime(),
UserDisableTime()
{
_Id = TBrickParam::SP_LIFE_AURA2;
}
CSBrickParamLifeAura2(const std::string&str)
{
*this=CSBrickParamLifeAura2();
*this=str;
}
const CSBrickParamLifeAura2& operator=(const std::string& input)
{
std::vector<std::string> args;
convertInput(args, input);
if (args.size()!=5)
return *this;
ParsedOk=true;
RegenMod=atoi(args[0].c_str());
Duration=(float)atof(args[1].c_str());
Radius=(float)atof(args[2].c_str());
TargetDisableTime=(float)atof(args[3].c_str());
UserDisableTime=(float)atof(args[4].c_str());
return *this;
}
};
{
// regen modifier (in %)
uint16 RegenMod;
// duration in seconds

View file

@ -198,25 +198,6 @@ void CSpecialPowerPhrase::processParams(const vector<TBrickParam::IIdPtr> &param
}
break;
case TBrickParam::SP_LIFE_AURA2:
{
// $*STRUCT CSBrickParamLifeAura: public TBrickParam::CId <TBrickParam::SP_LIFE_AURA2>
// $*-i uint16 RegenMod // regen modifier proportionally to item level
// $*-f float Duration // duration in seconds
// $*-f float Radius // aura radius in meters
// $*-f float TargetDisableTime // disable life aura for x seconds on targets
// $*-f float UserDisableTime // disable life aura for x seconds on user
CSpecialPowerBasicAura *lifeAura = new CSpecialPowerBasicAura(_ActorRowId, this, ((CSBrickParamLifeAura *)param)->Duration, ((CSBrickParamLifeAura *)param)->UserDisableTime, ((CSBrickParamLifeAura *)param)->TargetDisableTime, POWERS::LifeAura);
if (lifeAura)
{
lifeAura->setRadius(((CSBrickParamLifeAura *)param)->Radius);
lifeAura->setFamilies(EFFECT_FAMILIES::PowerRootLifeAura,EFFECT_FAMILIES::PowerLifeAura );
lifeAura->setParamValue(((CSBrickParamLifeAura *)param)->RegenMod*quality);
lifeAura->setByPass(isConsumable);
}
}
break;
case TBrickParam::SP_ChaScore1_AURA2:
{
// $*STRUCT CSBrickParamChaSCore1Aura: public TBrickParam::CId <TBrickParam::SP_ChaScore1_AURA2>
@ -237,19 +218,6 @@ void CSpecialPowerPhrase::processParams(const vector<TBrickParam::IIdPtr> &param
}
break;
case TBrickParam::SP_STAMINA_AURA2:
{
CSpecialPowerBasicAura *staminaAura = new CSpecialPowerBasicAura(_ActorRowId, this, ((CSBrickParamStaminaAura*)param)->Duration, ((CSBrickParamLifeAura *)param)->UserDisableTime, ((CSBrickParamStaminaAura *)param)->TargetDisableTime, POWERS::StaminaAura);
if (staminaAura)
{
staminaAura->setRadius(((CSBrickParamStaminaAura *)param)->Radius);
staminaAura->setFamilies(EFFECT_FAMILIES::PowerRootStaminaAura,EFFECT_FAMILIES::PowerStaminaAura );
staminaAura->setParamValue(((CSBrickParamStaminaAura *)param)->RegenMod*quality);
staminaAura->setByPass(isConsumable);
}
}
break;
case TBrickParam::SP_ChaScore2_AURA:
{
CSpecialPowerBasicAura *ChaScore2Aura = new CSpecialPowerBasicAura(_ActorRowId, this, ((CSBrickParamChaScore2Aura*)param)->Duration, ((CSBrickParamChaScore1Aura *)param)->UserDisableTime, ((CSBrickParamChaScore2Aura *)param)->TargetDisableTime, POWERS::ChaScore2Aura);

View file

@ -15886,18 +15886,6 @@ bool CCharacter::isFriendOf(const NLMISC::CEntityId &id)
return false;
}
//--------------------------------------------------------------
// CCharacter::referencedAsFriendBy()
//--------------------------------------------------------------
void CCharacter::referencedAsFriendBy( const NLMISC::CEntityId &id)
{
if (isFriendOf(id))
{
return;
}
return false;
}
//--------------------------------------------------------------
// CCharacter::referencedAsFriendBy()
//--------------------------------------------------------------
@ -19565,6 +19553,9 @@ void CCharacter::setLeagueId(TChanID id, bool removeIfEmpty)
CPVPManager2::getInstance()->broadcastMessage(id, string("<INFO>"), "<-- "+name);
}
_LeagueId = id;
updatePVPClanVP();
}
//------------------------------------------------------------------------------

View file

@ -528,15 +528,6 @@ void CPVPManager2::removeFactionChannelForCharacter(TChanID channel, CCharacter
_CharacterChannels.erase(user->getId());
_CharacterChannels.insert(make_pair(user->getId(), currentChannels));
}
// Update channel list for player
currentChannels.erase(currentChannels.begin() + i);
std::map< NLMISC::CEntityId, std::vector<TChanID> >::iterator it = _CharacterChannels.find(user->getId());
if( it != _CharacterChannels.end() )
{
_CharacterChannels.erase(user->getId());
_CharacterChannels.insert(make_pair(user->getId(), currentChannels));
}
}
}
@ -778,7 +769,6 @@ PVP_RELATION::TPVPRelation CPVPManager2::getPVPRelation( CCharacter * actor, CEn
relationTmp = PVP_RELATION::NeutralPVP;
}
relation = relationTmp;
}
}
////////////////////////////////////////////////////////
}

View file

@ -1,43 +0,0 @@
*HASH_VALUE bodypartID name ia da p pia pda description
_ACB9BC721BA65099 HHead head a the heads \d the
_278A7C5D654814CD HChest chest a the chests \d the
_A2D940906B29B889 HArms arms \d the arms \d the
_B1CAFC85DB767C9C HHands hands \d the hands \d the
_20A8389BAC987C9F HLegs legs \d the legs \d the
_E18820962C586494 HFeet feet \d the feet \d the
_ACB9BC7B1B375099 QHead head a the heads \d the
_E80BB4A21A9838B5 QBody body a the bodies \d the
_C96F0919D2F8DC71 QFrontPaws forelegs \d the forelegs \d the
_08A1A8FEABC3CD11 QFrontHooves forelegs \d the forelegs \d the
_23B95F02A87957B0 QRearPaws hind legs \d the hind legs \d the
_D880990C5BE9DCB7 QRearHooves hind legs \d the hind legs \d the
_2836645DDE8874AD LKHead head a the heads \d the
_ED86C05FE298A4B9 LKBody body a the bodies \d the
_39BFC0EBE486B512 LKFrontPaws1 forelegs \d the forelegs \d the
_79BFC0EBE486B512 LKFrontPaws2 forelegs \d the forelegs \d the
_D92BB508D8F884A6 LKRearPaws1 hind legs \d the hind legs \d the
_D93BB508D8F884A6 LKRearPaws2 hind legs \d the hind legs \d the
_283664575C8874AD FKHead head a the heads \d the
_ED86C0596098A4B9 FKBody body a the bodies \d the
_DBBA7473640310B0 FKPaws1 legs \d the legs \d the
_1BBA7473641310B0 FKPaws2 legs \d the legs \d the
_66B6A47A4A7ADCC2 FKWings1 wings \d the wings \d the
_66B6A47ACA7ADCC2 FKWings2 wings \d the wings \d the
_ACB9BC701B865099 FHead head a the heads \d the
_E80BB4971AE738B5 FBody body a the bodies \d the
_C40D15A82A36DF2C FFrontFins1 fore fins \d the fore fins \d the
_C41D15A82A36DF2C FFrontFins2 fore fins \d the fore fins \d the
_67B624EBAAF630A4 FRearFins1 hind fins \d the hind fins \d the
_67B628EBAAF630A4 FRearFins2 hind fins \d the hind fins \d the
_ACB9BC6C1B465099 BHead head a the heads \d the
_E80BB4931AA738B5 BBody body a the bodies \d the
_25897F8F25594780 BFeet1 feet \d the feet \d the
_2589838F25594B80 BFeet2 feet \d the feet \d the
_2C68746BA436D3C2 BWings1 wings \d the wings \d the
_2C68746BA446D7C2 BWings2 wings \d the wings \d the
_8061E6E18C3EA521 PUpperTrunk upper trunk an the upper trunks \d the
_ECEA3087A666CCC3 Ptrunk trunk a the trunks \d the
_E7469C4D9B5A0C9D PLeaves1 leaf a the leaves \d the
_E7469C4DDB5A0C9D PLeaves2 leaf a the leaves \d the
_C3EE9906771FB524 PLowerTrunk lower trunk a the lower trunks \d the
_DFA67A5CC7DECDE6 PVisibleRoots visible root a the visible roots \d the

View file

@ -0,0 +1,9 @@
*HASH_VALUE career ID name * noms français ia da p pia pda
_1700C956C37FB64F MeleeFighter Melee Fighter Combattant Contact a the Melee Fighters the
_9720B95DC35FBA54 RangeFighter Range Fighter Combattant Distance a the Range Fighters the
_D32171700AD23D57 AttackCaster Attack Caster Caster Attaque an the Attack Casters the
_9A511D668371AE04 BufferCaster Buffer Caster Caster Buffer a the Buffer Casters the
_1C01F56701816E0A HealerCaster Healer Caster Caster Healer a the Healer Casters the
_A6473C7A6A380099 Ranger Ranger Ranger a the Rangers the
_EA665D00EAE788B3 Shopkeeper Merchant Marchand a the Merchants the
_2D28B08D636AEC9E Artisan Crafter Crafter a the Crafters the

View file

@ -0,0 +1,9 @@
*HASH_VALUE characteristic_ID name
_B009C46E316AACBF Constitution constitution
_661AAC8EE6098C96 Metabolism metabolism
_E45ADC6364A9D4A6 Intelligence intelligence
_E7DB9090281BA0A8 Wisdom wisdom
_649C448C681C74B8 Strength strength
_6A880849E7D8DC86 WellBalanced balance
_ADB8DC9A6C5A10B6 Dexterity dexterity
_6C18945C6C1894DC Will will

View file

@ -0,0 +1,33 @@
*HASH_VALUE job ID name * noms français ia da p pia pda
_7B0C6949087BEF17 IreFighter Ire Fighter guerrier fou an the Ire Fighters the
_DA264262C82FA5E4 Swashbuckler Swashbuckler bretteur a the Swashbucklers the
_FF1001FD1B8460C5 KamicFist Kamic Fist poing kamique a the Kamic Fists the
_E9959ADC3E303D21 BladeBearer Blade Bearer porte lame a the Blade Bearers the
_AF5E35F1250C04D2 WindChild Wind Child enfant des vents a the Wind Children the
_2F47F87A6F381C99 Runner Runner courreur a the Runners the
_73AAF09AE4B710A3 Scout Scout éclaireur a the Scouts the
_C66185C2249CA8A6 FireLance Fire Lancer lance-feu a the Fire Lancers the
_296AE474AB790894 Witherer Witherer fletrisseur a the Witherers the
_AD68C069ED7714A0 Fouler Fouler pestilent a the Foulers the
_B290F10227B8C8B3 Disturber Disturber troubleur d'esprit a the Disturbers the
_0250C5039B06F5C8 KamicFury Kamic Fury furie kamique a the Kamic Furies the
_757B279C53FC9BAB SpiritualShield Spiritual Shield bouclier spirituel a the Spiritual Shields the
_EE4990771C86D494 Faker Faker trompeur a the Fakers the
_A045250E026EC63E WindGuardian Wind Guardian gardien des vents a the Wind Guardians the
_0B806EC710885A48 KamicGuardian Kamic Guardian bouclier kamique a the Kamic Guardians the
_C4438A71C41C6642 SecondBreath Second Breath second souffle a the Second Breaths the
_2FE51E469C502DFD LifeStealer Life Stealer voleur de vie a the Life Stealers the
_FEBE4D8AEEBD5D18 SecondLife Second Life seconde vie a the Second Lives the
_B7AF21058A5F88E1 SapCristal Sap Crystal cristal de sève a the Sap Crystals the
_DE48CAEB05734249 ScarletHunter Scarlet Hunter chasseur écarlate a the Scarlet Hunters the
_31D7E2E30551753A GreenHunter Green Hunter chasseur vert a the Green Hunters the
_06635A6B444DEE4C ShadowHunter Shadow Hunter chasseur de l'ombre a the Shadow Hunters the
_99D26A1506D4F24B AtysGuardian Atys Guardian gardien d'atys an the Atys Guardians the
_2BB7F7E25BC3D54D SandCaravanner Sand Karavanner caravanier des sables a the Sand Karavanners the
_7CD608D036D57BF2 ImperialSupplier Imperial Supplier pourvoyeur impérial an the Imperial Suppliers the
_6C49C893E6B9849D Steward Steward intendants a the Stewards the
_A8C84C6F6A9710A2 Hawker Hawker colporteurs a the Hawkers the
_44BE25E43BDAF009 FireMaster Fire Master maitre du feu a the Fire Masters the
_0BF32E6C860E7A26 FlowerMaster Flower Master maitre des fleurs a the Flower Masters the
_802D1DEA3BDAF002 LakeMaster Lake Master maitre des lacs a the Lake Masters the
_348DF50C62FA70BB SapMaster Sap Master maitre de la sève a the Sap Masters the

View file

@ -0,0 +1,5 @@
*HASH_VALUE score_ID name point ia points
_BE6C89EE2F599BBE HitPoints HP hit point a hit points
_B0DF4A6ECA004C1B Stamina stamina stamina point a stamina points
_174A57AA672A04AA Sap sap sap point a sap points
_DB69E9025629B0BA Focus focus focus point a focus points