From 3fa0aa22168309a744500d5b1cb46c0c6d7397c2 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 7 Apr 2012 14:57:15 +0200 Subject: [PATCH] Fixed: #1448 Compilation with CLang --- code/ryzom/common/src/game_share/txt_command.h | 14 +++++++------- code/ryzom/server/src/ai_service/child_container.h | 4 ++-- code/ryzom/server/src/ai_service/commands.cpp | 2 +- .../ryzom/server/src/ai_service/family_profile.cpp | 5 +---- .../server/src/ai_service/script_compiler.cpp | 8 ++++---- .../src/entities_game_service/harvest_source.cpp | 13 ++++++++++++- .../src/entities_game_service/harvest_source.h | 4 ++-- .../phrase_manager/environmental_effect.cpp | 12 ++++++++++++ .../phrase_manager/environmental_effect.h | 4 ++-- .../src/entities_game_service/player_manager/cdb.h | 8 ++++---- .../player_manager/cdb_branch.cpp | 6 +++--- code/ryzom/server/src/pd_lib/pds_common.h | 2 +- 12 files changed, 51 insertions(+), 31 deletions(-) diff --git a/code/ryzom/common/src/game_share/txt_command.h b/code/ryzom/common/src/game_share/txt_command.h index f8d2ec39e..054f1bc93 100644 --- a/code/ryzom/common/src/game_share/txt_command.h +++ b/code/ryzom/common/src/game_share/txt_command.h @@ -50,21 +50,21 @@ static CTxtCommandSetPtr<__CTxtCommandSet_##setName> setName; //------------------------------------------------------------------------------------------------- #define TXT_COMMAND(cmdName,setName,CONTEXT_CLASS)\ -struct __CTxtCommand_##cmdName: public ITxtCommand\ +struct __CTxtCommand_##cmdName##CONTEXT_CLASS: public ITxtCommand\ {\ - static __CTxtCommand_##cmdName* getInstance()\ + static __CTxtCommand_##cmdName##CONTEXT_CLASS* getInstance()\ {\ - static __CTxtCommand_##cmdName *p=NULL;\ - if (p==NULL) p= new __CTxtCommand_##cmdName;\ + static __CTxtCommand_##cmdName##CONTEXT_CLASS *p=NULL;\ + if (p==NULL) p= new __CTxtCommand_##cmdName##CONTEXT_CLASS;\ return p;\ }\ virtual const char* getName() const {return #cmdName;}\ virtual CTxtCommandResult execute(CONTEXT_CLASS& context,const NLMISC::CVectorSString& args,const NLMISC::CSString& rawArgs,const NLMISC::CSString& fullCmdLine);\ private:\ - __CTxtCommand_##cmdName() {}\ + __CTxtCommand_##cmdName##CONTEXT_CLASS() {}\ };\ -static ITxtCommandRegisterer<__CTxtCommand_##cmdName,__CTxtCommandSet_##setName> __CTxtCommand_##cmdName##_Registerer;\ -CTxtCommandResult __CTxtCommand_##cmdName::execute(CONTEXT_CLASS& context,const NLMISC::CVectorSString& args,const NLMISC::CSString& rawArgs,const NLMISC::CSString& fullCmdLine) +static ITxtCommandRegisterer<__CTxtCommand_##cmdName##CONTEXT_CLASS,__CTxtCommandSet_##setName> __CTxtCommand_##cmdName##CONTEXT_CLASS##_Registerer;\ +CTxtCommandResult __CTxtCommand_##cmdName##CONTEXT_CLASS::execute(CONTEXT_CLASS& context,const NLMISC::CVectorSString& args,const NLMISC::CSString& rawArgs,const NLMISC::CSString& fullCmdLine) //------------------------------------------------------------------------------------------------- diff --git a/code/ryzom/server/src/ai_service/child_container.h b/code/ryzom/server/src/ai_service/child_container.h index 79ffa832c..ce2eb1d27 100644 --- a/code/ryzom/server/src/ai_service/child_container.h +++ b/code/ryzom/server/src/ai_service/child_container.h @@ -546,13 +546,13 @@ CAliasTreeOwner* CAliasCont::getAliasChildByAlias(uint32 alias) const template CAliasTreeOwner* CAliasCont::addAliasChild(CAliasTreeOwner* child) { - return NLMISC::type_cast(addChild(static_cast(child))); + return NLMISC::type_cast(this->addChild(static_cast(child))); } template CAliasTreeOwner* CAliasCont::addAliasChild(CAliasTreeOwner* child, uint32 index) { - return NLMISC::type_cast(addChild(static_cast(child), index)); + return NLMISC::type_cast(this->addChild(static_cast(child), index)); } template diff --git a/code/ryzom/server/src/ai_service/commands.cpp b/code/ryzom/server/src/ai_service/commands.cpp index a85e8fe1c..98063d7e3 100644 --- a/code/ryzom/server/src/ai_service/commands.cpp +++ b/code/ryzom/server/src/ai_service/commands.cpp @@ -844,7 +844,7 @@ public: } protected: private: - size_t _index; + uint32 _index; float _value; bool _detailled; mutable CLogStringWriter _stringWriter; diff --git a/code/ryzom/server/src/ai_service/family_profile.cpp b/code/ryzom/server/src/ai_service/family_profile.cpp index c01faf37f..f95f142c9 100644 --- a/code/ryzom/server/src/ai_service/family_profile.cpp +++ b/code/ryzom/server/src/ai_service/family_profile.cpp @@ -172,6 +172,7 @@ IAiFactory *_ProfileNpc=&_singleProfileNpc; extern IAiFactory *_ProfileTribe; // in another cpp. +NL_ISO_TEMPLATE_SPEC CAiFactoryContainer *CAiFactoryContainer::_Instance = NULL; CFamilyProfileFactory::CFamilyProfileFactory() { @@ -217,10 +218,6 @@ IFamilyProfile* CFamilyProfileFactory::createFamilyProfile(const TStringId &keyW return NULL; } - -NL_ISO_TEMPLATE_SPEC CAiFactoryContainer *CAiFactoryContainer::_Instance = NULL; - - IFamilyProfile* IFamilyProfile::createFamilyProfile(const TStringId &profileName, const IFamilyProfile::CtorParam& ctorParam) { return CFamilyProfileFactory::createFamilyProfile(profileName, ctorParam); diff --git a/code/ryzom/server/src/ai_service/script_compiler.cpp b/code/ryzom/server/src/ai_service/script_compiler.cpp index 03d0fe336..a9982ef48 100644 --- a/code/ryzom/server/src/ai_service/script_compiler.cpp +++ b/code/ryzom/server/src/ai_service/script_compiler.cpp @@ -1933,7 +1933,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const case CScriptVM::JUMP: byteCode.push_back(op); // + Jump offset. - size_t index; + uint32 index; NLMISC::fromString(param, index); jumpTable.add(CJumpRememberer(index)); byteCode.push_back(0); // Invalid @@ -1950,7 +1950,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const { if (str.find("Atof")!=string::npos) { - size_t index; + uint32 index; NLMISC::fromString(param, index); --index; string &strRef=_childTracers[index]->_TextValue; @@ -1962,7 +1962,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const if (str.find("String")!=string::npos) { - size_t index; + uint32 index; NLMISC::fromString(param, index); --index; string &strRef=_childTracers[index]->_TextValue; @@ -2021,7 +2021,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const if (str.find("Code")!=string::npos) { - size_t index; + uint32 index; NLMISC::fromString(param, index); --index; if (byteCode.size()==0) diff --git a/code/ryzom/server/src/entities_game_service/harvest_source.cpp b/code/ryzom/server/src/entities_game_service/harvest_source.cpp index c655e2ebc..186615e45 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.cpp +++ b/code/ryzom/server/src/entities_game_service/harvest_source.cpp @@ -90,6 +90,14 @@ sint8 ExplosionResetPeriod = 50; // 5 s CHarvestSource AutoSpawnSourceIniProperties; +/* + * Access to singleton + */ +CHarvestSourceManager *CHarvestSourceManager::getInstance() +{ + return (CHarvestSourceManager*)_Instance; +} + /* * Initialization of source manager */ @@ -103,7 +111,10 @@ void CHarvestSourceManager::init( TDataSetIndex baseRowIndex, TDataSetIndex size //AutoSpawnSourceIniProperties.setDistVis( 100 ); } - +void CHarvestSourceManager::release() +{ + delete (CHarvestSourceManager*)_Instance; +} /* * HarvestSource constructor diff --git a/code/ryzom/server/src/entities_game_service/harvest_source.h b/code/ryzom/server/src/entities_game_service/harvest_source.h index 59556115e..edd9c546a 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.h +++ b/code/ryzom/server/src/entities_game_service/harvest_source.h @@ -391,13 +391,13 @@ class CHarvestSourceManager : public CSimpleEntityManager public: /// Singleton access - static CHarvestSourceManager *getInstance() { return (CHarvestSourceManager*)_Instance; } + static CHarvestSourceManager *getInstance(); /// Initialization void init( TDataSetIndex baseRowIndex, TDataSetIndex size ); /// Release - static void release() { delete (CHarvestSourceManager*)_Instance; } + static void release(); }; diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp index 984003b20..fabb37350 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp @@ -67,3 +67,15 @@ NLMISC_DYNVARIABLE( uint, NbEnvironmentalEffects, "Number of environmental effec if ( get ) *pointer = CEnvironmentalEffectManager::getInstance()->nbEntities(); } + +/// Singleton access +CEnvironmentalEffectManager *CEnvironmentalEffectManager::getInstance() +{ + return (CEnvironmentalEffectManager*)_Instance; +} + +/// Release +void CEnvironmentalEffectManager::release() +{ + delete (CEnvironmentalEffectManager*)_Instance; +} diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h index 0c81370a9..e53049cca 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h @@ -89,10 +89,10 @@ class CEnvironmentalEffectManager : public CSimpleEntityManager