Fixed: #1448 Compilation with CLang

This commit is contained in:
kervala 2012-04-07 14:57:15 +02:00
parent 0c72dc612d
commit de5137d0f6
12 changed files with 51 additions and 31 deletions

View file

@ -50,21 +50,21 @@ static CTxtCommandSetPtr<__CTxtCommandSet_##setName> setName;
//-------------------------------------------------------------------------------------------------
#define TXT_COMMAND(cmdName,setName,CONTEXT_CLASS)\
struct __CTxtCommand_##cmdName: public ITxtCommand<CONTEXT_CLASS>\
struct __CTxtCommand_##cmdName##CONTEXT_CLASS: public ITxtCommand<CONTEXT_CLASS>\
{\
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)
//-------------------------------------------------------------------------------------------------

View file

@ -546,13 +546,13 @@ CAliasTreeOwner* CAliasCont<TChld>::getAliasChildByAlias(uint32 alias) const
template <class TChld>
CAliasTreeOwner* CAliasCont<TChld>::addAliasChild(CAliasTreeOwner* child)
{
return NLMISC::type_cast<CAliasTreeOwner*>(addChild(static_cast<TChld*>(child)));
return NLMISC::type_cast<CAliasTreeOwner*>(this->addChild(static_cast<TChld*>(child)));
}
template <class TChld>
CAliasTreeOwner* CAliasCont<TChld>::addAliasChild(CAliasTreeOwner* child, uint32 index)
{
return NLMISC::type_cast<CAliasTreeOwner*>(addChild(static_cast<TChld*>(child), index));
return NLMISC::type_cast<CAliasTreeOwner*>(this->addChild(static_cast<TChld*>(child), index));
}
template <class TChld>

View file

@ -844,7 +844,7 @@ public:
}
protected:
private:
size_t _index;
uint32 _index;
float _value;
bool _detailled;
mutable CLogStringWriter _stringWriter;

View file

@ -172,6 +172,7 @@ IAiFactory<IFamilyProfile> *_ProfileNpc=&_singleProfileNpc;
extern IAiFactory<IFamilyProfile> *_ProfileTribe; // in another cpp.
NL_ISO_TEMPLATE_SPEC CAiFactoryContainer<IFamilyProfile, TStringId> *CAiFactoryContainer<IFamilyProfile, TStringId>::_Instance = NULL;
CFamilyProfileFactory::CFamilyProfileFactory()
{
@ -217,10 +218,6 @@ IFamilyProfile* CFamilyProfileFactory::createFamilyProfile(const TStringId &keyW
return NULL;
}
NL_ISO_TEMPLATE_SPEC CAiFactoryContainer<IFamilyProfile, TStringId> *CAiFactoryContainer<IFamilyProfile, TStringId>::_Instance = NULL;
IFamilyProfile* IFamilyProfile::createFamilyProfile(const TStringId &profileName, const IFamilyProfile::CtorParam& ctorParam)
{
return CFamilyProfileFactory::createFamilyProfile(profileName, ctorParam);

View file

@ -1933,7 +1933,7 @@ void CSubRuleTracer::generateCode(CSmartPtr<AIVM::CByteCode> &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<AIVM::CByteCode> &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<AIVM::CByteCode> &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<AIVM::CByteCode> &cByteCode) const
if (str.find("Code")!=string::npos)
{
size_t index;
uint32 index;
NLMISC::fromString(param, index);
--index;
if (byteCode.size()==0)

View file

@ -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

View file

@ -391,13 +391,13 @@ class CHarvestSourceManager : public CSimpleEntityManager<CHarvestSource>
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();
};

View file

@ -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;
}

View file

@ -89,10 +89,10 @@ class CEnvironmentalEffectManager : public CSimpleEntityManager<CEnvironmentalEf
public:
/// Singleton access
static CEnvironmentalEffectManager *getInstance() { return (CEnvironmentalEffectManager*)_Instance; }
static CEnvironmentalEffectManager *getInstance();
/// Release
static void release() { delete (CEnvironmentalEffectManager*)_Instance; }
static void release();
};

View file

@ -288,10 +288,10 @@ public :
TCDBDataIndex getDataIndex() const { return _DataIndex; }
/// Set the atomic branch flag (when all the modified nodes of a branch should be tranmitted at the same time)
void setAtomic( bool atomicBranch ) { _Atomic = atomicBranch; }
void setAtomic( bool atomicBranch ) { _AtomicFlag = atomicBranch; }
/// Return true if the branch has the atomic flag
bool isAtomic() const { return _Atomic; }
bool isAtomic() const { return _AtomicFlag; }
/** Attach callback. Allow to attach a callback function that some code could call
* when an instance of this node is changed.
@ -307,7 +307,7 @@ protected:
ICDBStructNode()
: _BankLabels(NULL),
_DataIndex(CDB_INVALID_DATA_INDEX),
_Atomic(false),
_AtomicFlag(false),
_ChangeCallback(NULL)
{}
@ -325,7 +325,7 @@ protected:
TCDBDataIndex _DataIndex;
/// Atomic flag: is the branch an atomic group, or is the leaf a member of an atomic group
bool _Atomic;
bool _AtomicFlag;
/// Optional callback pointer.
TNodeChangeCallback _ChangeCallback;

View file

@ -186,7 +186,7 @@ void ICDBStructNode::setLabel( const std::string& bankName )
*/
void CCDBStructNodeBranch::initDataIndex( TCDBDataIndex& index )
{
if ( _Atomic )
if ( _AtomicFlag )
{
_DataIndex = index;
checkIfNotMaxIndex();
@ -207,7 +207,7 @@ void CCDBStructNodeBranch::initDataIndex( TCDBDataIndex& index )
*/
void CCDBStructNodeBranch::initIdAndCallForEachIndex( CBinId& id, void (*callback)(ICDBStructNode*, void*), void *arg )
{
if ( _Atomic )
if ( _AtomicFlag )
{
callback( this, arg );
}
@ -537,7 +537,7 @@ TCDBDataIndex CCDBStructNodeBranch::findDataIndex( ICDBStructNode::CTextId& id )
*/
void CCDBStructNodeBranch::foreachAtomBranchCall( void (*callback)(void*,TCDBDataIndex), void *arg ) const
{
if ( _Atomic )
if ( _AtomicFlag )
{
callback( arg, _DataIndex );
}

View file

@ -144,7 +144,7 @@ bool getProperty(xmlNodePtr node, const char* propName, T &result, const T &defa
if (!NLMISC::CIXml::getPropertyString(res, node, propName))
{
if (!quiet)
nlwarning("Couldn't get property '%s' in xml node, use '%s' value instead", propName, toString(defaultValue).c_str());
nlwarning("Couldn't get property '%s' in xml node, use '%s' value instead", propName, NLMISC::toString(defaultValue).c_str());
result = defaultValue;
return false;
}