diff -r 2d735b28e5f8 code/nel/include/nel/ligo/primitive_utils.h --- a/code/nel/include/nel/ligo/primitive_utils.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/nel/include/nel/ligo/primitive_utils.h Wed Sep 22 11:00:19 2010 +0200 @@ -162,7 +162,8 @@ { while (!_IndexStack.empty()) { - if (_IndexStack.back() == ~0) + // uint cast is to prevent warn with gcc but use of complement with uint is weird + if (_IndexStack.back() == (uint) ~0) { _IndexStack.back() = 0; // we need to check the current node. diff -r 2d735b28e5f8 code/ryzom/client/src/continent_manager_build.cpp --- a/code/ryzom/client/src/continent_manager_build.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/client/src/continent_manager_build.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -194,7 +194,7 @@ // get alias and region name - uint32 alias; + uint32 alias = 0; string primName, primAlias; vGenRes[i]->getPropertyByName("name", primName); diff -r 2d735b28e5f8 code/ryzom/server/src/ai_data_service/pacs_scan.cpp --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -2130,8 +2130,8 @@ { uint8 *linePtr = lineBuffer; uint8 *linePtrHM = lineBufferHM; - uint8 pointBuffer; - uint8 pointBufferHM; + uint8 pointBuffer = 0; + uint8 pointBufferHM = 0; CMapPosition pos(scanpos); diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/ai_entity_matrix.h --- a/code/ryzom/server/src/ai_service/ai_entity_matrix.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/ai_entity_matrix.h Wed Sep 22 11:00:19 2010 +0200 @@ -241,12 +241,12 @@ { public: inline CCellTblIteratorLinear(): - _matrix(NULL), _tbl(NULL), _x(0), _y(0), _runLengthRemaining(0) + _x(0), _y(0), _matrix(NULL), _tbl(NULL), _runLengthRemaining(0) { } inline CCellTblIteratorLinear(const CAIEntityMatrix *matrix,const CAIEntityMatrixIteratorTblLinear *tbl,const CAIVector &pos): - _matrix(matrix), _tbl(tbl), _x((uint16)pos.x().asInt16Meters()), _y((uint16)pos.y().asInt16Meters()) + _x((uint16)pos.x().asInt16Meters()), _y((uint16)pos.y().asInt16Meters()), _matrix(matrix), _tbl(tbl) { #ifdef NL_DEBUG nlassert(_tbl!=NULL); diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/ai_entity_physical_inline.h --- a/code/ryzom/server/src/ai_service/ai_entity_physical_inline.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/ai_entity_physical_inline.h Wed Sep 22 11:00:19 2010 +0200 @@ -1,611 +1,611 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - - -#ifndef RYAI_ENTITY_PHYSICAL_INLINE_H -#define RYAI_ENTITY_PHYSICAL_INLINE_H - -#include "ai.h" -#include "game_share/fame.h" -/* - - The following base class is the common parent of bots, plrs and any other - physical object that has an existance in the world - -*/ - -////////////////////////////////////////////////////////////////////////////// -// CAIEntityPhysical // -////////////////////////////////////////////////////////////////////////////// - -#ifdef NL_OS_WINDOWS -#pragma warning (push) -#pragma warning (disable : 4355) -#endif - -inline -CAIEntityPhysical::CAIEntityPhysical(CPersistentOfPhysical& owner, TDataSetRow const& entityIndex, NLMISC::CEntityId const& id, float radius, uint32 level, RYAI_MAP_CRUNCH::TAStarFlag const& AStarFlags) -: CAIEntity() -, _dataSetRow(entityIndex) -, _pos(entityIndex) -, CSpawnable(owner) -, _id(id) -, _Stuned(0) -, _Rooted(0) -, _Blinded(0) -, _Feared(0) -//, _UnreachableTarget((CAIEntityPhysical*)NULL) -, _radius(radius) -, _food(_radius) -, _Level(level) -, _AStarFlags(AStarFlags) -{ - _instanceNumber.init(*CMirrors::DataSet, entityIndex, DSPropertyAI_INSTANCE); - _mode.init (*CMirrors::DataSet, entityIndex, DSPropertyMODE); - _behaviour.init (*CMirrors::DataSet, entityIndex, DSPropertyBEHAVIOUR); - _targetRow.init (*CMirrors::DataSet, entityIndex, DSPropertyTARGET_ID); - _ActionFlags.init (*CMirrors::DataSet, entityIndex, DSPropertyACTION_FLAGS); - - _RunSpeed.init (*CMirrors::DataSet, entityIndex, DSPropertyCURRENT_RUN_SPEED); - _WalkSpeed.init (*CMirrors::DataSet, entityIndex, DSPropertyCURRENT_WALK_SPEED); - - _CurrentHitPoint.init (*CMirrors::DataSet, entityIndex, DSPropertyCURRENT_HIT_POINTS); - _MaxHitPoint.init (*CMirrors::DataSet, entityIndex, DSPropertyMAX_HIT_POINTS); - _VisionCounter.init (*CMirrors::DataSet, entityIndex, DSPropertyVISION_COUNTER); - _InOutpostAlias.init (*CMirrors::DataSet, entityIndex, DSPropertyIN_OUTPOST_ZONE_ALIAS); - _InOutpostSide.init (*CMirrors::DataSet, entityIndex, DSPropertyIN_OUTPOST_ZONE_SIDE); - -#ifdef NL_DEBUG - const NLMISC::CDbgRefCount &ref=*(static_cast * const>(this)); - NLMISC::CDbgPtr dummyPtr; - - nlassert(ref.getDbgRef(dummyPtr)==0); - nlassert(CAIS::instance()._CAIEntityByDataSetRow.find(entityIndex.getIndex())==CAIS::instance()._CAIEntityByDataSetRow.end()); - ref.setCheckMax(false); -#endif - CAIS::instance()._CAIEntityByDataSetRow.insert(std::make_pair(entityIndex.getIndex(),this)); // we don't want to register players. -#ifdef NL_DEBUG - ref.setCheckMax(true); - nlassert(ref.getDbgRef(dummyPtr)==1); - nlassert(CAIS::instance()._CAIEntityByDataSetRow.find(entityIndex.getIndex())!=CAIS::instance()._CAIEntityByDataSetRow.end()); -#endif - - CAIEntityPhysicalLocator::getInstance()->addEntity(_dataSetRow, _id, this); -} - -inline -CAIEntityPhysical::~CAIEntityPhysical() -{ - CAIEntityPhysicalLocator::getInstance()->delEntity(_dataSetRow, _id, this); - -#ifdef NL_DEBUG - const NLMISC::CDbgRefCount &ref=*(static_cast * const>(this)); - NLMISC::CDbgPtr dummyPtr; -#endif - - // Remove healers - std::multiset::iterator it, itEnd; - for (it=_Healers.begin(), itEnd=_Healers.end(); it!=itEnd; ++it) - { - (*it)->healerRemoved(this); - } - - detachFromTargeting(); - CAIS::instance()._CAIEntityByDataSetRow.erase(dataSetRow().getIndex()); - -#ifdef NL_DEBUG - nlassert(ref.getDbgRef(dummyPtr)==0); - nlassert(CAIS::instance()._CAIEntityByDataSetRow.find(dataSetRow().getIndex())==CAIS::instance()._CAIEntityByDataSetRow.end()); -#endif -} - -#ifdef NL_OS_WINDOWS -#pragma warning (pop) -#endif - -inline -void CAIEntityPhysical::setActionFlags(RYZOMACTIONFLAGS::TActionFlag const& flag) -{ - _ActionFlags = (_ActionFlags.getValue() | flag ); -} - -inline -void CAIEntityPhysical::removeActionFlags(RYZOMACTIONFLAGS::TActionFlag const& flag) -{ - _ActionFlags = (_ActionFlags.getValue() & ~flag ); -} - -inline -float CAIEntityPhysical::getCollisionDist(float angTo) const -{ - return 0.5; -} - -inline -bool CAIEntityPhysical::canMove() const -{ - return !isRooted() && (walkSpeed() != 0); -} - -inline -float CAIEntityPhysical::walkSpeed() const -{ - return _WalkSpeed()*0.1f*SpeedFactor*getSpeedFactor(); -} - -inline -float CAIEntityPhysical::runSpeed() const -{ - return _RunSpeed()*0.1f*SpeedFactor*getSpeedFactor(); -} - -inline -void CAIEntityPhysical::setWPos(RYAI_MAP_CRUNCH::CWorldPosition const& pos) -{ - nlassert(pos.isValid()); - _wpos = pos; -} - -////////////////////////////////////////////////////////////////////////////// -// CPersistentOfPhysical // -////////////////////////////////////////////////////////////////////////////// - -inline -bool CPersistentOfPhysical::isAt16MetersPos(uint16 x, uint16 y) const -{ - CAIEntityPhysical const* phys = getSpawnObj(); - if (!phys) - return false; - return ( (uint16)(phys->x().asInt16Meters())==x - && (uint16)(phys->y().asInt16Meters())==y ); -} - -inline -CAIEntityPhysical* CPersistentOfPhysical::getSpawnObj() const -{ - return CPersistent::getSpawnObj(); -} - -////////////////////////////////////////////////////////////////////////////// -// CModEntityPhysical // -////////////////////////////////////////////////////////////////////////////// - -inline -void CModEntityPhysical::setMode(MBEHAV::EMode m) -{ - if (_mode().Mode == MBEHAV::DEATH) // to remove (can be replaced with the above assertion in debug mode). - return; - - if (_mode().Mode == m) - return; - _mode = MBEHAV::TMode(m, pos().x().asInt(), pos().y().asInt()); -} - -inline -void CModEntityPhysical::setTarget(CAIEntityPhysical* target) -{ - CTargetable::setTarget(target); -// if (CTargetable::getTarget()==target) - const CAIEntityPhysical* tgt=CTargetable::getTarget(); - if (tgt==target) - _targetRow = target ? target->dataSetRow() : TDataSetRow(); -} - -inline -void CModEntityPhysical::setVisualTarget(CAIEntityPhysical* target) -{ - CTargetable::setVisualTarget(target); -// if (CTargetable::getVisualTarget()==target) - const CAIEntityPhysical* tgt=CTargetable::getVisualTarget(); - if (tgt==target) - _targetRow = target ? target->dataSetRow() : TDataSetRow(); -} - -inline -void CModEntityPhysical::setUnreachableTarget(CAIEntityPhysical* target) -{ - CTargetable::setUnreachableTarget(target); -// if (CTargetable::getUnreachableTarget()==target) - const CAIEntityPhysical* tgt=CTargetable::getUnreachableTarget(); - if (tgt==target) - _targetRow = target ? target->dataSetRow() : TDataSetRow(); -} - -inline -bool CModEntityPhysical::setPos(CAIPos const& pos) -{ - RYAI_MAP_CRUNCH::CWorldPosition wpos; - if (!CWorldContainer::getWorldMap().setWorldPosition(AITYPES::vp_auto, wpos,pos)) - return false; - setPos(pos, wpos); - return true; -} - -inline -bool CModEntityPhysical::moveTo(CAIPos const& newPos, RYAI_MAP_CRUNCH::TAStarFlag const& denyFlags) -{ - if (!wpos().isValid()) - return false; - - RYAI_MAP_CRUNCH::CWorldPosition tmpWPos(wpos()); - if (CWorldContainer::getWorldMap().move(tmpWPos, RYAI_MAP_CRUNCH::CMapPosition(newPos), denyFlags)) - { -#ifdef NL_DEBUG - nlassert(RYAI_MAP_CRUNCH::CMapPosition(newPos)==tmpWPos); -#endif - setPos(newPos, tmpWPos); - return true; - } - else - { - // a part of move has been done. - if (tmpWPos!=wpos()) - { - CAIPos partNewPos(tmpWPos.toAIVector(),newPos.h(),newPos.theta()); - setPos(partNewPos, tmpWPos); - return true; - } - - } - // no move at all.. - return false; -}; - -inline -void CModEntityPhysical::resetDecalage() -{ - _Decalage.setXY(0, 0); -} - -////////////////////////////////////////////////////////////////////////////// -// CWorldMapLink // -////////////////////////////////////////////////////////////////////////////// - -template -void CWorldMapLink::linkEntityToMatrix(const CAICoord &x,const CAICoord &y,CAIEntityMatrix& matrix) -{ - _matrixListLink.link(matrix[(uint8)(y.asInt16Meters())][(uint8)(x.asInt16Meters())]); -} - -template -void CWorldMapLink::linkEntityToMatrix(const CAIVectorMirror &pos,CAIEntityMatrix& matrix) -{ - linkEntityToMatrix(pos.x(),pos.y(),matrix); -} - -template -void CWorldMapLink::linkEntityToMatrix(const CAIVector &pos,CAIEntityMatrix& matrix) -{ - linkEntityToMatrix(pos.x(),pos.y(),matrix); -} - -template -void CWorldMapLink::linkToWorldMap(T *entityPtr, const CAIVector &pos,CAIEntityMatrix& matrix) -{ - _matrixListLink.setEntity (entityPtr); - linkEntityToMatrix (pos,matrix); -} - -template -void CWorldMapLink::linkToWorldMap(T *entityPtr, const CAIVectorMirror &pos,CAIEntityMatrix& matrix) -{ - _matrixListLink.setEntity (entityPtr); - linkEntityToMatrix (pos,matrix); -} - -////////////////////////////////////////////////////////////////////////////// -// CTargetable // -////////////////////////////////////////////////////////////////////////////// - -template -CTargetable::CTargetable() -: _FightTargetersWeight(0.f) -, _FightTargetersValue(0.f) -{ - for (size_t i=0; i -CTargetable::~CTargetable() -{ - // This should be done in Derived class dtor, but just in case of since we're instanciable - detachFromTargeting(); -} - -template -void CTargetable::detachFromTargeters() -{ - for (size_t i=0; itargetDied(); - // This method is a bit more intrusive than targeter->setTarget(NULL), but it avoids possible infinite loops - _FirstTargeters[i] = targeter->_NextTargeter; - unlinkTargeter((TTargetType)i, targeter); - } - } -} - -template -void CTargetable::detachFromTargeting() -{ - setTarget((T*)NULL); - detachFromTargeters(); -} - -template -void CTargetable::linkTargeter(TTargetType type, TPtr const& targeter, TPtr const& nextTargeter) -{ - ++_TargeterCount[type]; - if (type==TARGET_TYPE_FIGHT) - { - _FightTargetersWeight += targeter->fightWeight(); - _FightTargetersValue += targeter->fightValue(); - } - targeter->_Target = dynamic_cast(this); - targeter->_TargetType = type; - targeter->_NextTargeter = nextTargeter; - // Some verifications to avoid algorithm bugs -// nlassert(fightTargetersFreeWeight()>=-0.00001f); - nlassert(!targeter->_Target.isNULL()); -} - -template -void CTargetable::unlinkTargeter(TTargetType type, TPtr const& targeter) -{ -#ifdef NL_DEBUG - nlassert((T*)targeter->_Target == this); -#else - if ((T*)targeter->_Target != this) - nlwarning("Targeter's target is not me!"); -#endif - targeter->_Target = (T*)NULL; - targeter->_NextTargeter = (T*)NULL; - --_TargeterCount[type]; - if (type==TARGET_TYPE_FIGHT) - { - _FightTargetersWeight -= targeter->fightWeight(); - _FightTargetersValue -= targeter->fightValue(); - } -} - -template -void CTargetable::addTargeter(TTargetType type, TPtr const& targeter) -{ - linkTargeter(type, targeter, _FirstTargeters[type]); - _FirstTargeters[type] = targeter; -} - -template -void CTargetable::removeTargeter(TTargetType type, TPtr const& targeter) -{ - if (targeter.isNULL()) - return; - if (_FirstTargeters[type] == targeter) - { - _FirstTargeters[type] = targeter->_NextTargeter; - unlinkTargeter(type, targeter); - return; - } - - NLMISC::CDbgPtr current = _FirstTargeters[type]; - while (!current.isNULL()) { - NLMISC::CDbgPtr next = current->_NextTargeter; - if (next == targeter) - { - current->_NextTargeter = targeter->_NextTargeter; - unlinkTargeter(type, targeter); - break; - } - else - { - current = next; - } - } -} - -template -void CTargetable::tryToAddTargeter(TTargetType type, TPtr const& targeter) -{ - H_AUTO(CTargetable_addTargeter); - - if (type==TARGET_TYPE_FIGHT) - { - - // Prepare data to optimize ---------------------------------------------- - size_t opponentCount = targeterCount(); - // Allocate arrays filled with 0.f - float* weights = new float[opponentCount+1]; - float* values = new float[opponentCount+1]; - bool* take = new bool[opponentCount+1]; - for (size_t i=0; ifightWeight(); - values[i] = opponent->fightValue(); - opponent = opponent->nextTargeter(); - take[i] = true; - ++i; - } - // Add the new targeter - weights[opponentCount] = targeter->fightWeight(); - values[opponentCount] = targeter->fightValue(); - take[opponentCount] = false; - } - // Create the context - CKnapsackContext context(opponentCount+1, weights, values); - // Configure and run the solver ------------------------------------------ - CKnapsackSolver solver(&context, take); - { - H_AUTO(addTargeterOptimize); - solver.optimize(fightTargetersWeightMax(), _TargeterChoiceAlgorithm); - } - // Save the data --------------------------------------------------------- - // If the new set is better than the old one - if (solver.totalValue()>fightTargetersValue()) - { - // Unlink the old ones if needed - T* opponent = _FirstTargeters[type]; - TPtr* previousPtr = &_FirstTargeters[type]; - size_t i = 0; - while (opponent!=NULL) - { - if (!solver.take(i)) - { - *previousPtr = opponent->_NextTargeter; - unlinkTargeter(type, opponent); - } - else - { - previousPtr = &opponent->_NextTargeter; - opponent = opponent->_NextTargeter; - } - ++i; - } - // Link the new targeter if needed - if (solver.take(opponentCount)) - { - addTargeter(type, targeter); - } -#ifdef NL_DEBUG - // Debug verifications - { - opponent = _FirstTargeters[type]; - float value = 0.f; - float weight = 0.f; - while (opponent!=NULL) - { - value += opponent->fightValue(); - weight += opponent->fightWeight(); - opponent = opponent->_NextTargeter; - } - // Verify linking system - nlassert(fabs(fightTargetersValue() - value) < 0.0001); - nlassert(fabs(fightTargetersWeight() - weight) < 0.0001); - - // Verify solver behaviour - nlassert(fabs(fightTargetersValue() - solver.totalValue()) < 0.0001); - nlassert(fabs(fightTargetersWeight() - solver.totalWeight()) < 0.0001); - } -#endif - } - delete [] take; - delete [] values; - delete [] weights; - - } - else - { - // Just link the new targeter (no limit on visual targeters) - addTargeter(type, targeter); - } -} - -template -void CTargetable::setTarget(T* target) -{ - setTarget(TARGET_TYPE_FIGHT, target); -} - -template -void CTargetable::setVisualTarget(T* target) -{ - setTarget(TARGET_TYPE_VISUAL, target); -} - -template -void CTargetable::setUnreachableTarget(T* target) -{ - setTarget(TARGET_TYPE_UNREACHABLE, target); -} - -template -void CTargetable::setTarget(TTargetType type, TPtr const& target) -{ - if (target==_Target && type==_TargetType) - return; - - if (!_Target.isNULL()) - { - _Target->removeTargeter(_TargetType, dynamic_cast(this)); - } - if (!target.isNULL()) - { - target->tryToAddTargeter(type, dynamic_cast(this)); - } -} - -template -typename CTargetable::TPtr CTargetable::getTarget() const -{ - return getTarget(TARGET_TYPE_FIGHT); -} - -template -typename CTargetable::TPtr CTargetable::getVisualTarget() const -{ - return getTarget(TARGET_TYPE_VISUAL); -} - -template -typename CTargetable::TPtr CTargetable::getUnreachableTarget() const -{ - return getTarget(TARGET_TYPE_UNREACHABLE); -} - -template -typename CTargetable::TPtr CTargetable::getTarget(TTargetType type) const -{ - if (_TargetType==type) - return _Target; - else - return (T*)NULL; -} - -template -uint32 CTargetable::totalTargeterCount() const -{ - uint32 count = 0; - for (size_t i = 0; i +// 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 . + + + + +#ifndef RYAI_ENTITY_PHYSICAL_INLINE_H +#define RYAI_ENTITY_PHYSICAL_INLINE_H + +#include "ai.h" +#include "game_share/fame.h" +/* + + The following base class is the common parent of bots, plrs and any other + physical object that has an existance in the world + +*/ + +////////////////////////////////////////////////////////////////////////////// +// CAIEntityPhysical // +////////////////////////////////////////////////////////////////////////////// + +#ifdef NL_OS_WINDOWS +#pragma warning (push) +#pragma warning (disable : 4355) +#endif + +inline +CAIEntityPhysical::CAIEntityPhysical(CPersistentOfPhysical& owner, TDataSetRow const& entityIndex, NLMISC::CEntityId const& id, float radius, uint32 level, RYAI_MAP_CRUNCH::TAStarFlag const& AStarFlags) +: CAIEntity() +, CSpawnable(owner) +, _pos(entityIndex) +, _dataSetRow(entityIndex) +, _Stuned(0) +, _Rooted(0) +, _Blinded(0) +, _Feared(0) +//, _UnreachableTarget((CAIEntityPhysical*)NULL) +, _id(id) +, _radius(radius) +, _food(_radius) +, _Level(level) +, _AStarFlags(AStarFlags) +{ + _instanceNumber.init(*CMirrors::DataSet, entityIndex, DSPropertyAI_INSTANCE); + _mode.init (*CMirrors::DataSet, entityIndex, DSPropertyMODE); + _behaviour.init (*CMirrors::DataSet, entityIndex, DSPropertyBEHAVIOUR); + _targetRow.init (*CMirrors::DataSet, entityIndex, DSPropertyTARGET_ID); + _ActionFlags.init (*CMirrors::DataSet, entityIndex, DSPropertyACTION_FLAGS); + + _RunSpeed.init (*CMirrors::DataSet, entityIndex, DSPropertyCURRENT_RUN_SPEED); + _WalkSpeed.init (*CMirrors::DataSet, entityIndex, DSPropertyCURRENT_WALK_SPEED); + + _CurrentHitPoint.init (*CMirrors::DataSet, entityIndex, DSPropertyCURRENT_HIT_POINTS); + _MaxHitPoint.init (*CMirrors::DataSet, entityIndex, DSPropertyMAX_HIT_POINTS); + _VisionCounter.init (*CMirrors::DataSet, entityIndex, DSPropertyVISION_COUNTER); + _InOutpostAlias.init (*CMirrors::DataSet, entityIndex, DSPropertyIN_OUTPOST_ZONE_ALIAS); + _InOutpostSide.init (*CMirrors::DataSet, entityIndex, DSPropertyIN_OUTPOST_ZONE_SIDE); + +#ifdef NL_DEBUG + const NLMISC::CDbgRefCount &ref=*(static_cast * const>(this)); + NLMISC::CDbgPtr dummyPtr; + + nlassert(ref.getDbgRef(dummyPtr)==0); + nlassert(CAIS::instance()._CAIEntityByDataSetRow.find(entityIndex.getIndex())==CAIS::instance()._CAIEntityByDataSetRow.end()); + ref.setCheckMax(false); +#endif + CAIS::instance()._CAIEntityByDataSetRow.insert(std::make_pair(entityIndex.getIndex(),this)); // we don't want to register players. +#ifdef NL_DEBUG + ref.setCheckMax(true); + nlassert(ref.getDbgRef(dummyPtr)==1); + nlassert(CAIS::instance()._CAIEntityByDataSetRow.find(entityIndex.getIndex())!=CAIS::instance()._CAIEntityByDataSetRow.end()); +#endif + + CAIEntityPhysicalLocator::getInstance()->addEntity(_dataSetRow, _id, this); +} + +inline +CAIEntityPhysical::~CAIEntityPhysical() +{ + CAIEntityPhysicalLocator::getInstance()->delEntity(_dataSetRow, _id, this); + +#ifdef NL_DEBUG + const NLMISC::CDbgRefCount &ref=*(static_cast * const>(this)); + NLMISC::CDbgPtr dummyPtr; +#endif + + // Remove healers + std::multiset::iterator it, itEnd; + for (it=_Healers.begin(), itEnd=_Healers.end(); it!=itEnd; ++it) + { + (*it)->healerRemoved(this); + } + + detachFromTargeting(); + CAIS::instance()._CAIEntityByDataSetRow.erase(dataSetRow().getIndex()); + +#ifdef NL_DEBUG + nlassert(ref.getDbgRef(dummyPtr)==0); + nlassert(CAIS::instance()._CAIEntityByDataSetRow.find(dataSetRow().getIndex())==CAIS::instance()._CAIEntityByDataSetRow.end()); +#endif +} + +#ifdef NL_OS_WINDOWS +#pragma warning (pop) +#endif + +inline +void CAIEntityPhysical::setActionFlags(RYZOMACTIONFLAGS::TActionFlag const& flag) +{ + _ActionFlags = (_ActionFlags.getValue() | flag ); +} + +inline +void CAIEntityPhysical::removeActionFlags(RYZOMACTIONFLAGS::TActionFlag const& flag) +{ + _ActionFlags = (_ActionFlags.getValue() & ~flag ); +} + +inline +float CAIEntityPhysical::getCollisionDist(float angTo) const +{ + return 0.5; +} + +inline +bool CAIEntityPhysical::canMove() const +{ + return !isRooted() && (walkSpeed() != 0); +} + +inline +float CAIEntityPhysical::walkSpeed() const +{ + return _WalkSpeed()*0.1f*SpeedFactor*getSpeedFactor(); +} + +inline +float CAIEntityPhysical::runSpeed() const +{ + return _RunSpeed()*0.1f*SpeedFactor*getSpeedFactor(); +} + +inline +void CAIEntityPhysical::setWPos(RYAI_MAP_CRUNCH::CWorldPosition const& pos) +{ + nlassert(pos.isValid()); + _wpos = pos; +} + +////////////////////////////////////////////////////////////////////////////// +// CPersistentOfPhysical // +////////////////////////////////////////////////////////////////////////////// + +inline +bool CPersistentOfPhysical::isAt16MetersPos(uint16 x, uint16 y) const +{ + CAIEntityPhysical const* phys = getSpawnObj(); + if (!phys) + return false; + return ( (uint16)(phys->x().asInt16Meters())==x + && (uint16)(phys->y().asInt16Meters())==y ); +} + +inline +CAIEntityPhysical* CPersistentOfPhysical::getSpawnObj() const +{ + return CPersistent::getSpawnObj(); +} + +////////////////////////////////////////////////////////////////////////////// +// CModEntityPhysical // +////////////////////////////////////////////////////////////////////////////// + +inline +void CModEntityPhysical::setMode(MBEHAV::EMode m) +{ + if (_mode().Mode == MBEHAV::DEATH) // to remove (can be replaced with the above assertion in debug mode). + return; + + if (_mode().Mode == m) + return; + _mode = MBEHAV::TMode(m, pos().x().asInt(), pos().y().asInt()); +} + +inline +void CModEntityPhysical::setTarget(CAIEntityPhysical* target) +{ + CTargetable::setTarget(target); +// if (CTargetable::getTarget()==target) + const CAIEntityPhysical* tgt=CTargetable::getTarget(); + if (tgt==target) + _targetRow = target ? target->dataSetRow() : TDataSetRow(); +} + +inline +void CModEntityPhysical::setVisualTarget(CAIEntityPhysical* target) +{ + CTargetable::setVisualTarget(target); +// if (CTargetable::getVisualTarget()==target) + const CAIEntityPhysical* tgt=CTargetable::getVisualTarget(); + if (tgt==target) + _targetRow = target ? target->dataSetRow() : TDataSetRow(); +} + +inline +void CModEntityPhysical::setUnreachableTarget(CAIEntityPhysical* target) +{ + CTargetable::setUnreachableTarget(target); +// if (CTargetable::getUnreachableTarget()==target) + const CAIEntityPhysical* tgt=CTargetable::getUnreachableTarget(); + if (tgt==target) + _targetRow = target ? target->dataSetRow() : TDataSetRow(); +} + +inline +bool CModEntityPhysical::setPos(CAIPos const& pos) +{ + RYAI_MAP_CRUNCH::CWorldPosition wpos; + if (!CWorldContainer::getWorldMap().setWorldPosition(AITYPES::vp_auto, wpos,pos)) + return false; + setPos(pos, wpos); + return true; +} + +inline +bool CModEntityPhysical::moveTo(CAIPos const& newPos, RYAI_MAP_CRUNCH::TAStarFlag const& denyFlags) +{ + if (!wpos().isValid()) + return false; + + RYAI_MAP_CRUNCH::CWorldPosition tmpWPos(wpos()); + if (CWorldContainer::getWorldMap().move(tmpWPos, RYAI_MAP_CRUNCH::CMapPosition(newPos), denyFlags)) + { +#ifdef NL_DEBUG + nlassert(RYAI_MAP_CRUNCH::CMapPosition(newPos)==tmpWPos); +#endif + setPos(newPos, tmpWPos); + return true; + } + else + { + // a part of move has been done. + if (tmpWPos!=wpos()) + { + CAIPos partNewPos(tmpWPos.toAIVector(),newPos.h(),newPos.theta()); + setPos(partNewPos, tmpWPos); + return true; + } + + } + // no move at all.. + return false; +}; + +inline +void CModEntityPhysical::resetDecalage() +{ + _Decalage.setXY(0, 0); +} + +////////////////////////////////////////////////////////////////////////////// +// CWorldMapLink // +////////////////////////////////////////////////////////////////////////////// + +template +void CWorldMapLink::linkEntityToMatrix(const CAICoord &x,const CAICoord &y,CAIEntityMatrix& matrix) +{ + _matrixListLink.link(matrix[(uint8)(y.asInt16Meters())][(uint8)(x.asInt16Meters())]); +} + +template +void CWorldMapLink::linkEntityToMatrix(const CAIVectorMirror &pos,CAIEntityMatrix& matrix) +{ + linkEntityToMatrix(pos.x(),pos.y(),matrix); +} + +template +void CWorldMapLink::linkEntityToMatrix(const CAIVector &pos,CAIEntityMatrix& matrix) +{ + linkEntityToMatrix(pos.x(),pos.y(),matrix); +} + +template +void CWorldMapLink::linkToWorldMap(T *entityPtr, const CAIVector &pos,CAIEntityMatrix& matrix) +{ + _matrixListLink.setEntity (entityPtr); + linkEntityToMatrix (pos,matrix); +} + +template +void CWorldMapLink::linkToWorldMap(T *entityPtr, const CAIVectorMirror &pos,CAIEntityMatrix& matrix) +{ + _matrixListLink.setEntity (entityPtr); + linkEntityToMatrix (pos,matrix); +} + +////////////////////////////////////////////////////////////////////////////// +// CTargetable // +////////////////////////////////////////////////////////////////////////////// + +template +CTargetable::CTargetable() +: _FightTargetersWeight(0.f) +, _FightTargetersValue(0.f) +{ + for (size_t i=0; i +CTargetable::~CTargetable() +{ + // This should be done in Derived class dtor, but just in case of since we're instanciable + detachFromTargeting(); +} + +template +void CTargetable::detachFromTargeters() +{ + for (size_t i=0; itargetDied(); + // This method is a bit more intrusive than targeter->setTarget(NULL), but it avoids possible infinite loops + _FirstTargeters[i] = targeter->_NextTargeter; + unlinkTargeter((TTargetType)i, targeter); + } + } +} + +template +void CTargetable::detachFromTargeting() +{ + setTarget((T*)NULL); + detachFromTargeters(); +} + +template +void CTargetable::linkTargeter(TTargetType type, TPtr const& targeter, TPtr const& nextTargeter) +{ + ++_TargeterCount[type]; + if (type==TARGET_TYPE_FIGHT) + { + _FightTargetersWeight += targeter->fightWeight(); + _FightTargetersValue += targeter->fightValue(); + } + targeter->_Target = dynamic_cast(this); + targeter->_TargetType = type; + targeter->_NextTargeter = nextTargeter; + // Some verifications to avoid algorithm bugs +// nlassert(fightTargetersFreeWeight()>=-0.00001f); + nlassert(!targeter->_Target.isNULL()); +} + +template +void CTargetable::unlinkTargeter(TTargetType type, TPtr const& targeter) +{ +#ifdef NL_DEBUG + nlassert((T*)targeter->_Target == this); +#else + if ((T*)targeter->_Target != this) + nlwarning("Targeter's target is not me!"); +#endif + targeter->_Target = (T*)NULL; + targeter->_NextTargeter = (T*)NULL; + --_TargeterCount[type]; + if (type==TARGET_TYPE_FIGHT) + { + _FightTargetersWeight -= targeter->fightWeight(); + _FightTargetersValue -= targeter->fightValue(); + } +} + +template +void CTargetable::addTargeter(TTargetType type, TPtr const& targeter) +{ + linkTargeter(type, targeter, _FirstTargeters[type]); + _FirstTargeters[type] = targeter; +} + +template +void CTargetable::removeTargeter(TTargetType type, TPtr const& targeter) +{ + if (targeter.isNULL()) + return; + if (_FirstTargeters[type] == targeter) + { + _FirstTargeters[type] = targeter->_NextTargeter; + unlinkTargeter(type, targeter); + return; + } + + NLMISC::CDbgPtr current = _FirstTargeters[type]; + while (!current.isNULL()) { + NLMISC::CDbgPtr next = current->_NextTargeter; + if (next == targeter) + { + current->_NextTargeter = targeter->_NextTargeter; + unlinkTargeter(type, targeter); + break; + } + else + { + current = next; + } + } +} + +template +void CTargetable::tryToAddTargeter(TTargetType type, TPtr const& targeter) +{ + H_AUTO(CTargetable_addTargeter); + + if (type==TARGET_TYPE_FIGHT) + { + + // Prepare data to optimize ---------------------------------------------- + size_t opponentCount = targeterCount(); + // Allocate arrays filled with 0.f + float* weights = new float[opponentCount+1]; + float* values = new float[opponentCount+1]; + bool* take = new bool[opponentCount+1]; + for (size_t i=0; ifightWeight(); + values[i] = opponent->fightValue(); + opponent = opponent->nextTargeter(); + take[i] = true; + ++i; + } + // Add the new targeter + weights[opponentCount] = targeter->fightWeight(); + values[opponentCount] = targeter->fightValue(); + take[opponentCount] = false; + } + // Create the context + CKnapsackContext context(opponentCount+1, weights, values); + // Configure and run the solver ------------------------------------------ + CKnapsackSolver solver(&context, take); + { + H_AUTO(addTargeterOptimize); + solver.optimize(fightTargetersWeightMax(), _TargeterChoiceAlgorithm); + } + // Save the data --------------------------------------------------------- + // If the new set is better than the old one + if (solver.totalValue()>fightTargetersValue()) + { + // Unlink the old ones if needed + T* opponent = _FirstTargeters[type]; + TPtr* previousPtr = &_FirstTargeters[type]; + size_t i = 0; + while (opponent!=NULL) + { + if (!solver.take(i)) + { + *previousPtr = opponent->_NextTargeter; + unlinkTargeter(type, opponent); + } + else + { + previousPtr = &opponent->_NextTargeter; + opponent = opponent->_NextTargeter; + } + ++i; + } + // Link the new targeter if needed + if (solver.take(opponentCount)) + { + addTargeter(type, targeter); + } +#ifdef NL_DEBUG + // Debug verifications + { + opponent = _FirstTargeters[type]; + float value = 0.f; + float weight = 0.f; + while (opponent!=NULL) + { + value += opponent->fightValue(); + weight += opponent->fightWeight(); + opponent = opponent->_NextTargeter; + } + // Verify linking system + nlassert(fabs(fightTargetersValue() - value) < 0.0001); + nlassert(fabs(fightTargetersWeight() - weight) < 0.0001); + + // Verify solver behaviour + nlassert(fabs(fightTargetersValue() - solver.totalValue()) < 0.0001); + nlassert(fabs(fightTargetersWeight() - solver.totalWeight()) < 0.0001); + } +#endif + } + delete [] take; + delete [] values; + delete [] weights; + + } + else + { + // Just link the new targeter (no limit on visual targeters) + addTargeter(type, targeter); + } +} + +template +void CTargetable::setTarget(T* target) +{ + setTarget(TARGET_TYPE_FIGHT, target); +} + +template +void CTargetable::setVisualTarget(T* target) +{ + setTarget(TARGET_TYPE_VISUAL, target); +} + +template +void CTargetable::setUnreachableTarget(T* target) +{ + setTarget(TARGET_TYPE_UNREACHABLE, target); +} + +template +void CTargetable::setTarget(TTargetType type, TPtr const& target) +{ + if (target==_Target && type==_TargetType) + return; + + if (!_Target.isNULL()) + { + _Target->removeTargeter(_TargetType, dynamic_cast(this)); + } + if (!target.isNULL()) + { + target->tryToAddTargeter(type, dynamic_cast(this)); + } +} + +template +typename CTargetable::TPtr CTargetable::getTarget() const +{ + return getTarget(TARGET_TYPE_FIGHT); +} + +template +typename CTargetable::TPtr CTargetable::getVisualTarget() const +{ + return getTarget(TARGET_TYPE_VISUAL); +} + +template +typename CTargetable::TPtr CTargetable::getUnreachableTarget() const +{ + return getTarget(TARGET_TYPE_UNREACHABLE); +} + +template +typename CTargetable::TPtr CTargetable::getTarget(TTargetType type) const +{ + if (_TargetType==type) + return _Target; + else + return (T*)NULL; +} + +template +uint32 CTargetable::totalTargeterCount() const +{ + uint32 count = 0; + for (size_t i = 0; i(owner)) , _Ennemy(ennemy) -, _Bot(NLMISC::safe_cast(owner)) , _PathPos(NLMISC::safe_cast(owner)->theta()) +, _PathCont(NLMISC::safe_cast(owner)->getAStarFlag()) , _RangeCalculated(false) , _SearchAlternativePath(false) -, _PathCont(NLMISC::safe_cast(owner)->getAStarFlag()) { #ifdef NL_DEBUG_PTR _Bot.setData(this); @@ -226,12 +226,12 @@ CBotProfileHeal::CBotProfileHeal(const TDataSetRow &row, CProfileOwner *owner) : CBotProfileFightHeal() -, _Row(row) , _Bot(NLMISC::safe_cast(owner)) , _PathPos(NLMISC::safe_cast(owner)->theta()) +, _PathCont(NLMISC::safe_cast(owner)->getAStarFlag()) +, _Row(row) , _RangeCalculated(false) , _SearchAlternativePath(false) -, _PathCont(NLMISC::safe_cast(owner)->getAStarFlag()) { } @@ -252,10 +252,10 @@ CBotProfileFlee::CBotProfileFlee(CProfileOwner *owner) : CAIBaseProfile() +, _DenyFlags(NLMISC::safe_cast(owner)->getAStarFlag()) +, _PathPos(NLMISC::safe_cast(owner)->theta()) +, _fightFleePathContainer(NLMISC::safe_cast(owner)->getAStarFlag()) , _Bot(NLMISC::safe_cast(owner)) -, _PathPos(NLMISC::safe_cast(owner)->theta()) -, _DenyFlags(NLMISC::safe_cast(owner)->getAStarFlag()) -, _fightFleePathContainer(NLMISC::safe_cast(owner)->getAStarFlag()) { } @@ -521,14 +521,20 @@ if (!entity->isAlive()) { if (ai_profile_npc_VerboseLog) + { nldebug("Entity %s have aggro for dead entity %s, forgetting it.", spawnBot->getEntityId().toString().c_str(), entity->getEntityId().toString().c_str()); + } + spawnBot->forgetAggroFor(entity->dataSetRow()); continue; } if (!entity->isBotAttackable()) { if (ai_profile_npc_VerboseLog) + { nldebug("Entity %s have aggro for non bot attackable entity %s, forgetting it.", spawnBot->getEntityId().toString().c_str(), entity->getEntityId().toString().c_str()); + } + spawnBot->forgetAggroFor(entity->dataSetRow()); continue; } diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/ai_profile_npc.cpp --- a/code/ryzom/server/src/ai_service/ai_profile_npc.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/ai_profile_npc.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -676,7 +676,8 @@ else { // look for aggro range parameter or set a default value - float aggroRangeFloat; + float aggroRangeFloat = 0.0; + if (!_Grp->getProfileParameter("aggro range", aggroRangeFloat)) _AggroRange =static_cast( CGrpProfileBanditFactory::getDefaultBanditAggroRange() ); else @@ -991,7 +992,7 @@ } string s; - float f; + float f = 0.0; if (_Grp->getProfileParameter("faction", s) && !s.empty()) { factionIndex = CStaticFames::getInstance().getFactionIndex(s); @@ -1703,10 +1704,10 @@ CGrpProfileFollowRoute::CGrpProfileFollowRoute(CProfileOwner *owner,const std::vector &geometry,const TVerticalPos &verticalPos, bool dontSendEvent) : CMoveProfile(owner) +, _PathCont(NLMISC::safe_cast(owner)->getPersistent().getAStarFlag()) +, _GeometryComeFromState(false) , _Geometry(&geometry) -, _GeometryComeFromState(false) , _VerticalPos(verticalPos) -, _PathCont(NLMISC::safe_cast(owner)->getPersistent().getAStarFlag()) , _DontSendEvent(dontSendEvent) { PROFILE_LOG("group", "follow_route", "ctor2", ""); @@ -2402,8 +2403,8 @@ CGrpProfileWander::CGrpProfileWander(CProfileOwner* owner, CNpcZone const* npcZone) : CMoveProfile(owner) +, _Social(false) , _NpcZone(npcZone) -, _Social(false) { PROFILE_LOG("group", "wander", "ctor", ""); _BotStandProfileType = BOT_STAND_AT_POS; @@ -2748,8 +2749,8 @@ CGrpProfileWanderNoPrim::CGrpProfileWanderNoPrim(CProfileOwner* owner, NLMISC::CSmartPtr const& npcZone) : CMoveProfile(owner) +, _Social(false) , _NpcZone(npcZone) -, _Social(false) { PROFILE_LOG("group", "wander", "ctor", ""); _BotStandProfileType = BOT_STAND_AT_POS; @@ -3043,10 +3044,10 @@ } CGrpProfileStandAtStartPoint::CBotPositionner::CBotPositionner(TVerticalPos verticalPos, CAIPos position, RYAI_MAP_CRUNCH::TAStarFlag flag) -: _BotAtDest(false) +: _PathCont(flag) , _Position(position) , _VerticalPos(verticalPos) -, _PathCont(flag) +, _BotAtDest(false) { _PathCont.setDestination(verticalPos, position); } @@ -4019,9 +4020,9 @@ : CAIBaseProfile() , _VerticalPos(verticalPos) , _Dest(dest) +, _PathCont(NLMISC::safe_cast(owner)->getAStarFlag()) +, _PathPos(NLMISC::safe_cast(owner)->theta()) , _Bot(NLMISC::safe_cast(owner)) -, _PathPos(NLMISC::safe_cast(owner)->theta()) -, _PathCont(NLMISC::safe_cast(owner)->getAStarFlag()) { PROFILE_LOG("bot", "move_to", "ctor", ""); #ifdef NL_DEBUG_PTR @@ -4095,11 +4096,11 @@ CBotProfileFollowPos::CBotProfileFollowPos(CBotProfileFollowPos const& other) : CAIBaseProfile() +, _PathPos(const_cast(other)._PathPos._Angle) // Just to debug... +, _Bot(const_cast(other)._Bot) , _PathCont(const_cast(other)._PathCont) -, _Bot(const_cast(other)._Bot) , _MaxWalkSpeed(FLT_MAX) , _MaxRunSpeed(FLT_MAX) -, _PathPos(const_cast(other)._PathPos._Angle) // Just to debug... , _Stop(false) { PROFILE_LOG("bot", "follow_pos", "ctor", ""); @@ -4110,11 +4111,11 @@ CBotProfileFollowPos::CBotProfileFollowPos(CPathCont* pathCont, CProfileOwner* owner) : CAIBaseProfile() +, _PathPos(NLMISC::safe_cast(owner)->theta()) +, _Bot(NLMISC::safe_cast(owner)) , _PathCont(pathCont) -, _Bot(NLMISC::safe_cast(owner)) , _MaxWalkSpeed(FLT_MAX) , _MaxRunSpeed(FLT_MAX) -, _PathPos(NLMISC::safe_cast(owner)->theta()) , _Stop(false) { PROFILE_LOG("bot", "follow_pos", "ctor", ""); @@ -4530,9 +4531,9 @@ } CGrpProfileStandOnVertices::CBotPositionner::CBotPositionner(uint32 geomIndex, RYAI_MAP_CRUNCH::TAStarFlag flags) -: _BotAtDest(false) +: _PathCont(flags) , _GeomIndex(geomIndex) -, _PathCont(flags) +, _BotAtDest(false) { } diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/alias_tree_owner.h --- a/code/ryzom/server/src/ai_service/alias_tree_owner.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/alias_tree_owner.h Wed Sep 22 11:00:19 2010 +0200 @@ -143,9 +143,9 @@ inline CAliasTreeOwner::CAliasTreeOwner(CAIAliasDescriptionNode* aliasTree) -: _AliasTree(aliasTree) -, _Alias(0) +: _Alias(0) , _Name(std::string()) +, _AliasTree(aliasTree) { if (aliasTree) { @@ -159,9 +159,9 @@ inline CAliasTreeOwner::CAliasTreeOwner(uint32 alias, std::string const& name) -: _AliasTree(NULL) -, _Alias(alias) +: _Alias(alias) , _Name(name) +, _AliasTree(NULL) { CAliasTreeOwnerLocator::getInstance()->addEntity(_Alias, _Name, this); } diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/continent_inline.h --- a/code/ryzom/server/src/ai_service/continent_inline.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/continent_inline.h Wed Sep 22 11:00:19 2010 +0200 @@ -126,8 +126,8 @@ inline CAabb::CAabb() -: _VMax(INT_MIN/CAICoord::UNITS_PER_METER, INT_MIN/CAICoord::UNITS_PER_METER) -, _VMin(INT_MAX/CAICoord::UNITS_PER_METER, INT_MAX/CAICoord::UNITS_PER_METER) +: _VMin(INT_MAX/CAICoord::UNITS_PER_METER, INT_MAX/CAICoord::UNITS_PER_METER) +, _VMax(INT_MIN/CAICoord::UNITS_PER_METER, INT_MIN/CAICoord::UNITS_PER_METER) { } /* diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/fx_entity.h --- a/code/ryzom/server/src/ai_service/fx_entity.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/fx_entity.h Wed Sep 22 11:00:19 2010 +0200 @@ -32,7 +32,10 @@ NLMISC::CEntityId const& id() const; bool spawn(); void despawn(); - bool update() { } + +//commented to avoid warn : no return statement in function returning non-void +// bool update() { } + void set(std::string const& prop, std::string const& value, bool reportChange=false) { } std::string get(std::string const& prop); std::string getIndexString() const { return _EntityId.toString(); } diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/mirrors.h --- a/code/ryzom/server/src/ai_service/mirrors.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/mirrors.h Wed Sep 22 11:00:19 2010 +0200 @@ -50,7 +50,7 @@ static bool exists( const TDataSetRow& entityIndex ); static const NLMISC::CEntityId& getEntityId( const TDataSetRow& entityIndex ); static TDataSetRow getDataSetRow( const NLMISC::CEntityId& entityId ); - static const uint16 getTeamId(const TDataSetRow& entityIndex); + static uint16 getTeamId(const TDataSetRow& entityIndex); static CAICoord x( const TDataSetRow& entityIndex ); static CAICoord y( const TDataSetRow& entityIndex ); diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/script_compiler.h --- a/code/ryzom/server/src/ai_service/script_compiler.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/script_compiler.h Wed Sep 22 11:00:19 2010 +0200 @@ -344,14 +344,14 @@ } inline CTokenTestResult::CTokenTestResult(const NLMISC::CSmartPtr &codeNode) -: _codeNode(codeNode) -, _res(BRULE_VALID) +: _res(BRULE_VALID) +, _codeNode(codeNode) { } inline CTokenTestResult::CTokenTestResult(const NLMISC::CSmartPtr &codeNode, TBasicTokenTestRes res) -: _codeNode(codeNode) -, _res(res) +: _res(BRULE_VALID) +, _codeNode(codeNode) { } inline diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/script_vm.h --- a/code/ryzom/server/src/ai_service/script_vm.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/script_vm.h Wed Sep 22 11:00:19 2010 +0200 @@ -81,7 +81,7 @@ } bool isValid()const { - return _Index!=~0; + return _Index != (uint) ~0; } NLMISC::CSmartPtr& code() { return _Code; } size_t& index() { return _Index; } @@ -556,10 +556,10 @@ CStringSeparator::CStringSeparator(const std::string &str, const std::string &motif) :_Index(0) ,_NewIndex(0) + ,_Delta(0) + ,_StartIndex(0) ,_Str(str) ,_Motif(motif) - ,_Delta(0) - ,_StartIndex(0) { } inline diff -r 2d735b28e5f8 code/ryzom/server/src/ai_service/state_instance.h --- a/code/ryzom/server/src/ai_service/state_instance.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_service/state_instance.h Wed Sep 22 11:00:19 2010 +0200 @@ -583,9 +583,9 @@ inline CPersistentStateInstance::CPersistentStateInstance(CStateMachine& reactionContainer) : CKeyWordOwner() +, CStateInstance(NULL) , _StartState() , _Container(reactionContainer) -, CStateInstance(NULL) { } diff -r 2d735b28e5f8 code/ryzom/server/src/ai_share/ai_actions.h --- a/code/ryzom/server/src/ai_share/ai_actions.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_share/ai_actions.h Wed Sep 22 11:00:19 2010 +0200 @@ -100,6 +100,7 @@ case TypeFloat: return NLMISC::toString(_f); // case TypeAliasTree: return _a->treeToString(); // case TypeEventTree: return _e->toString(); + default: break; } return ""; } @@ -115,6 +116,7 @@ case TypeFloat: f.serial(_f); break; // case TypeAliasTree: f.serial(_a); break; // case TypeEventTree: f.serial(_e); break; + default: break; } } diff -r 2d735b28e5f8 code/ryzom/server/src/ai_share/ai_event.h --- a/code/ryzom/server/src/ai_share/ai_event.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_share/ai_event.h Wed Sep 22 11:00:19 2010 +0200 @@ -66,11 +66,11 @@ *this=other; } - CAIEventType(const char *typeName) + CAIEventType(const std::string typeName) { // copy text from input string to _val variable uint i; - for (i=0;i<8 && typeName[i];++i) + for (i=0; i < typeName.size();++i) ((char *)&_val)[i]=typeName[i]; // if type name is longer than 8 characters it won't fit in an int64! @@ -80,14 +80,16 @@ while(i<8) ((char *)&_val)[i++]=0; } - CAIEventType(const std::string &typeName) +// CAIEventType(const std::string &typeName) +// { +// *this=CAIEventType(typeName.c_str()); +// } + + CAIEventType operator=(const CAIEventType other) { - *this=CAIEventType(typeName.c_str()); - } + _val = other._val; - const CAIEventType &operator=(const CAIEventType &other) - { - _val=other._val; + return *this; } bool operator==(const CAIEventType &other) const { diff -r 2d735b28e5f8 code/ryzom/server/src/ai_share/ai_types.h --- a/code/ryzom/server/src/ai_share/ai_types.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_share/ai_types.h Wed Sep 22 11:00:19 2010 +0200 @@ -50,8 +50,8 @@ class CDescTypeEntry { public: - CDescTypeEntry(char *name, T value) : _name(name), _value(value) {} - const char *_name; + CDescTypeEntry(std::string name, T value) : _name(name), _value(value) {} + const std::string _name; T _value; }; static CDescTypeEntry _entries[]; @@ -61,14 +61,14 @@ class CTypeSpecialization { }; - template const char *getName( type t ) + template const std::string getName( type t ) { return CDescType::_entries[t]._name; } // find the type associated with this string content. // cando : upgrade with a logarithm search. - template extern type getType(const char *s) + template extern type getType(const std::string s) { int index = 0; do diff -r 2d735b28e5f8 code/ryzom/server/src/ai_share/primitive_parser.cpp --- a/code/ryzom/server/src/ai_share/primitive_parser.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/ai_share/primitive_parser.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -335,9 +335,9 @@ || childNode->getName()!=name ) { nlwarning("nextTreeNode(): Unique ID conflict in node: (%s, %u, %s): looking for (%s, %u, %s) but found (%s, %u, %s)", - getName(treeNode->getType()),treeNode->getAlias(),treeNode->fullName().c_str(), - getName(childNode->getType()),childNode->getAlias(),childNode->fullName().c_str(), - getName(type),uniqueId,name.c_str()); + getName(treeNode->getType()).c_str(),treeNode->getAlias(),treeNode->fullName().c_str(), + getName(childNode->getType()).c_str(),childNode->getAlias(),childNode->fullName().c_str(), + getName(type).c_str(),uniqueId,name.c_str()); continue; } return childNode; @@ -377,7 +377,7 @@ if (parentNode->findNodeChildByNameAndType(name,type)!=NULL) { LOG("Name not unique: %s: '%s:%s' @ '%s'", - getName(type),parentNode->fullName().c_str(), + getName(type).c_str(),parentNode->fullName().c_str(), name.c_str(), treeNode->fullName().c_str()); } @@ -565,7 +565,7 @@ // not handled there, but by caller break; default: - nlwarning("Don't know how to treat ai_type '%s'",getName(type)); + nlwarning("Don't know how to treat ai_type '%s'",getName(type).c_str()); break; } @@ -682,7 +682,7 @@ break; case AITypeBadType: default: - nlwarning("Don't know how to treat ai_type '%s'",getName(type)); + nlwarning("Don't know how to treat ai_type '%s'",getName(type).c_str()); break; } } @@ -1049,7 +1049,7 @@ break; default: - nlwarning("Don't know how to treat ai_group of type '%s' in primState",getName(nodeTypeSpec(child))); + nlwarning("Don't know how to treat ai_group of type '%s' in primState",getName(nodeTypeSpec(child)).c_str()); break; } @@ -1065,7 +1065,7 @@ case AITypeFolder: break; default: - nlwarning("Don't know how to treat ai_type '%s'",getName(nodeType(child))); + nlwarning("Don't know how to treat ai_type '%s'",getName(nodeType(child)).c_str()); break; } @@ -1313,7 +1313,7 @@ // deal with the weight std::string s; - uint32 weight; + uint32 weight = 0; if (prim->getPropertyByName("weight",s)) { weight=atoi(s.c_str()); @@ -1488,7 +1488,7 @@ default: if (type!=AITypePlace && type!=AITypePlaceFauna) - nlwarning("Don't know how to treat ai_type '%s'",getName(type)); + nlwarning("Don't know how to treat ai_type '%s'",getName(type).c_str()); break; } @@ -1538,7 +1538,7 @@ case AITypeFolder: break; default: - nlwarning("Found ai_type: '%s' when expecting 'GROUP_FAUNA'",getName(type)); + nlwarning("Found ai_type: '%s' when expecting 'GROUP_FAUNA'",getName(type).c_str()); break; } @@ -1586,7 +1586,7 @@ case AITypeFolder: break; default: // we don't care unknown objets. - nlwarning("Don't know how to treat ai_type '%s'",getName(nodeType(child))); + nlwarning("Don't know how to treat ai_type '%s'",getName(nodeType(child)).c_str()); break; } @@ -1948,7 +1948,7 @@ // case AITypeGrpParameters: break; default: - nlwarning("Don't know how to treat ai_type '%s'",getName(nodeType(child))); + nlwarning("Don't know how to treat ai_type '%s'",getName(nodeType(child)).c_str()); break; } @@ -2048,7 +2048,7 @@ case AITypeFolder: break; default: - nlwarning("unrecognised ai_type in NPC manager %s: '%s'",treeNode->fullName().c_str(),getName(nodeType(child))); + nlwarning("unrecognised ai_type in NPC manager %s: '%s'",treeNode->fullName().c_str(),getName(nodeType(child)).c_str()); break; } } @@ -2115,7 +2115,7 @@ case AITypeFolder: break; default: - nlwarning("unrecognised ai_type in outpost manager %s: '%s'",treeNode->fullName().c_str(),getName(nodeType(child))); + nlwarning("unrecognised ai_type in outpost manager %s: '%s'",treeNode->fullName().c_str(),getName(nodeType(child)).c_str()); break; } } @@ -2307,7 +2307,7 @@ parsePrimEvent(NULL, child); break; default: - nlwarning("unrecognised ai_type in spire %s: '%s'", name.c_str(), getName(nodeType(child))); + nlwarning("unrecognised ai_type in spire %s: '%s'", name.c_str(), getName(nodeType(child)).c_str()); break; } } @@ -2409,7 +2409,9 @@ static void parsePrimRoadTrigger(const CAIAliasDescriptionNode *aliasNode, const IPrimitive *prim) { CPrimVector t1, t2, sp; - float t1r, t2r, spr; + float t1r = 0.0; + float t2r = 0.0; + float spr = 0.0; string s; for (uint i=0; igetNumChildren(); ++i) @@ -2494,6 +2496,8 @@ case AITypeRoadTrigger: parsePrimRoadTrigger(nextTreeNode(aliasNode,child),child); break; + default: + break; } } } @@ -2527,6 +2531,8 @@ case AITypeDynRoad: parsePrimDynRoad(nextTreeNode(aliasNode,child),child); break; + default: + break; } } } @@ -2643,6 +2649,8 @@ case AITypeCellZone: parsePrimCellZone(nextTreeNode(aliasNode,child),child); break; + default: + break; } } } @@ -2847,6 +2855,8 @@ } break; + default: + break; } } @@ -2895,6 +2905,8 @@ case AITypeGroupTemplateFauna: parsePrimGroupTemplate(nextTreeNode(aliasNode,child),child,"C"); break; + default: + break; } } @@ -2942,6 +2954,8 @@ case AITypeGroupTemplateMultiLevel: parsePrimGroupTemplate(nextTreeNode(aliasNode,child),child,"C"); break; + default: + break; } } @@ -2980,6 +2994,8 @@ case AITypeGroupTemplateMultiLevel: parsePrimGroupTemplate(nextTreeNode(aliasNode,child),child,"C"); break; + default: + break; } } @@ -3047,6 +3063,8 @@ // case AITypeGroupFamilyProfileGeneric: // parsePrimGroupFamilyProfileGeneric(nextTreeNode(aliasNode,child),child, GroupFamilyTribe); // break; + default: + break; } } } @@ -3313,6 +3331,8 @@ case AITypeManager: parsePrimMgr(child, mapName, filename); break; + default: + break; } } } @@ -3354,6 +3374,8 @@ case AITypeOutpost: parsePrimOutpost(child, mapName, filename); break; + default: + break; } } } @@ -3388,6 +3410,8 @@ CAIActions::exec("SETNOGO", x, y); } break; + default: + break; } } @@ -4049,7 +4073,7 @@ const vector &basePrim = CPrimitiveCfg::getMap(args[0]); set filter(basePrim.begin(), basePrim.end()); - for ( uint i = 0; (sint)i &prims = CPrimitiveCfg::getMap(usedPrimitives.asString(i)); for (uint j=0; jgetCellLink(*this); } inline -CWorldPosition::CWorldPosition(const CRootCell *cell, const CMapPosition &pos, const CSlot &slot,bool generationOnly) : _RootCell(cell), CMapPosition(pos), CSlot(slot) +CWorldPosition::CWorldPosition(const CRootCell *cell, const CMapPosition &pos, const CSlot &slot,bool generationOnly) : CMapPosition(pos), CSlot(slot), _RootCell(cell) { } diff -r 2d735b28e5f8 code/ryzom/server/src/gameplay_module_lib/module_parent.h --- a/code/ryzom/server/src/gameplay_module_lib/module_parent.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/gameplay_module_lib/module_parent.h Wed Sep 22 11:00:19 2010 +0200 @@ -23,8 +23,8 @@ #include "module_core.h" #include "module_utils.h" -class ::IModuleCore; -class ::IModule; +class IModuleCore; +class IModule; /** * A module parent is a class encapsulating the modules contained in a module core diff -r 2d735b28e5f8 code/ryzom/server/src/pd_lib/db_description_parser.cpp --- a/code/ryzom/server/src/pd_lib/db_description_parser.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/pd_lib/db_description_parser.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -418,6 +418,8 @@ return false; } break; + default: + break; } return true; @@ -727,6 +729,8 @@ table.Columns.push_back(column); } break; + default: + break; } } diff -r 2d735b28e5f8 code/ryzom/server/src/pd_lib/pd_messages.cpp --- a/code/ryzom/server/src/pd_lib/pd_messages.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/pd_lib/pd_messages.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -104,6 +104,8 @@ else if (typenode.ByteSize == 4) result += NLMISC::toString(*(uint32*)dataptr); } break; + default: + break; } } } @@ -166,6 +168,8 @@ else if (column.ByteSize == 4) strValue = NLMISC::toString(asUint32()); } break; + default: + break; } result = NLMISC::toString("%-12s: ", "UpdateValue"); diff -r 2d735b28e5f8 code/ryzom/server/src/pd_lib/pd_messages.h --- a/code/ryzom/server/src/pd_lib/pd_messages.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/pd_lib/pd_messages.h Wed Sep 22 11:00:19 2010 +0200 @@ -1016,7 +1016,7 @@ { public: - CUpdateLog() : UpdateId(0xffffffff), _Updates(NULL), _OwnUpdates(false) { } + CUpdateLog() : UpdateId(0xffffffff), _OwnUpdates(false), _Updates(NULL) { } ~CUpdateLog(); @@ -1373,12 +1373,6 @@ size += sizeof(_Value3[0]); break; - case AddString: - break; - - case UnmapString: - break; - case ReleaseRow: size += sizeof(_ObjectIndex.Table)+sizeof(_ObjectIndex.Row); break; @@ -1388,10 +1382,7 @@ size += 2; break; - case PushContext: - break; - - case PopContext: + default: break; } diff -r 2d735b28e5f8 code/ryzom/server/src/pd_lib/pd_server_utils.h --- a/code/ryzom/server/src/pd_lib/pd_server_utils.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.h Wed Sep 22 11:00:19 2010 +0200 @@ -267,7 +267,7 @@ public: /// Constructor - CMixedStreamFile() : _File(NULL), NLMISC::IStream(false) + CMixedStreamFile() : NLMISC::IStream(false), _File(NULL) { } diff -r 2d735b28e5f8 code/ryzom/server/src/pd_lib/pd_utils.h --- a/code/ryzom/server/src/pd_lib/pd_utils.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/pd_lib/pd_utils.h Wed Sep 22 11:00:19 2010 +0200 @@ -157,7 +157,7 @@ public: /// Constructor of invalid index - explicit CObjectIndex(bool validateChecksum = false) : _Table(INVALID_TABLE_INDEX), _Row(INVALID_ROW_INDEX), _Checksum((TIndexChecksum)~VALID_INDEX_CHECKSUM) + explicit CObjectIndex(bool validateChecksum = false) : _Row(INVALID_ROW_INDEX), _Table(INVALID_TABLE_INDEX), _Checksum((TIndexChecksum)~VALID_INDEX_CHECKSUM) { if (validateChecksum) validate(); @@ -166,7 +166,7 @@ } /// Constructor - CObjectIndex(TTableIndex table, TRowIndex row) : _Table(table), _Row(row) { validate(); } + CObjectIndex(TTableIndex table, TRowIndex row) : _Row(row), _Table(table) { validate(); } /// Constructor CObjectIndex(const CObjectIndex &index) { *this = index; } @@ -397,13 +397,13 @@ /// Constructor explicit CColumnIndex(TTableIndex table = INVALID_TABLE_INDEX, TRowIndex row = INVALID_ROW_INDEX, TColumnIndex column = INVALID_COLUMN_INDEX) - : _Table(table), _Row(row), _Column(column) + : _Table(table), _Column(column), _Row(row) { } /// Constructor explicit CColumnIndex(const CObjectIndex& object, TColumnIndex column) - : _Table(INVALID_TABLE_INDEX), _Row(INVALID_ROW_INDEX), _Column(INVALID_COLUMN_INDEX) + : _Table(INVALID_TABLE_INDEX), _Column(INVALID_COLUMN_INDEX), _Row(INVALID_ROW_INDEX) { if (!object.isValid()) return; diff -r 2d735b28e5f8 code/ryzom/server/src/pd_lib/pds_table_buffer.h --- a/code/ryzom/server/src/pd_lib/pds_table_buffer.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/pd_lib/pds_table_buffer.h Wed Sep 22 11:00:19 2010 +0200 @@ -81,7 +81,7 @@ TRowData data() { return (*_MapIt).second + (_Mapped ? sizeof(CMappedHeader) : sizeof(CHeader)); } /// Get row data - const TRowData data() const { return (*_MapIt).second + (_Mapped ? sizeof(CMappedHeader) : sizeof(CHeader)); } + TRowData data() const { return (*_MapIt).second + (_Mapped ? sizeof(CMappedHeader) : sizeof(CHeader)); } /// Default Constructor, should never be used explicit CAccessor() { } @@ -104,7 +104,7 @@ uint64 key() const { return mapped() ? ((CMappedHeader*)fullRow())->getKey() : 0; } /// Get Full Row Data - const TRowData fullRow() const { return (*_MapIt).second; } + TRowData fullRow() const { return (*_MapIt).second; } /// Equals diff -r 2d735b28e5f8 code/ryzom/server/src/server_share/basic_effect.h --- a/code/ryzom/server/src/server_share/basic_effect.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/server_share/basic_effect.h Wed Sep 22 11:00:19 2010 +0200 @@ -35,13 +35,13 @@ public: /// Constructor CBasicEffect(EFFECT_FAMILIES::TEffectFamily family, const TDataSetRow & creatorId, const TDataSetRow & targetRowId) - : _Family(family), _CreatorRowId(creatorId), _TargetRowId(targetRowId) + : _CreatorRowId(creatorId), _TargetRowId(targetRowId), _Family(family) { _EffectId = ++_EffectCounter; } CBasicEffect( EFFECT_FAMILIES::TEffectFamily family, const TDataSetRow & creatorId, const TDataSetRow & targetRowId, uint32 effectId ) - : _Family(family), _CreatorRowId(creatorId), _TargetRowId(targetRowId), _EffectId(effectId) + : _CreatorRowId(creatorId), _TargetRowId(targetRowId), _Family(family), _EffectId(effectId) { } diff -r 2d735b28e5f8 code/ryzom/server/src/server_share/msg_brick_service.h --- a/code/ryzom/server/src/server_share/msg_brick_service.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/server_share/msg_brick_service.h Wed Sep 22 11:00:19 2010 +0200 @@ -119,7 +119,7 @@ uint8 Index; // index of the phrase in the player memorized phrase interface if != 0xff - CEGSExecuteMsg() : Index(0xff), Cyclic(false) + CEGSExecuteMsg() : Cyclic(false), Index(0xff) {} virtual void description () diff -r 2d735b28e5f8 code/ryzom/server/src/server_share/mysql_wrapper.h --- a/code/ryzom/server/src/server_share/mysql_wrapper.h Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/server/src/server_share/mysql_wrapper.h Wed Sep 22 11:00:19 2010 +0200 @@ -121,9 +121,9 @@ CResultBase(MYSQL_RES *result) - : _Result(result), - _CurrentRow(NULL), - _FieldLength(NULL) + : _CurrentRow(NULL), + _FieldLength(NULL), + _Result(result) { } diff -r 2d735b28e5f8 code/ryzom/tools/assoc_mem/brain.cpp --- a/code/ryzom/tools/assoc_mem/brain.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/tools/assoc_mem/brain.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -26,7 +26,7 @@ _UpdateEvery = 0; } -CBrain::CBrain(const CBrain &c) +CBrain::CBrain(const CBrain &c) : CMood() { _Personality = c._Personality; _RealTime = c._RealTime; @@ -152,4 +152,4 @@ _LastUpdate++; if ( _LastUpdate > _UpdateEvery ) build(); -} \ No newline at end of file +} diff -r 2d735b28e5f8 code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp --- a/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/tools/leveldesign/csv_transform/csv_transform.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -95,7 +95,7 @@ enum { DEFAULT, PARA, HEADER, FOOTER, FILE_HEADER, FILE_FOOTER, TBL, TABTBL, TEXT } mode; public: - CCruncher(): mode(DEFAULT), firstTblLine(true) + CCruncher(): firstTblLine(true), mode(DEFAULT) { } diff -r 2d735b28e5f8 code/ryzom/tools/leveldesign/icon_search/icon_search.cpp --- a/code/ryzom/tools/leveldesign/icon_search/icon_search.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/tools/leveldesign/icon_search/icon_search.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -220,7 +220,7 @@ sixieme = (int)files.size() / 6; - printf( "%d files are processed", files.size() ); + printf( "%d files are processed", (sint) files.size() ); for (uint32 i=0; i ColumnList; - uint Id; - sint Column; sint Columns; + uint Id; + CClassNode* ClassNode; CClassNode* getParentClass() { return dynamic_cast(Parent); } diff -r 2d735b28e5f8 code/ryzom/tools/pdr_util/pdr_util.cpp --- a/code/ryzom/tools/pdr_util/pdr_util.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/tools/pdr_util/pdr_util.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -149,7 +149,7 @@ CSheetId::init(false); - for(int f = 0; f < filenames.size(); f++) + for(uint f = 0; f < filenames.size(); f++) { fileName = filenames[f]; @@ -278,6 +278,8 @@ if (!pdr.writeToTxtFile(outputFileName.c_str(), CPersistentDataRecord::LINES_STRING)) goto failureWrite; break; + default: + break; } // return 0; diff -r 2d735b28e5f8 code/ryzom/tools/server/ai_build_wmap/main.cpp --- a/code/ryzom/tools/server/ai_build_wmap/main.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/tools/server/ai_build_wmap/main.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -45,24 +45,21 @@ var = cf.getVarPtr("Paths"); if (var != NULL) { - uint i; - for (i=0; (sint)isize(); ++i) + for (uint i=0; i < var->size(); ++i) LookupPath.push_back(var->asString(i)); } var = cf.getVarPtr("NoRecursePaths"); if (var != NULL) { - uint i; - for (i=0; (sint)isize(); ++i) + for (uint i=0; i < var->size(); ++i) LookupNoRecursePath.push_back(var->asString(i)); } var = cf.getVarPtr("PacsPrimPaths"); if (var != NULL) { - uint i; - for (i=0; (sint)isize(); ++i) + for (uint i=0; i < var->size(); ++i) PacsPrimPath.push_back(var->asString(i)); } @@ -77,14 +74,12 @@ var = cf.getVarPtr("Commands"); if (var != NULL) { - uint i; - for (i=0; (sint)isize(); ++i) + for (uint i=0; i < var->size(); ++i) commands.push_back(var->asString(i)); } - uint i; string cmd; - for (i=1; (sint)i > zones; zones.reserve(zoneNames.size()); - sint zoneMinX, zoneMaxX; - sint zoneMinY, zoneMaxY; + sint zoneMinX = 0; + sint zoneMaxX = 0; + sint zoneMinY = 0; + sint zoneMaxY = 0; bool firstZoneCorner = true; for(uint k = 0; k < zoneNames.size(); ++k) { @@ -252,7 +254,7 @@ CIFile f; if (f.open(cacheFilename)) { - CPackedZoneBase *pb; + CPackedZoneBase *pb = NULL; f.serialPolyPtr(pb); packedZoneGrid(x, y) = pb; mustRebuild = false; diff -r 2d735b28e5f8 code/ryzom/tools/server/build_world_packed_col/village.cpp --- a/code/ryzom/tools/server/build_world_packed_col/village.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/tools/server/build_world_packed_col/village.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -32,7 +32,7 @@ using namespace NLMISC; using namespace NL3D; -//********************************************************************************************** +********************************************************************************************** CVillageGrid::CVillageGrid() { _ZoneMinX = 0; @@ -40,7 +40,7 @@ } -//********************************************************************************************** +********************************************************************************************** void CVillageGrid::init(uint gridWidth, uint gridHeight, sint zoneMinX, sint zoneMinY) { reset(); @@ -51,13 +51,13 @@ VillageGrid.init(gridWidth, gridHeight); } -//********************************************************************************************** +********************************************************************************************** void CVillageGrid::reset() { NLMISC::contReset(*this); } -//********************************************************************************************** +********************************************************************************************** void CVillageGrid::addVillagesFromContinent(const std::string &continentSheetName) { // Load the form @@ -172,7 +172,7 @@ } } -//********************************************************************************************** +********************************************************************************************** bool CVillageGrid::loadVillageSheet(const NLGEORGES::UFormElm *villageItem, const std::string &continentSheetName, uint villageIndex, CVillage &dest) { dest.IG.clear(); @@ -232,7 +232,7 @@ } -//********************************************************************************************** +********************************************************************************************** void CVillage::load(TShapeCache &shapeCache) { for(std::vector::iterator it = IG.begin(); it != IG.end(); ++it) @@ -241,7 +241,7 @@ } } -//********************************************************************************************** +********************************************************************************************** void CIGInfo::load(TShapeCache &shapeCache) { if (Loaded) return; @@ -302,4 +302,4 @@ -*/ \ No newline at end of file +*/ diff -r 2d735b28e5f8 code/ryzom/tools/translation_tools/extract_bot_names.cpp --- a/code/ryzom/tools/translation_tools/extract_bot_names.cpp Tue Sep 21 15:08:36 2010 -0500 +++ b/code/ryzom/tools/translation_tools/extract_bot_names.cpp Wed Sep 22 11:00:19 2010 +0200 @@ -272,8 +272,9 @@ //------------------------------------------------------------------- // init the sheets CSheetId::init(false); - char *PACKED_SHEETS_NAME = "bin/translation_tools_creature.packed_sheets"; + string PACKED_SHEETS_NAME = "bin/translation_tools_creature.packed_sheets"; loadForm("creature", PACKED_SHEETS_NAME, Creatures, false, false); + if (Creatures.empty()) { for (uint i=0;i