Changed: #825 Remove all warning when compiling Ryzom on Linux

This commit is contained in:
kervala 2010-05-18 16:53:47 +02:00
parent fff95ad179
commit 896b62d236
207 changed files with 698 additions and 698 deletions

View file

@ -726,8 +726,8 @@ void loadForm2(const std::vector<std::string> &sheetFilters, const std::string &
{
uint dicIndex;
// add a new dictionnary entry
dicIndex = dictionnary.size();
dictionnaryIndex.insert(std::make_pair(filename, dictionnary.size()));
dicIndex = (uint)dictionnary.size();
dictionnaryIndex.insert(std::make_pair(filename, (NLMISC::TSStringId)dictionnary.size()));
dictionnary.push_back(filename);
// add the dependency index
@ -793,7 +793,7 @@ void loadForm2(const std::vector<std::string> &sheetFilters, const std::string &
ofile.serialCont(dictionnary);
// write the dependencies data
uint32 depSize = dependencies.size();
uint32 depSize = (uint32)dependencies.size();
ofile.serial(depSize);
std::map<NLMISC::CSheetId, std::vector<uint32> >::iterator first(dependencies.begin()), last(dependencies.end());
for (; first != last; ++first)
@ -811,7 +811,7 @@ void loadForm2(const std::vector<std::string> &sheetFilters, const std::string &
ofile.seek(endBlockSize, NLMISC::IStream::begin);
// write the sheet data
uint32 nbEntries = sheetIds.size();
uint32 nbEntries = (uint32)sheetIds.size();
uint32 ver = T::getVersion ();
ofile.serial (nbEntries);
ofile.serial (ver);

View file

@ -1504,7 +1504,7 @@ private:
}
else
{
len= cont.size();
len= (sint32)cont.size();
serial(len);
__iterator it= cont.begin();
@ -1667,7 +1667,7 @@ private:
}
else
{
len= cont.size();
len= (sint32)cont.size();
serial(len);
__iterator it= cont.begin();

View file

@ -147,7 +147,7 @@ uint8 CBitmap::readPNG( NLMISC::IStream &f )
// read rest of file, and get additional chunks in info_ptr
png_read_end(png_ptr, info_ptr);
uint32 dstChannels, firstChannel, lastChannel;
uint32 dstChannels = 0, firstChannel = 0, lastChannel = 0;
if (iColorType == PNG_COLOR_TYPE_RGBA || iColorType == PNG_COLOR_TYPE_RGB || iColorType == PNG_COLOR_TYPE_PALETTE)
{

View file

@ -206,7 +206,7 @@ void NLPACS::CGlobalRetriever::check() const
}
if (chain.getRight()>=(sint)retriever.getSurfaces().size() ||
chain.getRight()<=CChain::getDummyBorderChainId() && !CChain::isBorderChainId(chain.getRight()))
(chain.getRight()<=CChain::getDummyBorderChainId() && !CChain::isBorderChainId(chain.getRight())))
{
nlwarning("retriever %d, chain %d: reference on right surface is not valid", instance.getRetrieverId(), j);
}
@ -313,7 +313,7 @@ void NLPACS::CGlobalRetriever::getBorders(const CAABBox &sbox, std::vector<std::
bool luw = (lsurface.getFlags() & (1 << CRetrievableSurface::IsUnderWaterBit)) != 0;
bool ruw = (rsurface.getFlags() & (1 << CRetrievableSurface::IsUnderWaterBit)) != 0;
if (luw && !ruw || !luw && ruw)
if (luw != ruw)
chainType = 3;
}
@ -1461,7 +1461,7 @@ void NLPACS::CGlobalRetriever::testCollisionWithCollisionChains(CCollisionSurfac
//========================
float t=0.0, tMin=1;
CVector2f normal, normalMin;
CVector2f normal, normalMin(0.0f, 0.0f);
// run list of edge.
sint32 curEdge= colChain.FirstEdgeCollide;
while(curEdge!=(sint32)0xFFFFFFFF)

View file

@ -1415,7 +1415,7 @@ void NLPACS::CLocalRetriever::snapToInteriorGround(NLPACS::ULocalPosition &posit
CVector posh = pos+CVector(0.0f, 0.0f, 1.0f);
CVector2f pos2d = position.Estimation;
float bestDist = 1.0e10f;
CVector best;
CVector best(0.0f, 0.0f, 0.0f);
vector<uint32>::iterator it;
snapped = false;
for (it=selection.begin(); it!=selection.end(); ++it)
@ -1483,7 +1483,7 @@ float NLPACS::CLocalRetriever::getHeight(const NLPACS::ULocalPosition &position)
CVector pos = position.Estimation;
CVector posh = pos+CVector(0.0f, 0.0f, 1.0f);
float bestDist = 1.0e10f;
CVector best;
CVector best(0.0f, 0.0f, 0.0f);
vector<uint32>::iterator it;
for (it=selection.begin(); it!=selection.end(); ++it)
{
@ -1580,7 +1580,7 @@ float NLPACS::CLocalRetriever::getInteriorHeightAround(const ULocalPosition &pos
CVector pos = position.Estimation;
CVector posh = pos+CVector(0.0f, 0.0f, 1.0f);
float bestDist = 1.0e10f;
CVector best;
CVector best(0.0f, 0.0f, 0.0f);
vector<uint32>::iterator it;
for (it=selection.begin(); it!=selection.end(); ++it)
{

View file

@ -1183,7 +1183,7 @@ void CPrimitiveWorldImage::reaction (CPrimitiveWorldImage& second, const CCollis
collisionPosition+=_Speed*desc.ContactTime;
// Calc new speed
CVectorD newSpeed;
CVectorD newSpeed(0.0, 0.0, 0.0);
// Obstacle ?
if (collision)

View file

@ -809,7 +809,7 @@ namespace ADMIN
// read the text from the file - note that the number of bytes read may be less than the
// number of bytes requested because we've opened the file in text mode and not binary mode
uint32 bytesRead= fread(&txt[0],1,fileSize,f);
uint32 bytesRead= (uint32)fread(&txt[0],1,fileSize,f);
txt.resize(bytesRead);
fclose(f);
@ -833,7 +833,7 @@ namespace ADMIN
// read the text from the file - note that the number of bytes read may be less than the
// number of bytes requested because we've opened the file in text mode and not binary mode
uint32 bytesRead= fread(&txt[0],1,fileSize,f);
uint32 bytesRead= (uint32)fread(&txt[0],1,fileSize,f);
txt.resize(bytesRead);
fclose(f);
@ -859,7 +859,7 @@ namespace ADMIN
// read the text from the file - note that the number of bytes read may be less than the
// number of bytes requested because we've opened the file in text mode and not binary mode
uint32 bytesRead= fread(&txt[0],1,fileSize,f);
uint32 bytesRead= (uint32)fread(&txt[0],1,fileSize,f);
txt.resize(bytesRead);
fclose(f);

View file

@ -919,7 +919,7 @@ void CMovementMagnet::getNewDestination(RYAI_MAP_CRUNCH::CWorldPosition const& a
{
// first, try to take the same way as another bot of the group with the same comportment.
CCont<CBot > &bots = _BotFauna.spawnGrp().bots();
uint32 nbBots=bots.size();
uint32 nbBots=(uint32)bots.size();
float bestScore=0.f;
CAIVector bestDest;

View file

@ -496,7 +496,7 @@ void CBotNpc::calcSpawnPos(RYAI_MAP_CRUNCH::CWorldMap const& worldMap)
std::vector<CShape::TPosition> const& posList = state->shape().getGeometry();
do
{
const uint32 a=CAIS::rand16(posList.size());
const uint32 a=CAIS::rand16((uint32)posList.size());
const uint32 b=(a+1)%posList.size();
const double weight=CAIS::frand();
_StartPos.setXY(posList[a].toAIVector()+(posList[b].toAIVector()-posList[a].toAIVector())*weight);
@ -973,7 +973,7 @@ void CBotNpc::setColours(std::string input)
if (NLMISC::nlstricmp(colour,colourNames[i][j])==0)
{
// found an entry so add to the results vector
results.push_back(i);
results.push_back((uint32)i);
done=true;
}
}
@ -1003,7 +1003,7 @@ void CBotNpc::setColours(std::string input)
{
// upper body colour
generator.srand(seed+975*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorArms(val);
_Sheet->setColorHands(val);
_Sheet->setColorBody(val);
@ -1012,7 +1012,7 @@ void CBotNpc::setColours(std::string input)
{
// lower body colour
generator.srand(seed+977*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorLegs(val);
_Sheet->setColorFeets(val);
}
@ -1020,49 +1020,49 @@ void CBotNpc::setColours(std::string input)
{
// hair colour, mapped to head
generator.srand(seed+976*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorHead(val);
}
else if ( NLMISC::nlstricmp(keyword,"CHEAD")==0)
{
// head color
generator.srand(seed+979*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorHead(val);
}
else if ( NLMISC::nlstricmp(keyword,"CARMS")==0)
{
// arms color
generator.srand(seed+981*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorArms(val);
}
else if ( NLMISC::nlstricmp(keyword,"CHANDS")==0)
{
// arms color
generator.srand(seed+983*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorHands(val);
}
else if ( NLMISC::nlstricmp(keyword,"CBODY")==0)
{
// arms color
generator.srand(seed+985*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorBody(val);
}
else if ( NLMISC::nlstricmp(keyword,"CLEGS")==0)
{
// arms color
generator.srand(seed+987*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorLegs(val);
}
else if ( NLMISC::nlstricmp(keyword,"CFEETS")==0)
{
// arms color
generator.srand(seed+989*0x10000);
uint8 val = (uint8)results[generator.rand(results.size()-1)];
uint8 val = (uint8)results[generator.rand((uint16)results.size()-1)];
_Sheet->setColorFeets(val);
}
}

View file

@ -583,7 +583,7 @@ inline const CAIEntityMatrixIteratorTblRandom::iterator CAIEntityMatrixIteratorT
inline uint32 CAIEntityMatrixIteratorTblRandom::size() const
{
return _tbl.size();
return (uint32)_tbl.size();
}
@ -631,7 +631,7 @@ inline const CAIEntityMatrixIteratorTblLinear::iterator CAIEntityMatrixIteratorT
inline uint32 CAIEntityMatrixIteratorTblLinear::size() const
{
return _tbl.size();
return (uint32)_tbl.size();
}

View file

@ -305,7 +305,7 @@ public:
//@{
virtual void addHealer(IAIEntityPhysicalHealer* healer) { _Healers.insert(healer); if (healer) healer->healerAdded(this); }
virtual void delHealer(IAIEntityPhysicalHealer* healer) { _Healers.erase(healer); if (healer) healer->healerRemoved(this); }
virtual int getHealerCount() { return _Healers.size(); }
virtual int getHealerCount() { return (int)_Healers.size(); }
//@}
static int _PlayerVisibilityDistance;

View file

@ -81,7 +81,7 @@ static bool s_attack(CAIEntityPhysical const& target, float const& dist,
if (action->SelfAction() == self)
phraseList.push_back(action);
}
uint32 const size = phraseList.size();
uint32 const size = (uint32)phraseList.size();
if (size>0)
{
nlassert(target.getRyzomType()!=debugCheckedType);

View file

@ -334,7 +334,7 @@ void CSpawnGroup::incSpawnedBot(CBot& spawnBot)
{
#if !FINAL_VERSION
uint32 botIndex = spawnBot.getChildIndex();
for (uint32 i=_BotsToRespawn.size(); i--; )
for (uint32 i=(uint32)_BotsToRespawn.size(); i--; )
{
if (_BotsToRespawn[i].getBotIndex()==botIndex)
{
@ -344,7 +344,7 @@ void CSpawnGroup::incSpawnedBot(CBot& spawnBot)
_BotsToRespawn.pop_back();
}
}
for (uint32 i=_BotsToDespawn.size(); i--; )
for (uint32 i=(uint32)_BotsToDespawn.size(); i--; )
{
if (_BotsToDespawn[i].getBotIndex()==botIndex)
{

View file

@ -135,9 +135,9 @@ public:
uint32 nbSpawnedBot() const { return _NbSpawnedBot; }
uint32 nbBotToRespawn() const { return _BotsToRespawn.size(); }
uint32 nbBotToRespawn() const { return (uint32)_BotsToRespawn.size(); }
uint32 nbBotToDespawn() const { return _BotsToDespawn.size(); }
uint32 nbBotToDespawn() const { return (uint32)_BotsToDespawn.size(); }
bool isGroupAlive(uint32 const nbMoreKilledBot = 0) const;

View file

@ -1008,7 +1008,7 @@ void CGrpFauna::setCyles(std::string const& cycles)
{
if (curCycle==~0)
{
curCycle = _Cycles.size();
curCycle = (uint32)_Cycles.size();
_Cycles.push_back(Cycle());
}
Cycle& CycleRef = _Cycles[curCycle];
@ -1067,7 +1067,7 @@ void CGrpFauna::allocateBots()
CPopulation* pop = *(it);
uint count=0;
for (sint j=pop->size()-1;j>=0;j--)
for (sint j=(sint)pop->size()-1;j>=0;j--)
count+=(*pop)[j].getBotCount(getCountMultiplierFlag());
if (count>maxPopulation)

View file

@ -103,7 +103,7 @@ void CSpawnGroupNpc::resetSlowUpdateCycle()
// Find the lowest bucket
vector<uint32>::iterator it = std::min_element(_SlowUpdateBuckets.begin(), _SlowUpdateBuckets.end());
// Assign it to the group
_SlowUpdateCycle = it - _SlowUpdateBuckets.begin();
_SlowUpdateCycle = (uint32)(it - _SlowUpdateBuckets.begin());
// Fill the bucket with the group
*it += bots().size();
}

View file

@ -94,7 +94,7 @@ void CAIInstance::updateZoneTrigger(CBotPlayer* player)
FOREACH(it, CCont<CManager>, _Managers)
{
std::string name = it->getName();
uint32 size = name.size();
uint32 size = (uint32)name.size();
const uint32 extensionSize = 13; // strlen(".zone_trigger");
if (size >= 13 && name.substr(size - extensionSize, extensionSize) == ".zone_trigger" )
{

View file

@ -837,7 +837,7 @@ void COutpost::createSquad(CGroupDesc<COutpostSquadFamily> const* groupDesc, COu
// FOREACH(itState, CCont<CAIState>, stateMachine->states())
for (size_t i=0; i<stateMachine->cstStates().size(); ++i)
{
CAIState* state = stateMachine->cstStates()[i];
CAIState* state = stateMachine->cstStates()[(uint32)i];
if (state->getName()==initialStateName)
initialState = state;
}

View file

@ -217,7 +217,7 @@ bool CBotPlayer::isAggressive() const
void CBotPlayer::addAggroer(TDataSetRow const& row)
{
#if !FINAL_VERSION
for (sint32 i=_AggroerList.size()-1;i>=0;i--)
for (sint32 i=(sint32)_AggroerList.size()-1;i>=0;i--)
nlassert(_AggroerList[i]!=row);
#endif
_AggroerList.push_back(row);
@ -225,7 +225,7 @@ void CBotPlayer::addAggroer(TDataSetRow const& row)
void CBotPlayer::removeAggroer(TDataSetRow const& row)
{
for (sint32 i=_AggroerList.size()-1;i>=0;i--)
for (sint32 i=(sint32)_AggroerList.size()-1;i>=0;i--)
{
if (_AggroerList[i]==row)
{
@ -407,7 +407,7 @@ void CManagerPlayer::getTeamIds(std::vector<uint16>& teamIds)
void CBotPlayer::forgotAggroForAggroer()
{
for (sint32 i=_AggroerList.size()-1; i>=0; --i)
for (sint32 i=(sint32)_AggroerList.size()-1; i>=0; --i)
{
CAIEntityPhysical* const phys = CAIS::instance().getEntityPhysical(_AggroerList[i]);
if (!phys)

View file

@ -946,7 +946,7 @@ void CGrpProfileGuard::updateProfile(uint ticksSinceLastUpdate)
static uint32 s_maxBotsVisible = 0;
static double s_maxBotsVisionTime = 0.0;
uint32 numBotsVisible = GuardVision.bots().size();
uint32 numBotsVisible = (uint32)GuardVision.bots().size();
double deltaVisionTime = CTime::ticksToSecond(endVisionTime-startVisionTime);
bool bTellUs = false;
if( s_maxBotsVisible < numBotsVisible )
@ -1443,7 +1443,7 @@ void CGrpProfileGoToPoint::calcRatios()
if (_Shape!=SHAPE_RECTANGLE)
return;
const uint32 nbbots=_NpcList.size();
const uint32 nbbots=(uint32)_NpcList.size();
_NbRange = (uint32) sqrt(_Ratio*nbbots);
if (_NbRange==0)
@ -1922,7 +1922,7 @@ void CGrpProfileFollowRoute::calcRatios ()
if (_Shape!=SHAPE_RECTANGLE)
return;
const uint32 nbbots=_NpcList.size();
const uint32 nbbots=(uint32)_NpcList.size();
_NbRange = (uint32) sqrt(_Ratio*nbbots);
if (_NbRange==0)
@ -2574,8 +2574,8 @@ void CGrpProfileWander::updateProfile(uint ticksSinceLastUpdate)
if (!_DestinationReachedAll)
{
uint32 npcSize = pgrp.bots().size();
uint32 reachedSize = _NpcDestinationReached.size();
uint32 npcSize = (uint32)pgrp.bots().size();
uint32 reachedSize = (uint32)_NpcDestinationReached.size();
if (reachedSize!= npcSize)
{
_NpcDestinationReached.resize(npcSize);
@ -2600,7 +2600,7 @@ void CGrpProfileWander::updateProfile(uint ticksSinceLastUpdate)
if (!vision.players().empty())
{
// there are some player near, look at one if it is not behin us
uint index = CAIS::rand16(vision.players().size());
uint index = CAIS::rand16((uint32)vision.players().size());
CAngle angle(CAngle::pi());
while (index < vision.players().size() && !target)
@ -2619,7 +2619,7 @@ void CGrpProfileWander::updateProfile(uint ticksSinceLastUpdate)
if (!target && !vision.bots().empty())
{
// there are some bots near, look at one if it is not behin us
uint index = CAIS::rand16(vision.bots().size());
uint index = CAIS::rand16((uint32)vision.bots().size());
CAngle angle(CAngle::pi());
while (index < vision.bots().size() && !target)
@ -2726,7 +2726,7 @@ void CGrpProfileWander::updateProfile(uint ticksSinceLastUpdate)
pgrp.processStateEvent(pgrp.mgr().EventDestinationReachedFirst);
}
uint32 first=0, last=_NpcDestinationReached.size();
uint32 first=0, last=(uint32)_NpcDestinationReached.size();
for ( ; first != last && _NpcDestinationReached[first]; ++first) {}
if (first == last)
@ -2912,7 +2912,7 @@ void CGrpProfileWanderNoPrim::updateProfile(uint ticksSinceLastUpdate)
if (!vision.players().empty())
{
// there are some player near, look at one if it is not behin us
uint index = CAIS::rand16(vision.players().size());
uint index = CAIS::rand16((uint32)vision.players().size());
CAngle angle(CAngle::pi());
while (index < vision.players().size() && !target)
@ -2931,7 +2931,7 @@ void CGrpProfileWanderNoPrim::updateProfile(uint ticksSinceLastUpdate)
if (!target && !vision.bots().empty())
{
// there are some bots near, look at one if it is not behin us
uint index = CAIS::rand16(vision.bots().size());
uint index = CAIS::rand16((uint32)vision.bots().size());
CAngle angle(CAngle::pi());
while (index < vision.bots().size() && !target)

View file

@ -989,7 +989,7 @@ public:
vector<string> params;
explodeSubStrings(inStr, params, -1);
const uint32 nbSubScript=params.size();
const uint32 nbSubScript=(uint32)params.size();
std::vector<CSmartPtr<CFightScriptComp> > scriptComps;
try

View file

@ -282,7 +282,7 @@ public:
static uint size()
{
if (!initialised()) init();
return Stack.size();
return (uint)Stack.size();
}
static void pop()

View file

@ -463,7 +463,7 @@ uint32 CCont<TChld>::getFirstFreeChild()
if (!_Childs[index])
break;
}
return index;
return (uint32)index;
}
template <class TChld>

View file

@ -823,7 +823,7 @@ public:
fb->setModifier (_value, nrjIndex);
return;
}
fb->setModifier (_value, _index);
fb->setModifier (_value, (uint32)_index);
}
virtual void doOnCellZone(CCellZone *cz) const
@ -2874,7 +2874,7 @@ static int const MULTI_LINE_FORMATER_maxn = 78;
void MULTI_LINE_FORMATER::pushTitle(std::vector<std::string>& container, std::string const& text)
{
int const maxn = MULTI_LINE_FORMATER_maxn;
int n = maxn - text.length() - 4;
int n = maxn - (int)text.length() - 4;
container.push_back(" _/");
container.back() += text;
container.back() += "\\" + std::string(n, '_');

View file

@ -800,7 +800,7 @@ bool CContinent::spawn()
// Spawn regions
for (size_t i=0; i<_Regions.size(); ++i)
{
CRegion* region = _Regions[i];
CRegion* region = _Regions[(uint32)i];
if (!region)
continue;
region->spawn();
@ -808,7 +808,7 @@ bool CContinent::spawn()
// Spawn outposts
for (size_t i=0; i<_Outposts.size(); ++i)
{
COutpost* outpost = _Outposts[i];
COutpost* outpost = _Outposts[(uint32)i];
if (!outpost)
continue;
outpost->spawn();
@ -822,7 +822,7 @@ bool CContinent::despawn()
// Despawn regions
for (size_t i=0; i<_Regions.size(); ++i)
{
CRegion* region = _Regions[i];
CRegion* region = _Regions[(uint32)i];
if (!region)
continue;
region->despawn();
@ -830,7 +830,7 @@ bool CContinent::despawn()
// Despawn outposts
for (size_t i=0; i<_Outposts.size(); ++i)
{
COutpost* outpost = _Outposts[i];
COutpost* outpost = _Outposts[(uint32)i];
if (!outpost)
continue;
outpost->despawn();
@ -1113,7 +1113,7 @@ bool CRegion::spawn()
// Spawn cellzones
for (size_t j=0; j<_CellZones.size(); ++j)
{
CCellZone* cellZone = _CellZones[j];
CCellZone* cellZone = _CellZones[(uint32)j];
if (!cellZone)
continue;
cellZone->spawn();
@ -1127,7 +1127,7 @@ bool CRegion::despawn()
// Despawn cellzones
for (size_t j=0; j<_CellZones.size(); ++j)
{
CCellZone* cellZone = _CellZones[j];
CCellZone* cellZone = _CellZones[(uint32)j];
if (!cellZone)
continue;
cellZone->despawn();
@ -1760,7 +1760,7 @@ const CFaunaZone *CCellZone::lookupFaunaZone(const CPropertySet &activity, TASta
}
}
if (candidates.size()>0)
return candidates[CAIS::rand16(candidates.size())];
return candidates[CAIS::rand16((uint32)candidates.size())];
return NULL;
}
@ -1868,7 +1868,7 @@ const CNpcZone *CCellZone::lookupNpcZone(const CPropertySet &activity, size_t re
}
if (candidates.size()>0)
return candidates[CAIS::rand16(candidates.size())];
return candidates[CAIS::rand16((uint32)candidates.size())];
// warning only once
{
@ -2099,7 +2099,7 @@ const CNpcZone *CCellZone::lookupNpcZoneScorer (std::vector<CCell*> cells, const
}
if (candidates.size()>0)
return candidates[CAIS::rand16(candidates.size())];
return candidates[CAIS::rand16((uint32)candidates.size())];
return NULL;
}
@ -2108,7 +2108,7 @@ bool CCellZone::spawn()
// Spawn families
for (size_t k=0; k<_Families.size(); ++k)
{
CFamilyBehavior* familyBehavior = _Families[k];
CFamilyBehavior* familyBehavior = _Families[(uint32)k];
if (!familyBehavior)
continue;
familyBehavior->spawn();
@ -2122,7 +2122,7 @@ bool CCellZone::despawn()
// Despawn families
for (size_t k=0; k<_Families.size(); ++k)
{
CFamilyBehavior* familyBehavior = _Families[k];
CFamilyBehavior* familyBehavior = _Families[(uint32)k];
if (!familyBehavior)
continue;
familyBehavior->despawn();

View file

@ -339,9 +339,9 @@ inline
CNpcZone* CCell::npcZone(size_t index)
{
if (index<_NpcZonePlaces.size())
return _NpcZonePlaces[index];
return _NpcZonePlaces[(uint32)index];
else
return _NpcZoneShapes[index];
return _NpcZoneShapes[(uint32)index];
}
inline
@ -455,7 +455,7 @@ bool CGroupDesc<FamilyT>::setSheet(std::string const& sheetName)
{
for (size_t i=0; i<_MultiLevelSheetCount; ++i)
{
char letter = (i/4) + 'b';
char letter = char(i/4) + 'b';
char number = (i%4) + '1';
std::string sheetNameLevel = sheetName+letter+number;
// Compute sheet id
@ -1240,7 +1240,7 @@ void CBotDesc<FamilyT>::setSheet(std::string const& sheetName)
{
for (size_t i=0; i<_MultiLevelSheetCount; ++i)
{
char letter = (i/4) + 'b';
char letter = char(i/4) + 'b';
char number = (i%4) + '1';
std::string sheetNameLevel = sheetName+letter+number;
// Compute sheet id

View file

@ -195,7 +195,7 @@ public:
nlwarning("begin_state failed because state list is empty");
return false;
}
uint i=CAIS::rand16(_states.size());
uint i=CAIS::rand16((uint32)_states.size());
entity->getDebugHistory()->addHistory("GRP State Change: %s => %s",
entity->getState()->getAliasNode()->fullName().c_str(),
@ -458,7 +458,7 @@ public:
bool result=true;
const uint32 nbActions=_subActions.size();
const uint32 nbActions=(uint32)_subActions.size();
for (uint32 i=0;i<nbActions;i++)
{
if(_subActions[i]==NULL)
@ -513,7 +513,7 @@ public:
nlwarning("begin_punctual_state failed because state list is empty");
return false;
}
entity->setNextPunctualState(_states[CAIS::rand16(_states.size())]);
entity->setNextPunctualState(_states[CAIS::rand16((uint32)_states.size())]);
entity->getDebugHistory()->addHistory("GRP BeginPunctual State: %s",
entity->getNextPunctualState()->getAliasNode()->fullName().c_str());
return true;
@ -587,7 +587,7 @@ public:
nlwarning("random_select failed because sub-action list is empty");
return false;
}
_subActions[CAIS::rand16(_subActions.size())]->executeAction(entity,event);
_subActions[CAIS::rand16((uint32)_subActions.size())]->executeAction(entity,event);
return true;
}
@ -1193,7 +1193,7 @@ static CGroup* findGroup(const std::string& groupName,CStateMachine *stateMachin
{
CGroup *igroup=NULL;
// Check if theres a group with the good name in the same stateMachine (and only one).
for (sint32 grpIndex=grps.size()-1;grpIndex>=0;grpIndex--)
for (sint32 grpIndex=(sint32)grps.size()-1;grpIndex>=0;grpIndex--)
{
if (grps[grpIndex]->getManager().getStateMachine()!=stateMachine)
continue;
@ -1376,7 +1376,7 @@ public:
{
CGroup *igroup=NULL;
// Check if theres a group with the good name in the same stateMachine (and only one).
for (sint32 grpIndex=grps.size()-1;grpIndex>=0;grpIndex--)
for (sint32 grpIndex=(sint32)grps.size()-1;grpIndex>=0;grpIndex--)
{
if (grps[grpIndex]->getManager().getStateMachine()!=stateMachine)
continue;
@ -1822,7 +1822,7 @@ public:
// r2 mode groupename:botname
if (_R2)
{
uint first(0), last(_Groups.size());
uint first = 0, last = (uint)_Groups.size();
for (; first != last; ++first)
{
CGroup *grp = _Groups[first];
@ -2165,7 +2165,7 @@ public:
{
// this line treated first ... in case we bomb out in one of the if(...) { ... return; } cases
uint32 nbArgs = args.size();
uint32 nbArgs = (uint32)args.size();
if (nbArgs==0)
{
nlwarning("switch_actions (%s) need an argument !", eventNode->fullName().c_str());
@ -2943,7 +2943,7 @@ public:
if(cstring=="DSS_")
{
_Id=true;
NLMISC::CSString tmp = NLMISC::CSString (_Sentence).right(_Sentence.length()-4);
NLMISC::CSString tmp = NLMISC::CSString (_Sentence).right((unsigned int)_Sentence.length()-4);
NLMISC::CSString tmp2 = tmp.strtok(" ",false,false,false,false);
_ScenarioId = atoi(tmp2.c_str());
_Sentence = tmp;
@ -3021,7 +3021,7 @@ public:
else
{
float val;
uint32 size=_Vars.size(),i=0;
uint32 size=(uint32)_Vars.size(),i=0;
std::vector<float> values;
for(;i<size;++i)
{

View file

@ -87,7 +87,7 @@ void CKnapsackSolver::optimizeOptimal()
for (size_t i=0; i<size(); ++i)
take[i] = false;
// Run the optimization recursion
optimizeOptimalRec(size()-1, _WMax, 0, take);
optimizeOptimalRec((int)size()-1, _WMax, 0, take);
// Delete temporary solution
delete [] take;
}
@ -129,7 +129,7 @@ void CKnapsackSolver::optimizeOptimalRec(int i, float w, float v, bool* take)
void CKnapsackSolver::optimizeAddCheck()
{
H_AUTO(CKnapsackSolver_optimizeAddCheck);
int i = size()-1;
int i = (int)size()-1;
float w = _WMax - _WBest;
while (i>=0)
{
@ -149,7 +149,7 @@ void CKnapsackSolver::optimizeAddCheck()
void CKnapsackSolver::optimizeFullAddCheck()
{
H_AUTO(CKnapsackSolver_optimizeFullAddCheck);
int i = size()-1;
int i = (int)size()-1;
float w = _WMax - _WBest;
while (i>=0)
{
@ -168,7 +168,7 @@ void CKnapsackSolver::optimizeFullAddCheck()
void CKnapsackSolver::optimizeFastAddCheck()
{
H_AUTO(CKnapsackSolver_optimizeFastAddCheck);
int i = size()-1;
int i = (int)size()-1;
float w = _WMax - _WBest;
while (i>=0)
{
@ -192,7 +192,7 @@ void CKnapsackSolver::optimizeFullSingleReplace()
{
optimizeFullAddCheck();
H_AUTO(CKnapsackSolver_optimizeFullSingleReplace);
int i = size()-1;
int i = (int)size()-1;
while (i>=0)
{
// For each not taken ith element
@ -202,7 +202,7 @@ void CKnapsackSolver::optimizeFullSingleReplace()
float v = value(i);
int worst = i;
// Find the worst element that ith element can replace
int j = size()-1;
int j = (int)size()-1;
while (j>=0)
{
if (i!=j && _Take[j] && w<=weight(j) && v>value(j))
@ -239,7 +239,7 @@ void CKnapsackSolver::optimizeSingleReplace()
if (_VBest > vBest)
return;
H_AUTO(CKnapsackSolver_optimizeSingleReplace);
int i = size()-1;
int i = (int)size()-1;
while (i>=0)
{
// For each not taken ith element
@ -249,7 +249,7 @@ void CKnapsackSolver::optimizeSingleReplace()
float v = value(i);
int worst = i;
// Find the worst element that ith element can replace
int j = size()-1;
int j = (int)size()-1;
while (j>=0)
{
if (i!=j && _Take[j] && w<=weight(j) && v>value(j))
@ -286,7 +286,7 @@ void CKnapsackSolver::optimizeFastSingleReplace()
if (_VBest > vBest)
return;
H_AUTO(CKnapsackSolver_optimizeFastSingleReplace);
int i = size()-1;
int i = (int)size()-1;
while (i>=0)
{
// For each not taken ith element
@ -296,7 +296,7 @@ void CKnapsackSolver::optimizeFastSingleReplace()
float v = value(i);
int worst = i;
// Find the worst element that ith element can replace
int j = size()-1;
int j = (int)size()-1;
while (j>=0)
{
if (i!=j && _Take[j] && w<=weight(j) && v>value(j))
@ -334,7 +334,7 @@ void CKnapsackSolver::optimizeVeryFastSingleReplace()
if (_VBest > vBest)
return;
H_AUTO(CKnapsackSolver_optimizeVeryFastSingleReplace);
int i = size()-1;
int i = (int)size()-1;
while (i>=0)
{
// For each not taken ith element
@ -344,7 +344,7 @@ void CKnapsackSolver::optimizeVeryFastSingleReplace()
float v = value(i);
int worst = i;
// Find the worst element that ith element can replace
int j = size()-1;
int j = (int)size()-1;
while (j>=0)
{
if (i!=j && _Take[j] && w<=weight(j) && v>value(j))
@ -377,7 +377,7 @@ void CKnapsackSolver::optimizeTakeAll()
H_AUTO(CKnapsackSolver_optimizeTakeAll);
_WBest = 0;
_VBest = 0;
int i = size()-1;
int i = (int)size()-1;
while (i>=0)
{
_Take[i] = true;

View file

@ -785,7 +785,7 @@ void CAIAskForInfosOnEntityImp::callback (const std::string &name, NLNET::TServi
void CChangeActionFlagMsgImp::callback (const std::string &name, NLNET::TServiceId id)
{
const uint32 size = Entities.size();
const uint32 size = (uint32)Entities.size();
nlassert( size == ActionFlags.size() && size == Values.size());
for (uint32 i = 0 ; i < size ; ++i)

View file

@ -928,7 +928,7 @@ void getGroupTemplateWithFlags_sss_s(CStateInstance* entity, CScriptStack& stack
return;
}
CGroupDesc<CGroupFamily> const* groupDesc = groupDescs[CAIS::rand16(groupDescs.size())];
CGroupDesc<CGroupFamily> const* groupDesc = groupDescs[CAIS::rand16((uint32)groupDescs.size())];
stack.push(groupDesc->getFullName());
return;
}

View file

@ -2109,7 +2109,7 @@ void npcSay_css_(CStateInstance* entity, CScriptStack& stack)
if(prefix=="DSS_")
{
NLMISC::CSString phrase = NLMISC::CSString (text).right(text.length()-4);
NLMISC::CSString phrase = NLMISC::CSString (text).right((unsigned int)text.length()-4);
NLMISC::CSString idStr = phrase.strtok(" ",false,false,false,false);
uint32 scenarioId = atoi(idStr.c_str());
forwardToDss(spawnBot->dataSetRow(), CChatGroup::say, phrase, scenarioId);
@ -2118,7 +2118,7 @@ void npcSay_css_(CStateInstance* entity, CScriptStack& stack)
if (prefix=="RAW ")
{
NLMISC::CSString phrase = NLMISC::CSString (text).right(text.length()-4);
NLMISC::CSString phrase = NLMISC::CSString (text).right((unsigned int)text.length()-4);
npcChatToChannelSentence(spawnBot->dataSetRow(),CChatGroup::say, phrase);
return;
}

View file

@ -135,8 +135,8 @@ public:
void doOnFamily(CFamilyBehavior* fb) const
{
float value = fb->getModifier(_IndexSrc);
fb->setModifier(value, _IndexDest);
float value = fb->getModifier((uint32)_IndexSrc);
fb->setModifier(value, (uint32)_IndexDest);
}
void doOnCellZone(CCellZone* cz) const { }
@ -167,7 +167,7 @@ public:
fb->setModifier (_value, nrjIndex);
return;
}
fb->setModifier (_value, _index);
fb->setModifier (_value, (uint32)_index);
}
void doOnCellZone(CCellZone *cz) const { }

View file

@ -68,15 +68,15 @@ void setEvent_f_(CStateInstance* entity, CScriptStack& stack)
if (IsRingShard.get())
{
if ( entity->isUserEventBlocked( eventIndex) ) { return; } // Do not allow uservent recursion on ring shard
entity->blockUserEvent(eventIndex);
if ( entity->isUserEventBlocked( (uint32)eventIndex) ) { return; } // Do not allow uservent recursion on ring shard
entity->blockUserEvent((uint32)eventIndex);
}
entity->processStateEvent(entity->getPersistentStateInstance()->getEventContainer().EventUserEvent[eventIndex]);
if (IsRingShard.get())
{
entity->unblockUserEvent(eventIndex);
entity->unblockUserEvent((uint32)eventIndex);
}
}
@ -118,7 +118,7 @@ void setTimer_ff_(CStateInstance* si, CScriptStack& stack)
nlassert(false);
}
si->timerUser(timerId).set(deltaTime);
si->timerUser((uint)timerId).set((uint32)deltaTime);
}
//----------------------------------------------------------------------------
@ -183,7 +183,7 @@ void timerSetRyzomDaytime_fff_(CStateInstance* si, CScriptStack& stack)
return;
}
si->timerUser(timerId).set(timeTicks);
si->timerUser((uint)timerId).set((uint32)timeTicks);
}
//----------------------------------------------------------------------------
@ -222,7 +222,7 @@ void timerIsEnabled_f_f(CStateInstance* si, CScriptStack& stack)
return;
}
float isEnabled = si->timerUser(timerId).isEnabled();
float isEnabled = si->timerUser((uint)timerId).isEnabled();
stack.push(isEnabled);
}
@ -262,7 +262,7 @@ void timerIsSuspended_f_f(CStateInstance* si, CScriptStack& stack)
return;
}
float isSuspended = si->timerUser(timerId).isSuspended();
float isSuspended = si->timerUser((uint)timerId).isSuspended();
stack.push(isSuspended);
}
@ -301,7 +301,7 @@ void timerSuspend_f_(CStateInstance* si, CScriptStack& stack)
return;
}
si->timerUser(timerId).suspend();
si->timerUser((uint)timerId).suspend();
}
//----------------------------------------------------------------------------
@ -339,7 +339,7 @@ void timerDisable_f_(CStateInstance* si, CScriptStack& stack)
return;
}
si->timerUser(timerId).disable();
si->timerUser((uint)timerId).disable();
}
//----------------------------------------------------------------------------
@ -377,7 +377,7 @@ void timerResume_f_(CStateInstance* si, CScriptStack& stack)
return;
}
si->timerUser(timerId).resume();
si->timerUser((uint)timerId).resume();
}
//----------------------------------------------------------------------------
@ -423,12 +423,12 @@ void timerAdd_ff_(CStateInstance* si, CScriptStack& stack)
if (dt > 0)
{
uint32 dt2 = static_cast<uint32>(dt);
si->timerUser(timerId).add(dt2);
si->timerUser((uint)timerId).add(dt2);
}
else
{
uint32 dt2 = static_cast<uint32>(-dt);
si->timerUser(timerId).sub(dt2);
si->timerUser((uint)timerId).sub(dt2);
}
}

View file

@ -698,7 +698,7 @@ bool CPathCont::getPathForSource(CPathPosition& pathPos, RYAI_MAP_CRUNCH::CWorld
if (topoItFind!=topoItEnd)
{
pathPos._Index = topoItFind-topoItBegin;
pathPos._Index = (uint)(topoItFind-topoItBegin);
pathPos._Path = *it;
return true;
}
@ -834,7 +834,7 @@ RYAI_MAP_CRUNCH::CTopology::TTopologyRef const& CPathPosition::getNextTopology()
bool CPathPosition::isFinished() const
{
uint32 size = _Path->topologiesPath().size();
uint32 size = (uint32)_Path->topologiesPath().size();
return (size==0 || _Index==size-1);
}

View file

@ -2168,7 +2168,7 @@ bool compileExternalScript (const char *filename, const char *outputFilename)
string content;
char buffer[512];
int read;
while ((read = fread (buffer, 1, sizeof(buffer)-1, file)) == sizeof(buffer)-1)
while ((read = (int)fread (buffer, 1, sizeof(buffer)-1, file)) == sizeof(buffer)-1)
{
buffer[read] = 0;
content += buffer;

View file

@ -48,7 +48,7 @@ size_t makeStringId (const char *str)
void addSignature (char *dest, char s)
{
uint size = strlen (dest);
uint size = (uint)strlen (dest);
if (size+1 < (uint)(AICOMP_MAX_SIGNATURE))
{
dest[size] = s;
@ -58,8 +58,8 @@ void addSignature (char *dest, char s)
void addSignature (char *dest, char *src)
{
uint size0 = strlen (dest);
uint size1 = strlen (src);
uint size0 = (uint)strlen (dest);
uint size1 = (uint)strlen (src);
if (size0+size1+1 < (uint)(AICOMP_MAX_SIGNATURE))
strcat (dest, src);
}

View file

@ -58,7 +58,7 @@ bool aiCompile (std::vector<size_t> &dest, const char *script, const char *scrip
aiLine = 1;
aiErrorCount = 0;
aiInputScript = script;
aiInputScriptLength = strlen (script);
aiInputScriptLength = (uint)strlen (script);
strcpy (aiFile, scriptName);
aiRoot = NULL;
@ -189,7 +189,7 @@ uint getChildrenByteCodeSize (const list<vector<size_t> * > *l)
list<vector<size_t> * >::const_iterator ite = l->begin();
while (ite != l->end())
{
size += (*ite)->size ();
size += (uint)(*ite)->size ();
ite++;
}
return size;
@ -229,7 +229,7 @@ uint getChildrenByteCodeSize (const map<size_t, CCase *> *l)
map<size_t, CCase *>::const_iterator ite = l->begin ();
while (ite != l->end ())
{
size += ite->second->ByteCode->size();
size += (uint)ite->second->ByteCode->size();
ite ++;
}
return size;
@ -528,22 +528,22 @@ statement: openStatement { $$ = $1; }
openStatement: TOKEN_IF TOKEN_LP condition TOKEN_RP statement
{
int sizeToJump = $5.ByteCode->size() + 1; // 1 jump instruction to escape
int sizeToJump = (int)$5.ByteCode->size() + 1; // 1 jump instruction to escape
NODE4 ($$, $3, CScriptVM::JE, sizeToJump, $5);
}
| TOKEN_IF TOKEN_LP condition statement {ERROR_DETECTED ($$, "missing ')' at the end of the if condition");}
| TOKEN_IF condition TOKEN_RP statement {ERROR_DETECTED ($$, "missing '(' at the begining of the if condition");}
| TOKEN_IF TOKEN_LP condition TOKEN_RP closedStatement TOKEN_ELSE openStatement
{
int sizeToJump0 = $5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump1 = $7.ByteCode->size() + 1; // 1 jump instruction to escape
int sizeToJump0 = (int)$5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump1 = (int)$7.ByteCode->size() + 1; // 1 jump instruction to escape
NODE7 ($$, $3, CScriptVM::JE, sizeToJump0, $5, CScriptVM::JUMP, sizeToJump1, $7);
}
| TOKEN_IF TOKEN_LP condition closedStatement TOKEN_ELSE openStatement { ERROR_DETECTED ($$, "missing ')' at the end of the if condition");}
| TOKEN_IF condition TOKEN_RP closedStatement TOKEN_ELSE openStatement { ERROR_DETECTED ($$, "missing '(' at the begining of the if condition");}
| TOKEN_WHILE TOKEN_LP condition TOKEN_RP openStatement
{
int sizeToJump0 = $5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump0 = (int)$5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump1 = -(int)$5.ByteCode->size() - 3 - (int)$3.ByteCode->size(); // 1 jump instruction to escape
NODE6 ($$, $3, CScriptVM::JE, sizeToJump0, $5, CScriptVM::JUMP, sizeToJump1);
}
@ -552,15 +552,15 @@ openStatement: TOKEN_IF TOKEN_LP condition TOKEN_RP statement
closedStatement:TOKEN_IF TOKEN_LP condition TOKEN_RP closedStatement TOKEN_ELSE closedStatement
{
int sizeToJump0 = $5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump1 = $7.ByteCode->size() + 1; // 1 jump instruction to escape
int sizeToJump0 = (int)$5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump1 = (int)$7.ByteCode->size() + 1; // 1 jump instruction to escape
NODE7 ($$, $3, CScriptVM::JE, sizeToJump0, $5, CScriptVM::JUMP, sizeToJump1, $7);
}
| TOKEN_IF TOKEN_LP condition closedStatement TOKEN_ELSE closedStatement { ERROR_DETECTED ($$, "missing ')' at the end of the if condition");}
| TOKEN_IF condition TOKEN_RP closedStatement TOKEN_ELSE closedStatement { ERROR_DETECTED ($$, "missing '(' at the end of the if condition");}
| TOKEN_WHILE TOKEN_LP condition TOKEN_RP closedStatement
{
int sizeToJump0 = $5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump0 = (int)$5.ByteCode->size() + 3; // 2 jump instructions to escape
int sizeToJump1 = -(int)$5.ByteCode->size() - 3 - (int)$3.ByteCode->size(); // 1 jump instruction to escape
NODE6 ($$, $3, CScriptVM::JE, sizeToJump0, $5, CScriptVM::JUMP, sizeToJump1);
}
@ -697,7 +697,7 @@ switch: TOKEN_SWITCH TOKEN_LP expression TOKEN_RP TOKEN_LA cases TOKEN_RA
addNode ($$, _case->Case);
addNode ($$, sizeToJump);
sizeToJump += _case->ByteCode->size ();
sizeToJump += (uint)_case->ByteCode->size ();
sizeToJump += 1; // One for the RET
sizeToJump -= 1; // One for the case key
sizeToJump -= 1; // One for the offset

View file

@ -913,7 +913,7 @@ void CScriptVM::interpretCode(
IScriptContext* const sc = stack.top();
stack.pop();
string const& funcName = CStringMapper::unmap(*((TStringId*)&opcodes[++index]));
int mode = opcodes[++index];
int mode = (int)opcodes[++index];
string const& inParamsSig = CStringMapper::unmap(*((TStringId*)&opcodes[++index]));
string const& outParamsSig = CStringMapper::unmap(*((TStringId*)&opcodes[++index]));
if (sc)
@ -949,7 +949,7 @@ void CScriptVM::interpretCode(
continue;
case RAND:
{
const size_t randIndex=rand32(opcodes[index+1]); // rand(RANDCOUNT)
const size_t randIndex=rand32((uint32)opcodes[index+1]); // rand(RANDCOUNT)
index+=3; // pass RAND + RANDCOUNT + 1
stack.push((int)(index+opcodes[index])); // push the absolute address for RET.

View file

@ -167,7 +167,7 @@ void AISHEETS::CActionList::serial(NLMISC::IStream& s)
}
else
{
uint32 nbSheet = _Actions.size();
uint32 nbSheet = (uint32)_Actions.size();
s.serial(nbSheet);
for (uint32 i=0; i<nbSheet; ++i)
{
@ -777,7 +777,7 @@ void AISHEETS::CCreature::serial(NLMISC::IStream &s)
}
else
{
uint32 nbScript = _ScriptCompList.size();
uint32 nbScript = (uint32)_ScriptCompList.size();
s.serial(nbScript);
for (uint32 index=0; index<nbScript; ++index)
{
@ -968,7 +968,7 @@ uint32 AISHEETS::CSheets::getGroupPropertiesIndex(std::string groupIndexName)
std::map<string, uint32>::iterator it = _NameToGroupIndex.find(groupIndexName);
if (it==_NameToGroupIndex.end())
{
uint32 groupIndex = _NameToGroupIndex.size();
uint32 groupIndex = (uint32)_NameToGroupIndex.size();
_NameToGroupIndex.insert(make_pair(groupIndexName, groupIndex));
#if !FINAL_VERSION
nldebug("GroupIndex Entry: %s %d", groupIndexName.c_str(), groupIndex);

View file

@ -116,7 +116,7 @@ public:
bool hasPoints () const { return _Geometry.size()!=0; }
// accessors for path & patat geometry - whichever of the 2 exists
uint32 numPoints() { return _Geometry.size(); }
uint32 numPoints() { return (uint32)_Geometry.size(); }
const TPosition *point(uint32 idx) { return idx<_Geometry.size()? &_Geometry[idx]: NULL; }
const std::vector<TPosition> &getGeometry() const { return _Geometry; }

View file

@ -105,7 +105,7 @@ I16x16Layer *I16x16Layer::compress(I16x16Layer *layer, sint32 blank)
++((*it).second);
}
uint msize = count.size();
uint msize = (uint)count.size();
if (msize == 1)
{

View file

@ -267,7 +267,7 @@ public:
if (index>=data.size())
{
nlwarning("Unexpected end of input data in serialFromString()");
index=data.size()+1;
index=(uint)data.size()+1;
return CArg();
}
}
@ -279,7 +279,7 @@ public:
if (index>data.size())
{
nlwarning("Unexpected end of input data in serialFromString()");
index=data.size()+1;
index=(uint)data.size()+1;
return CArg();
}
return CArg(bool(data[index] == 1));
@ -289,7 +289,7 @@ public:
if (index>data.size())
{
nlwarning("Unexpected end of input data in serialFromString()");
index=data.size()+1;
index=(uint)data.size()+1;
return CArg();
}
return CArg(((sint32 *)&data[index])[-1]);
@ -299,7 +299,7 @@ public:
if (index>data.size())
{
nlwarning("Unexpected end of input data in serialFromString()");
index=data.size()+1;
index=(uint)data.size()+1;
return CArg();
}
return CArg(((float *)&data[index])[-1]);
@ -315,7 +315,7 @@ public:
break;
}
nlwarning("Unexpected type in serialFromString()");
index=data.size()+1;
index=(uint)data.size()+1;
return CArg();
}

View file

@ -113,7 +113,7 @@ public:
const NLMISC::CSmartPtr<CAIAliasDescriptionNode> &getParent () const { return _parent; }
// tree parse and search routines
uint32 getChildCount () const { nlassert(this!=NULL); return _children.size(); }
uint32 getChildCount () const { nlassert(this!=NULL); return (uint32)_children.size(); }
CAIAliasDescriptionNode * const &getChild (uint32 idx) const { return _children[idx]; }
const CAIAliasDescriptionNode *lookupAlias (uint32 alias) const
{

View file

@ -82,7 +82,7 @@ struct CAiEventReport
inline void addDelta(AI_EVENT_REPORT::TAIReportStat stat, sint32 delta)
{
const uint size = AffectedStats.size();
const uint size = (uint)AffectedStats.size();
for (uint i = 0; i < size; ++i)
{
if (AffectedStats[i] == stat)

View file

@ -86,7 +86,7 @@ namespace AI_SHARE
keyword=input.substr(i,k-i);
// find the end of the tail text
for (k=input.size();k>j && isWhiteSpace(input[k-1]);) --k; // k points to character after end of tail text
for (k=(uint)input.size();k>j && isWhiteSpace(input[k-1]);) --k; // k points to character after end of tail text
// find start of tail text
do { ++j; } while(j<k && isWhiteSpace(input[j])); // j points to start of tail text
@ -122,7 +122,7 @@ namespace AI_SHARE
word=input.substr(i,j-i);
// find the end of the tail text
for (i=input.size();i>j && isWhiteSpace(input[i-1]);) --i; // i points to character after end of tail text
for (i=(uint)input.size();i>j && isWhiteSpace(input[i-1]);) --i; // i points to character after end of tail text
// find start of tail text
do { ++j; } while(j<i && isWhiteSpace(input[j])); // j points to start of tail text

View file

@ -1461,7 +1461,7 @@ bool CWorldMap::findAStarPath(CWorldPosition const& start, CWorldPosition const&
// Push it in the node list
nodes.push_back(hnode);
// Take it as first father
uint father = nodes.size()-1;
uint father = (uint)nodes.size()-1;
// Add start topology to visited nodes (father holds start topo node index for the moment)
visited.insert(make_pair<CTopology::TTopologyId,uint>(startTopo, father));
@ -1550,7 +1550,7 @@ bool CWorldMap::findAStarPath(CWorldPosition const& start, CWorldPosition const&
visited.erase(itv);
}
// Create a new node for that cell
child = nodes.size();
child = (uint)nodes.size();
nodes.push_back(CAStarHeapNode(next, father, distance, true));
// Compute h(n) as an euclidian distance heuristic
float heuristic = (endPoint-next.getCstTopologyNode().Position).norm();
@ -1625,7 +1625,7 @@ bool CWorldMap::findAStarPath(const CTopology::TTopologyId &start, const CTopolo
CAStarHeapNode hnode(startTopo,0xffffffff,0.0f,true);
nodes.push_back(hnode);
uint father = nodes.size()-1;
uint father = (uint)nodes.size()-1;
// add current to visited nodes
visited.insert(make_pair<CTopology::TTopologyId,uint>(startTopo, father));
@ -1682,7 +1682,7 @@ bool CWorldMap::findAStarPath(const CTopology::TTopologyId &start, const CTopolo
if (itv == visited.end())
{
// if node is not open nor closed, create an entry
child = nodes.size();
child = (uint)nodes.size();
nodes.push_back(cnode);
}
else
@ -1759,7 +1759,7 @@ bool CWorldMap::findInsideAStarPath(CWorldPosition const& start, CWorldPosition
// Create a heap node for the start point and push it in the node list
nodes.push_back(CInsideAStarHeapNode(startNode, 0xffffffff, CDirection(), 0.f, true));
// Take it as first father
uint father = nodes.size()-1;
uint father = (uint)nodes.size()-1;
// Add start node to visited nodes (father holds start node index for the moment)
visited.insert(make_pair<CAStarNode, uint>(startNode, father));
@ -1841,7 +1841,7 @@ bool CWorldMap::findInsideAStarPath(CWorldPosition const& start, CWorldPosition
// Else create a new node
else
{
child = nodes.size();
child = (uint)nodes.size();
nodes.push_back(CInsideAStarHeapNode(next, father, dir, distance, true));
}
// Compute h(n) as an euclidian distance heuristic

View file

@ -3588,7 +3588,7 @@ CWorldPosition CWorldMap::getWorldPosition(CMapPosition const& mapPos, TLevel le
std::sort(slots.begin(), slots.end());
// get heightest slot
level = slots.size()-1 - level;
level = (RYAI_MAP_CRUNCH::TLevel)(slots.size()-1) - level;
// if slot exists, return it or invalid position
return (level < 0 && level >= (sint)slots.size()) ? CWorldPosition() : CWorldPosition(cell, mapPos, CSlot(slots[level]&3));

View file

@ -368,7 +368,7 @@ IFileAccess::TReturnCode CWriteFile::execute(CFileAccessManager& manager)
try
{
f.serialBuffer(&(Data[0]), Data.size());
f.serialBuffer(&(Data[0]), (uint)Data.size());
fileSaved = true;
if (VerboseLog)

View file

@ -568,7 +568,7 @@ static void cbAppend( CMessage& msgin, const std::string &serviceName, NLNET::TS
std::string append = inMsg.Append+'\n';
uint8* data = (uint8*)(const_cast<char*>(append.c_str()));
uint dataSize = append.size();
uint dataSize = (uint)append.size();
CWriteFile* access = new CWriteFile(inMsg.FileName, serviceId, 0, data, dataSize);
@ -822,7 +822,7 @@ void CDirectoryRateStat::display(NLMISC::CLog& log)
TDirectoryMap::iterator first = _DirectoryMap.begin(), last = _DirectoryMap.end();
for (; first != last; ++first)
if ((*first).first.size() > pathsize)
pathsize = (*first).first.size();
pathsize = (uint)(*first).first.size();
NLMISC::TTime limit = NLMISC::CTime::getLocalTime()-60*1000;

View file

@ -263,7 +263,7 @@ static void base64Decode(std::vector<uint8>& buffer, const std::string& encoded)
base64Revert[base64Table[i]] = i;
}
uint sz = encoded.size();
uint sz = (uint)encoded.size();
uint inbits = 0;
uint bitbuffer = 0;
for (i=0; i<sz; ++i)
@ -353,7 +353,7 @@ NLMISC_COMMAND (getFileBase64Content, "dump file content in Base64 encoded form"
base64Encode(buffer, encoded);
uint numcharperline = 224;
uint numlines = (encoded.size()+numcharperline-1)/numcharperline;
uint numlines = ((uint)encoded.size()+numcharperline-1)/numcharperline;
log.displayRawNL("file %s lines %d size %d haskey %s", args[0].c_str(), numlines, filesize, key.toString().c_str());
@ -385,7 +385,7 @@ NLMISC_COMMAND (putFileBase64Content, "fill file with content in Base64 encoded
std::vector<uint8> buffer;
base64Decode(buffer, encoded);
f.serialBuffer(&(buffer[0]), buffer.size());
f.serialBuffer(&(buffer[0]), (uint)buffer.size());
f.close();
return true;

View file

@ -262,7 +262,7 @@ void cbGetSaveList(CMemStream &msgin, TSockId host)
{
std::sort(incrementalDirectories.begin(), incrementalDirectories.end());
for (i=incrementalDirectories.size()-1; (sint)i>=0; --i)
for (i=(uint)incrementalDirectories.size()-1; (sint)i>=0; --i)
{
string p = CPath::standardizePath(incrementalDirectories[i], true);
// avoid double / inside path

View file

@ -375,7 +375,7 @@ CAdminCommand * findAdminCommand(const string & name)
{
H_AUTO(findAdminCommand);
const uint nbCommands = AdminCommands.size();
const uint nbCommands = (uint)AdminCommands.size();
for (uint i = 0; i < nbCommands; i++)
{
if (name == AdminCommands[i].Name)
@ -438,7 +438,7 @@ static void loadCommandsPrivileges(const string & fileName, bool init)
}
// reset privileges with default value
const uint nbCommands = AdminCommands.size();
const uint nbCommands = (uint)AdminCommands.size();
for (uint i = 0; i < nbCommands; i++)
{
AdminCommands[i].Priv = DefaultPriv;
@ -1664,7 +1664,7 @@ NLMISC_COMMAND (learnAllBricks, "Specified player learns all possible bricks for
const CStaticRolemasterPhrase *phrase = CSheets::getSRolemasterPhrase(phrases[i]);
if(phrase != NULL)
{
const uint size = phrase->Bricks.size();
const uint size = (uint)phrase->Bricks.size();
for ( uint j = 0; j < size ; ++j)
{
c->addKnownBrick( phrase->Bricks[j] );
@ -1740,7 +1740,7 @@ NLMISC_COMMAND (learnAllRolemasterBricks, "Specified player learns all possible
const CStaticRolemasterPhrase *phrase = CSheets::getSRolemasterPhrase(phrases[i]);
if(phrase != NULL)
{
const uint size = phrase->Bricks.size();
const uint size = (uint)phrase->Bricks.size();
for ( uint j = 0; j < size ; ++j)
{
c->addKnownBrick( phrase->Bricks[j] );
@ -2106,7 +2106,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,listPDRFiles,"list files in the current directory
std::vector<std::string> files;
NLMISC::CPath::getPathContent(".",false,false,true,files);
for (uint32 i=files.size();i--;)
for (uint32 i=(uint32)files.size();i--;)
{
if (!NLMISC::testWildCard(files[i],"*.xml") && !NLMISC::testWildCard(files[i],"*.pdr"))
{
@ -3429,7 +3429,7 @@ NLMISC_COMMAND( dssTarget, "target a mob and send information to dss( /b dssTarg
msgout.serial(alias); //mob targeted
msgout.serial(entityRowId); //datasetrow
uint32 args_size = args.size() - 1;
uint32 args_size = (uint32)args.size() - 1;
uint32 i = 0;
msgout.serial(args_size);
for ( ; i != args_size ; ++i)
@ -5299,7 +5299,7 @@ NLMISC_COMMAND(eventNpcGroupScript, "executes a script on an event npc group", "
uint32 instanceNumber = e->getInstanceNumber();
uint32 nbString = args.size();
uint32 nbString = (uint32)args.size();
CMessage msgout("EVENT_NPC_GROUP_SCRIPT");
uint32 messageVersion = 1;
@ -5361,7 +5361,7 @@ NLMISC_COMMAND(eventSetNpcGroupAggroRange, "changes the aggro range of a npc gro
args2.push_back(args[0]);
args2.push_back(NLMISC::toString("()setAggro(%f, 0);", atof(args[1].c_str())));
uint32 nbString = args2.size();
uint32 nbString = (uint32)args2.size();
CMessage msgout("EVENT_NPC_GROUP_SCRIPT");
uint32 messageVersion = 1;

View file

@ -393,7 +393,7 @@ void CBuildingManager::addTriggerRequest( const TDataSetRow & rowId, sint32 trig
request.Session = 0;
CTriggerRequestEntry entry;
const uint destCount = trigger.Destinations.size();
const uint destCount = (uint)trigger.Destinations.size();
for ( uint i = 0; i < destCount; i++ )
{
entry.Destination = trigger.Destinations[i];
@ -477,7 +477,7 @@ void CBuildingManager::fillTriggerPage(const NLMISC::CEntityId & eId, uint16 cli
uint end = start + MaxEntryPerLiftPage;
if ( end >= request.Entries.size() )
{
end = request.Entries.size();
end = (uint)request.Entries.size();
// user->_PropertyDatabase.setProp( "ASCENSOR:HAS_NEXT",0 );
CBankAccessor_PLR::getASCENSOR().setHAS_NEXT(user->_PropertyDatabase, false);
}
@ -723,7 +723,7 @@ void CBuildingManager::triggerTeleport(CCharacter * user, uint16 index)
// check if sessions mactch between user and system
uint16 session = 0;
const uint16 destCount = (*it).second.Entries.size();
const uint16 destCount = (uint16)(*it).second.Entries.size();
IDestination * currentDest = NULL;
for ( uint i = 0; i < destCount; i++ )
{

View file

@ -357,7 +357,7 @@ bool CBuildingPhysicalGuild::isUserAllowed(CCharacter * user, uint16 ownerId, ui
//----------------------------------------------------------------------------
uint16 CBuildingPhysicalGuild::getOwnerCount()
{
return _Guilds.size();
return (uint16)_Guilds.size();
}
//----------------------------------------------------------------------------
@ -523,7 +523,7 @@ bool CBuildingPhysicalPlayer::isUserAllowed(CCharacter * user, uint16 ownerId, u
//----------------------------------------------------------------------------
uint16 CBuildingPhysicalPlayer::getOwnerCount()
{
return _Players.size();
return (uint16)_Players.size();
}
//----------------------------------------------------------------------------

View file

@ -116,7 +116,7 @@ void CBuildingPhysicalGuild::addGuild( uint32 guildId )
_StateCounter++;
_Guilds.push_back( guildId );
// add an instance cell to each room for this guild
const uint size = _Rooms.size();
const uint size = (uint)_Rooms.size();
for ( uint i = 0; i < size; i++ )
{
_Rooms[i].Cells.push_back( 0 );
@ -175,7 +175,7 @@ inline void CBuildingPhysicalPlayer::addPlayer( const NLMISC::CEntityId & userId
_StateCounter++;
_Players.push_back( userId );
// add an instance cell to each room for this player
const uint size = _Rooms.size();
const uint size = (uint)_Rooms.size();
for ( uint i = 0; i < size; i++ )
{
_Rooms[i].Cells.push_back( 0 );

View file

@ -151,7 +151,7 @@ void CBuildingTest::timerCallback(CTimer * timer)
nlinfo("*** BuildingUnitTest *** callback count %u", _Count);
}
const uint randomNumber = (uint) RandomGenerator.rand( TestCharacters.size()-1 );
const uint randomNumber = (uint) RandomGenerator.rand( (uint16)TestCharacters.size()-1 );
for (uint i = 0; i < _Simultaneous; i++)
{
checkIntegrity();
@ -172,7 +172,7 @@ IDestination * CBuildingTest::getRandomDestination()
IDestination * dest = NULL;
do
{
sint32 randomNumber = RandomGenerator.rand( bm->_Triggers.size()-1 );
sint32 randomNumber = RandomGenerator.rand( (uint16)bm->_Triggers.size()-1 );
CHashMap<sint,CBuildingManager::CTrigger>::iterator itTrigger = bm->_Triggers.begin();
for (sint32 i = 0; i < randomNumber; i++)
{
@ -189,7 +189,7 @@ IDestination * CBuildingTest::getRandomDestination()
continue;
}
randomNumber = RandomGenerator.rand( trigger.Destinations.size()-1 );
randomNumber = RandomGenerator.rand( (uint16)trigger.Destinations.size()-1 );
dest = trigger.Destinations[randomNumber];
} while ( !dest );
@ -419,7 +419,7 @@ bool CBuildingTest::changeRoom(uint charIndex)
{
nlassert(++nbLoops <= maxLoops);
newRoomIndex = (uint16) RandomGenerator.rand( rooms.size()-1 );
newRoomIndex = (uint16) RandomGenerator.rand( (uint16)rooms.size()-1 );
if (newRoomIndex >= rooms.size())
newRoomIndex = 0;
@ -656,7 +656,7 @@ NLMISC_COMMAND (testBuildingManager, "(debug) Unit test for building manager",
if (FakeCharacters.size() < nbChars)
{
for (uint i = FakeCharacters.size(); i < nbChars; i++)
for (uint i = (uint)FakeCharacters.size(); i < nbChars; i++)
{
CEntityId id = createFakeCharacter( firstPlayerId+i, toString("fake%u", i), EGSPD::CPeople::Fyros, GSGENDER::female );
if (id == CEntityId::Unknown)

View file

@ -184,7 +184,7 @@ bool IRoomInstance::create( IBuildingPhysical * building, uint16 roomIdx,uint16
// spawn the bots
const CRoomTemplate & templ = building->getTemplate()->Rooms[roomIdx];
const uint size = templ.Bots.size();
const uint size = (uint)templ.Bots.size();
_Bots.reserve( size );
for ( uint i = 0; i < size; i++ )
{

View file

@ -1414,7 +1414,7 @@ void CCreature::setBotDescription( const CGenNpcDescMsgImp& description )
else if ( NLMISC::strlwr(result[0]) == "altar" )
{
// nlinfo("OPString: %s", optionalPropertiesString.c_str());
uint32 nbAltarParams = result.size();
uint32 nbAltarParams = (uint32)result.size();
for( uint32 i = 1; i < nbAltarParams; ++i )
{
// nlinfo("OPSResult: %s", result[i].c_str());
@ -1619,7 +1619,7 @@ CGameItemPtr CCreature::getNpcItem( const NLMISC::CSheetId &sheet, uint16 qualit
{
const std::vector< CGameItemPtr > & item = CStaticItems::getStaticItems();
const uint nbItems = item.size();
const uint nbItems = (uint)item.size();
for (uint i = 0 ; i < nbItems ; ++i)
{
if ( item[i] != NULL && item[i]->getSheetId() == sheet && item[i]->quality() == quality )
@ -1633,7 +1633,7 @@ CGameItemPtr CCreature::getNpcItem( const NLMISC::CSheetId &sheet, uint16 qualit
{
const std::vector< CGameItemPtr > & items = CGameItemManager::getNpcSpecificItems();
const uint nbItems = items.size();
const uint nbItems = (uint)items.size();
for (uint i = 0 ; i < nbItems ; ++i)
{
if ( items[i] != NULL && items[i]->getSheetId() == sheet )
@ -2223,7 +2223,7 @@ void CCreature::displayShopSelectors( NLMISC::CLog& log )
//------------------------------------------------------------------------------
bool CCreature::checkFactionAttackable(const CEntityId &playerId) const
{
const uint size = _FactionAttackableAbove.size();
const uint size = (uint)_FactionAttackableAbove.size();
for (uint i = 0 ; i < size ; ++i)
{
// if player has one of specified fame above 0 he can attack this creature
@ -2232,7 +2232,7 @@ bool CCreature::checkFactionAttackable(const CEntityId &playerId) const
return true;
}
const uint size2 = _FactionAttackableBelow.size();
const uint size2 = (uint)_FactionAttackableBelow.size();
for (uint i = 0 ; i < size2 ; ++i)
{
// if player has one of specified fame above 0 he can attack this creature

View file

@ -202,12 +202,12 @@ void CChangeCreatureHPImp::callback(const string &, NLNET::TServiceId sid)
{
H_AUTO(CChangeCreatureHPImp);
uint16 size = Entities.size();
uint16 size = (uint16)Entities.size();
if (Entities.size() != DeltaHp.size() )
{
nlwarning("Entities.size() != DeltaHp.size()");
size = min(Entities.size(),DeltaHp.size());
size = (uint16)min(Entities.size(),DeltaHp.size());
}
// for each creature, change HP

View file

@ -119,7 +119,7 @@ public:
~CCreatureManager();
/// Get Number of creaturein manager
uint32 getNumberCreature() { return _Creatures.size(); }
uint32 getNumberCreature() { return (uint32)_Creatures.size(); }
/// Get a reference on creature in manager
const TMapCreatures& getCreature() { return _Creatures; }

View file

@ -125,7 +125,7 @@ bool CHarvestable::writeMpInfos()
invTemp->enterMode(TEMP_INV_MODE::Quarter);
uint validMps = 0;
uint nbMp = _Mps.size();
uint nbMp = (uint)_Mps.size();
// Count number of valid mps
if (nbMp > INVENTORIES::NbTempInvSlots)
@ -241,7 +241,7 @@ void CHarvestable::setMps( const vector<CStaticCreatureRawMaterial>& mps )
TRMQuantityVariable quantityVariable = (TRMQuantityVariable)mps[rmIndices[RMUTotalQuantity][0]].quantityVariable();
const float totalQuarteringQuantityAverage = *QuarteringQuantityByVariable[quantityVariable]; // if a creature is in RMTotalQuantity mode, all the RMs have the same quantityVariable() shared for all
const uint MinFilledSlots = 1;
uint rndNbSlotsToFill = MinFilledSlots + RandomGenerator.rand( rmIndices[RMUTotalQuantity].size() - MinFilledSlots );
uint rndNbSlotsToFill = MinFilledSlots + RandomGenerator.rand( (uint16)rmIndices[RMUTotalQuantity].size() - MinFilledSlots );
float quantityAveragePerFilledSlot = totalQuarteringQuantityAverage / ((float)rndNbSlotsToFill);
bool limitTo10PctFromAverage = ((quantityVariable >= RMQVBossBegin) && (quantityVariable <= RMQVBossEnd));
uint intQuantityAveragePerFilledSlot = (uint)quantityAveragePerFilledSlot;
@ -251,7 +251,7 @@ void CHarvestable::setMps( const vector<CStaticCreatureRawMaterial>& mps )
for ( uint i=0; i!=rndNbSlotsToFill; ++i )
{
// Select a random slot
uint iLastSlotIndex = rmIndices[RMUTotalQuantity].size() - 1;
uint iLastSlotIndex = (uint)rmIndices[RMUTotalQuantity].size() - 1;
uint iSlotIndex = RandomGenerator.rand( iLastSlotIndex ); // index in rmIndices[RMUCraft]
uint iSlot = rmIndices[RMUTotalQuantity][iSlotIndex]; // index in mps

View file

@ -101,7 +101,7 @@ public:
{
if(!_Content)
return 0;
return _Content->SoldItems.size();
return (uint)_Content->SoldItems.size();
}
void getSoldItem(uint idx,NLMISC::CSheetId & sheet, uint16 & level, float & factor)

View file

@ -237,7 +237,7 @@ public:
const std::string& name() const { return _Name; }
/// Return the number of MPS in the deposit
uint getContentSize() const { return _RawMaterials.size(); }
uint getContentSize() const { return (uint)_RawMaterials.size(); }
/// Return the MPS
const std::vector<CStaticDepositRawMaterial>& getContents() const { return _RawMaterials; }

View file

@ -130,7 +130,7 @@ void CStaticBrick::serial(class NLMISC::IStream &f)
// Params
Params.clear();
size = StringParams.size();
size = (uint16)StringParams.size();
for (uint i = 0 ; i < size ; ++i)
{
addParam(StringParams[i], Params);
@ -232,7 +232,7 @@ void CStaticBrick::serial(class NLMISC::IStream &f)
// mandatory
set<BRICK_FAMILIES::TBrickFamily>::const_iterator it = MandatoryFamilies.begin();
set<BRICK_FAMILIES::TBrickFamily>::const_iterator itEnd = MandatoryFamilies.end();
uint16 size = MandatoryFamilies.size();
uint16 size = (uint16)MandatoryFamilies.size();
f.serial(size);
for ( ; it != itEnd ; ++it)
{
@ -243,7 +243,7 @@ void CStaticBrick::serial(class NLMISC::IStream &f)
// optional
it = OptionalFamilies.begin();
itEnd = OptionalFamilies.end();
size = OptionalFamilies.size();
size = (uint16)OptionalFamilies.size();
f.serial(size);
for ( ; it != itEnd ; ++it)
@ -255,7 +255,7 @@ void CStaticBrick::serial(class NLMISC::IStream &f)
// credit
it = CreditFamilies.begin();
itEnd = CreditFamilies.end();
size = CreditFamilies.size();
size = (uint16)CreditFamilies.size();
f.serial(size);
for ( ; it != itEnd ; ++it)
@ -271,7 +271,7 @@ void CStaticBrick::serial(class NLMISC::IStream &f)
}
// skills
size = Skills.size();
size = (uint16)Skills.size();
f.serial(size);
for (uint i = 0 ; i < size ; ++i )
{
@ -490,7 +490,7 @@ void CStaticBrick::readStaticBrick( const NLGEORGES::UFormElm &root, const NLMIS
}
// Parse Params
Params.clear();
const uint size = StringParams.size();
const uint size = (uint)StringParams.size();
for (uint i = 0 ; i < size ; ++i)
{
addParam(StringParams[i], Params);

View file

@ -247,14 +247,14 @@ public:
}
else
{
uint8 size = NeededMps.size();
uint8 size = (uint8)NeededMps.size();
f.serial(size);
for (uint8 i = 0; i < size ; ++i)
{
f.serial( NeededMps[i] );
}
size = NeededMpsFormula.size();
size = (uint8)NeededMpsFormula.size();
f.serial(size);
for (uint8 i = 0; i < size ; ++i)
{

View file

@ -51,7 +51,7 @@ public:
{
std::map<std::string, size_t>::const_iterator it = _AnimIdMap.find(animId);
if (it!=_AnimIdMap.end())
return it->second;
return (uint16)it->second;
return (uint16)~0;
}

View file

@ -229,7 +229,7 @@ const CStaticEncycloThema * CStaticEncyclo::getThemaForm( const NLMISC::CSheetId
uint32 CStaticEncyclo::getNbAlbum () const
{
return _OrderedAlbums.size();
return (uint32)_OrderedAlbums.size();
}
///////////////////////////////////////////////////////////////////////////////////////////
@ -245,7 +245,7 @@ const CStaticEncycloAlbum * CStaticEncyclo::getAlbum ( uint32 nAlbumNb ) const
uint32 CStaticEncyclo::getNbThema ( uint32 nAlbumNb ) const
{
nlassert(nAlbumNb < _OrderedAlbums.size());
return _OrderedAlbums[nAlbumNb].ThemaSheets.size();
return (uint32)_OrderedAlbums[nAlbumNb].ThemaSheets.size();
}
///////////////////////////////////////////////////////////////////////////////////////////
@ -318,7 +318,7 @@ void CStaticEncyclo::getRiteInfos( string& rite, uint32& nAlbum, uint32& nThema,
if( rite == (*itTh).second.Rite )
{
nThema = (*itTh).second.ThemaNumber;
taskCount = (*itTh).second.Tasks.size();
taskCount = (uint32)(*itTh).second.Tasks.size();
themaSheet = (*itTh).first;
break;
}

View file

@ -124,7 +124,7 @@ void CConsumable::serial(class NLMISC::IStream &f)
f.serial(familyName);
if (FamiliesFromName.find(familyName) == FamiliesFromName.end())
{
Family = FamiliesFromIndex.size();
Family = (uint16)FamiliesFromIndex.size();
FamiliesFromName.insert( make_pair(familyName, Family) );
FamiliesFromIndex.push_back(familyName);
}
@ -135,7 +135,7 @@ void CConsumable::serial(class NLMISC::IStream &f)
// Params
Params.clear();
uint size = StringParams.size();
uint size = (uint)StringParams.size();
for (uint i = 0 ; i < size ; ++i)
{
addParam(StringParams[i], Params);
@ -981,7 +981,7 @@ void loadCosmetics( NLGEORGES::UFormElm &root, CStaticItem *item, const NLMISC:
nlwarning("<loadCosmetics> Can't load the VPValue from sheet name in sheet %s", sheetId.toString().c_str() );
else
{
sint i = pos - 1;
sint i = (sint)pos - 1;
for(; i >= 0; i-- )
{
if ( !isdigit( name[i] ) )
@ -1059,7 +1059,7 @@ void loadConsumable( NLGEORGES::UFormElm &root, CStaticItem *item, const NLMISC
if (CConsumable::FamiliesFromName.find(familyName) == CConsumable::FamiliesFromName.end())
{
const uint16 index = CConsumable::FamiliesFromIndex.size();
const uint16 index = (uint16)CConsumable::FamiliesFromIndex.size();
CConsumable::FamiliesFromName.insert( make_pair(familyName, index) );
CConsumable::FamiliesFromIndex.push_back(familyName);
item->ConsumableItem->Family= index;
@ -1120,7 +1120,7 @@ void loadConsumable( NLGEORGES::UFormElm &root, CStaticItem *item, const NLMISC
}
// Parse Params
item->ConsumableItem->Params.clear();
const uint size = item->ConsumableItem->StringParams.size();
const uint size = (uint)item->ConsumableItem->StringParams.size();
for (uint i = 0 ; i < size ; ++i)
{
addParam(item->ConsumableItem->StringParams[i], item->ConsumableItem->Params);

View file

@ -680,7 +680,7 @@ public:
f.serial( (uint32&)getGroup() ); // The number never changes
// Parameters
uint8 size = MpFaberParameters.size();
uint8 size = (uint8)MpFaberParameters.size();
f.serial( size );
for( uint i = 0; i < size; ++i )
{
@ -695,7 +695,7 @@ public:
const RM_GROUP::TRMGroup& getGroup() const { return _RMGroupsByFamily[Family]; }
/// Return the number of raw material group slots. The actual number of groups is the number of non-empty slots.
static uint nbRmGroupSlots() { return _RMGroupNames.size(); }
static uint nbRmGroupSlots() { return (uint)_RMGroupNames.size(); }
/// Return the name of a raw material group. Precondition: group < nbRmGroupSlots()
static const std::string& rmGroupToString( const RM_GROUP::TRMGroup& group ) { return _RMGroupNames[group]; }

View file

@ -536,7 +536,7 @@ public:
virtual float getRegen(size_t index) const { return _Regen[index]; }
virtual SMirrorEquipment const& getItems(size_t index) const { return _Items[index]; }
virtual std::string getLootTable(uint i) const { if (i<_LootTables.size()) return _LootTables[i]; else return ""; }
virtual uint getLootTableCount() const { return _LootTables.size(); }
virtual uint getLootTableCount() const { return (uint)_LootTables.size(); }
virtual uint8 getMeleeReachValue() const { return _MeleeReachValue; }
virtual bool getDodgeAsDefense() const { return _DodgeAsDefense; }
@ -1145,7 +1145,7 @@ public :
}
else
{
uint16 size = ChildSkills.size();
uint16 size = (uint16)ChildSkills.size();
f.serial( size );
for( std::vector<SKILLS::ESkills>::iterator it = ChildSkills.begin(); it != ChildSkills.end(); ++it )
{

View file

@ -116,7 +116,7 @@ public:
{
std::map<std::string, size_t>::const_iterator it = _EmoteIdMap.find(emoteId);
if (it!=_EmoteIdMap.end())
return it->second;
return (uint16)it->second;
return (uint16)~0;
}
MBEHAV::EBehaviour getEmoteBehav(const std::string& emoteId) const;

View file

@ -1624,7 +1624,7 @@ NLMISC_COMMAND(loadAndReSaveCharacters,"load and resave the complete set of play
playerIds.insert( account );
}
uint32 size= playerIds.size();
uint32 size= (uint32)playerIds.size();
uint32 i = 0;
for( set<uint32>::iterator it=playerIds.begin(); it != playerIds.end(); ++i, ++it )
{
@ -1697,7 +1697,7 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam
}
// iterate over files
uint32 numFiles= files.size();
uint32 numFiles= (uint32)files.size();
uint32 i=0;
for (TFilesMap::iterator it=files.begin(); it!=files.end(); ++it, ++i)
{
@ -4879,8 +4879,8 @@ NLMISC_COMMAND(displayBricksInDb,"display the bricks in DB for given player","<p
set<CSheetId>::const_iterator it2 = bricksKnown.begin();
set<CSheetId>::const_iterator it2End = bricksKnown.end();
uint16 size1 = bricksInDb.size();
uint16 size2 = bricksKnown.size();
uint16 size1 = (uint16)bricksInDb.size();
uint16 size2 = (uint16)bricksKnown.size();
bool ok = true;
@ -5612,7 +5612,7 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","<FileName>")
string script;
script.resize(iFile.getFileSize());
iFile.serialBuffer((uint8 *)&script[0], script.size());
iFile.serialBuffer((uint8 *)&script[0], (uint)script.size());
vector<string> scriptLines;

View file

@ -2358,7 +2358,7 @@ bool CEntityBase::canEntityDefend()
return false;
const uint8 size = sizeof(ForbidDefenseEffects) / sizeof(EFFECT_FAMILIES::TEffectFamily);
const uint8 nbEffects = _SEffects.size();
const uint8 nbEffects = (uint8)_SEffects.size();
// look for forbidden effects
for (uint i = 0; i < nbEffects; ++i )

View file

@ -791,7 +791,7 @@ public:
virtual void stopAllLinks(float factorOnSurvivalTime = 1.0f);
/// get current number of links cast by this entity
inline uint8 getNbLinks() const { return _SEffectLinks.size(); }
inline uint8 getNbLinks() const { return (uint8)_SEffectLinks.size(); }
/**
* look for a particular effect.

View file

@ -1242,7 +1242,7 @@ void sendCharactersSummary( CPlayer *player, bool AllAutorized, uint32 bitfieldO
player->getCharactersSummary( chars );
if (bitfieldOwnerOfActiveAnimSession != 0)
{
for ( uint i=0, len=chars.size(); i!=len; ++i )
for ( uint i=0, len=(uint)chars.size(); i!=len; ++i )
{
chars[i].InRingSession = ((bitfieldOwnerOfActiveAnimSession & (1 << i)) != 0);
}
@ -1250,7 +1250,7 @@ void sendCharactersSummary( CPlayer *player, bool AllAutorized, uint32 bitfieldO
if (bitfieldOwnerOfEditSession != 0)
{
for ( uint i=0, len=chars.size(); i!=len; ++i )
for ( uint i=0, len=(uint)chars.size(); i!=len; ++i )
{
chars[i].HasEditSession = ((bitfieldOwnerOfEditSession & (1 << i)) != 0);
}

View file

@ -358,7 +358,7 @@ double CSkills::getMaxXPToGain(SKILLS::ESkills &skill)
static CSheetId sheet("skills.skill_tree");
const CStaticSkillsTree * skillsTree = CSheets::getSkillsTreeForm( sheet );
nlassert( skillsTree );
const uint size = _Skills.size();
const uint size = (uint)_Skills.size();
double xp = 0.0f;
for ( uint i = 0; i < size; ++i )

View file

@ -44,7 +44,7 @@ public:
bool empty() const { return _Vec.empty(); }
/// Return the number of elements in the stack
uint size() const { return _Vec.size(); }
uint size() const { return (uint)_Vec.size(); }
/// Return the latest pushed position (no bound check)
const T& top() const { return _Vec.back(); }

View file

@ -988,7 +988,7 @@ inline CGameItemVector::~CGameItemVector()
inline uint32 CGameItemVector::size() const
{
return _Data.size()<<LOG_QUANTUM;
return (uint32)_Data.size()<<LOG_QUANTUM;
}
inline CGameItem& CGameItemVector::operator[](uint32 idx)
@ -1009,7 +1009,7 @@ inline uint32 CGameItemVector::getUniqueIndex(const CGameItem& item)
{
for (uint32 i=0;i<_Data.size();++i)
{
uint32 lowidx= &item-_Data[i];
uint32 lowidx= (uint32)(&item-_Data[i]);
if (lowidx<QUANTUM)
{
uint32 idx= lowidx+(i<<LOG_QUANTUM);

View file

@ -1420,7 +1420,7 @@ void CGuild::addOwnedOutpost(TAIAlias outpostAlias)
// update all outposts following the new one (included)
// it will shift right
uint i = _OwnedOutposts.size() - 1;
uint i = (uint)_OwnedOutposts.size() - 1;
while (i < _OwnedOutposts.size() + _ChallengedOutposts.size())
{
if (!updateOutpostDB(i))
@ -1511,7 +1511,7 @@ void CGuild::addChallengedOutpost(TAIAlias outpostAlias)
nlassert(getOutpostCount() < OUTPOSTENUMS::MAX_OUTPOST);
_ChallengedOutposts.push_back(outpostAlias);
updateOutpostDB( _OwnedOutposts.size()+_ChallengedOutposts.size()-1 );
updateOutpostDB( (uint32)(_OwnedOutposts.size()+_ChallengedOutposts.size()-1) );
updateGUILD_OUTPOST_CANDEL();
}
@ -1536,7 +1536,7 @@ void CGuild::removeChallengedOutpost(TAIAlias outpostAlias)
// update all outposts following the removed one
// it will shift left
i += _OwnedOutposts.size();
i += (uint)_OwnedOutposts.size();
while (i < _OwnedOutposts.size() + _ChallengedOutposts.size())
{
if (!updateOutpostDB(i))
@ -1557,7 +1557,7 @@ void CGuild::removeChallengedOutpost(TAIAlias outpostAlias)
//-----------------------------------------------------------------------------
uint32 CGuild::getOutpostCount() const
{
return (_OwnedOutposts.size() + _ChallengedOutposts.size());
return (uint32)(_OwnedOutposts.size() + _ChallengedOutposts.size());
}
//-----------------------------------------------------------------------------
@ -1650,7 +1650,7 @@ bool CGuild::getOutpostDBIndex(TAIAlias outpostAlias, uint32 & outpostIndex, boo
{
if (_ChallengedOutposts[i] == outpostAlias)
{
outpostIndex = _OwnedOutposts.size() + i;
outpostIndex = (uint32)_OwnedOutposts.size() + i;
ownedOutpost = false;
return true;
}
@ -1673,7 +1673,7 @@ bool CGuild::updateOutpostDB(uint32 outpostIndex)
}
else
{
i -= _OwnedOutposts.size();
i -= (uint32)_OwnedOutposts.size();
if (i < _ChallengedOutposts.size())
{
outpostAlias = _ChallengedOutposts[i];

View file

@ -128,7 +128,7 @@ void CGuildCharProxy::updateTarget()
//----------------------------------------------------------------------------
uint16 CGuildCharProxy::getMainPlace()
{
uint size = _ModuleCore->getPlaces().size();
uint size = (uint)_ModuleCore->getPlaces().size();
for ( uint i = 0; i < size; i++ )
{
const CPlace * place = CZoneManager::getInstance().getPlaceFromId( _ModuleCore->getPlaces()[i] );

View file

@ -481,7 +481,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", "<filena
}
// ok, the file is available.
const uint len = strlen("guild_XXXXX.ext");
const uint len = (uint)strlen("guild_XXXXX.ext");
string file = CFile::getFilename(args[0]);
CGuild *guild = NULL;

View file

@ -350,7 +350,7 @@ void CGuildManager::saveGuild( CGuild* guild )
}
// serial it to file
CBackupMsgSaveFile msg( fileName, CBackupMsgSaveFile::SaveFile, Bsi );
msg.DataMsg.serialBuffer((uint8*)&buffer.front(), buffer.size());
msg.DataMsg.serialBuffer((uint8*)&buffer.front(), (uint)buffer.size());
Bsi.sendFile( msg );
}
catch( Exception& )
@ -636,7 +636,7 @@ void CGuildManager::playerConnection( CGuildCharProxy & proxy )
void CGuildManager::removeInvitation(CGuildInvitation* invitation)
{
nlassert(invitation);
const uint size = _Invitations.size();
const uint size = (uint)_Invitations.size();
for ( uint i = 0; i < size; ++i )
{
if ( _Invitations[i] == invitation )
@ -1126,7 +1126,7 @@ void CGuildManager::loadGuild(const std::string &fileName)
//----------------------------------------------------------------------------
void CGuildManager::callback(const CFileDescription& fileDescription, NLMISC::IStream& dataStream)
{
const uint len = strlen("guild_XXXXX.ext");
const uint len = (uint)strlen("guild_XXXXX.ext");
string file = CFile::getFilename(fileDescription.FileName);
@ -1529,7 +1529,7 @@ bool CGuildManager::checkGuildStrings(CGuildCharProxy & proxy,const ucstring & n
}
/// check if name and description are ethically acceptable
const uint size = CEntityIdTranslator::getInstance()->getInvalidNames().size();
const uint size = (uint)CEntityIdTranslator::getInstance()->getInvalidNames().size();
string nameStr = CEntityIdTranslator::getInstance()->getRegisterableString( name );
string descriptionStr = CEntityIdTranslator::getInstance()->getRegisterableString( description );
for (uint i = 0; i < CEntityIdTranslator::getInstance()->getInvalidNames().size(); i++)

View file

@ -285,7 +285,7 @@ void CInventoryUpdater<CInventoryCategoryTemplate>::resetItem( TInventoryId inv
if ( itemUpdate.IUMode != CItemUpdate::IUAll )
{
// Cancel any additional IUOneProp updates
cancelAllUpdatesFromIndex( itu - _ItemUpdates[invId].begin() + 1, invId, slotIndex );
cancelAllUpdatesFromIndex( (uint)(itu - _ItemUpdates[invId].begin() + 1), invId, slotIndex );
}
// Overwrite any previous IUAll, IUReset, IUOneProp, IUInfoVersion
itemUpdate.IUMode = CItemUpdate::IUReset;
@ -328,7 +328,7 @@ void CInventoryUpdater<CInventoryCategoryTemplate>::setItemProps( TInventoryId
if ( itemUpdate.IUMode != CItemUpdate::IUAll )
{
// Cancel any additional IUOneProp updates
cancelAllUpdatesFromIndexExcept( itu - _ItemUpdates[invId].begin() + 1, invId, itemSlot.getSlotIndex(), CItemUpdate::IUInfoVersion );
cancelAllUpdatesFromIndexExcept( (uint)(itu - _ItemUpdates[invId].begin() + 1), invId, itemSlot.getSlotIndex(), CItemUpdate::IUInfoVersion );
}
// Overwrite previous IUAll, IUReset, or first IUOneProp
itemUpdate.IUMode = CItemUpdate::IUAll;
@ -488,7 +488,7 @@ bool CInventoryUpdater<CInventoryCategoryTemplate>::fillAllUpdates( NLMISC::CBi
hasContentToSend = true;
// Number field
uint32 nbChanges = _ItemUpdates[invId].size();
uint32 nbChanges = (uint32)_ItemUpdates[invId].size();
if ( nbChanges < INVENTORIES::LowNumberBound )
{
destStream.serial( nbChanges, INVENTORIES::LowNumberBits );

View file

@ -1647,7 +1647,7 @@ class CMissionActionRecvMoney : public IMissionAction
std::vector<TDataSetRow> entities;
instance->getEntities(entities);
uint amount = _Amount / entities.size();
uint amount = _Amount / (uint)entities.size();
if ( amount == 0 || _Amount % entities.size() )
amount++;
for ( uint i = 0; i < entities.size(); i++ )

View file

@ -715,7 +715,7 @@ void CMissionBaseBehaviour::jump( uint32 step, uint32 action,std::list< CMission
// if they are actions in this out of order bloc, we launch them
if( oooIndex < templ->OOOActions.size() )
{
action -= templ->Steps[step]->getActions().size();
action -= (uint32)templ->Steps[step]->getActions().size();
for ( uint i = action; i < templ->OOOActions[oooIndex].size(); i++ )
{
templ->OOOActions[oooIndex][i]->launch(_Mission,eventList);
@ -1149,7 +1149,7 @@ void CMissionBaseBehaviour::_updateUserJournalEntry( CCharacter & user, DBType &
else if ( templ->getOutOfOrderSteps((*it).first - 1) == 0xFFFFFFFF )
{
uint firstOOOStepIndex = ~0;
const uint size = templ->OutOfOrderSteps.size();
const uint size = (uint)templ->OutOfOrderSteps.size();
for ( uint i = 0; i < size; i++ )
{
if ( templ->OutOfOrderSteps[i].first <= (*it).first - 1 && (*it).first - 1 <= templ->OutOfOrderSteps[i].second )

View file

@ -513,7 +513,7 @@ void CMissionManager::tickUpdate()
for ( map< CMission*, std::vector<CPlaceChecker> >::iterator it = _PlaceDependantMissions.begin(); it != _PlaceDependantMissions.end();)
{
uint i = 0;
uint size = (*it).second.size();
uint size = (uint)(*it).second.size();
map< CMission*, std::vector<CPlaceChecker> >::iterator itBack= it;
++itBack;
for ( ; i < size; i++ )
@ -1125,7 +1125,7 @@ void CMissionManager::addDynChat( CMission * instance, CMissionStepDynChat * ste
return;
}
const uint size = room->getBots().size();
const uint size = (uint)room->getBots().size();
for ( uint i = 0; i < size; i++ )
{
CCreature * c = CreatureManager.getCreature( room->getBots()[i] );
@ -1184,7 +1184,7 @@ void CMissionManager::addDynChat( CMission * instance, CMissionStepDynChat * ste
// For each concern mission, send an end dyn chat event to the player, specifying the mission
CMissionEventEndDynChat event;
const uint eventCount = aliases.size();
const uint eventCount = (uint)aliases.size();
for ( uint i = 0; i < eventCount; ++i )
{
user->processMissionEvent(event,aliases[i]);
@ -1338,7 +1338,7 @@ void CMissionManager::removeAllUserDynChat(CCharacter * user)
// This must be after _DynChats.erase(user->getEntityRowId()), otherwise the event (e.g. jump
// back) can trigger a openDynChat() on the same bot that would lead to a reentrance bug.
CMissionEventEndDynChat event;
const uint eventCount = aliases.size();
const uint eventCount = (uint)aliases.size();
for ( uint i = 0; i < eventCount; ++i )
user->processMissionEvent(event,aliases[i] );
}
@ -1431,7 +1431,7 @@ void CMissionManager::dynChatChoice( CCharacter * user, const TDataSetRow & botR
}
const std::string & jump = dynChat->Answers[choice].Jump;
uint i = 0;
uint nbJumpPoints = templ->JumpPoints.size();
uint nbJumpPoints = (uint)templ->JumpPoints.size();
bool updateJournal = false;
for (; i < nbJumpPoints; i++ )
{
@ -1841,7 +1841,7 @@ void CMissionManager::checkPlaceConstraints ( CMission* mission)
/// check outside constraints
for ( map<TAIAlias, EGSPD::CMissionOutsidePlacePD>::iterator it = mission->getOutsidePlacesBegin(); it != mission->getOutsidePlacesEnd(); ++it )
{
const uint size = user->getPlaces().size();
const uint size = (uint)user->getPlaces().size();
for ( uint i = 0; i < size; i++ )
{
if ( (*it).second.getAlias() == user->getPlaces()[i] )
@ -1873,7 +1873,7 @@ void CMissionManager::checkPlaceConstraints ( CMission* mission)
map<TAIAlias, EGSPD::CMissionInsidePlacePD>::iterator itIn = mission->getInsidePlacesBegin();
for (; itIn != mission->getInsidePlacesEnd(); ++itIn )
{
const uint size = user->getPlaces().size();
const uint size = (uint)user->getPlaces().size();
uint i = 0;
for (; i < size; i++ )
{
@ -2078,7 +2078,7 @@ void CMissionManager::applyAICrashConsequences( NLNET::TServiceId aiServiceId )
string name;
if (CWorldInstances::instance().getAIInstanceNameFromeServiceId(aiServiceId,name))
{
const uint size = _CrashHandlingMissions.size();
const uint size = (uint)_CrashHandlingMissions.size();
for ( uint i = 0; i < size; i++ )
{
if ( _CrashHandlingMissions[i] )

View file

@ -328,8 +328,8 @@ void CMissionParser::tokenizeString(const std::string &str, const std::string &s
retList.clear();
if ( str.empty() )
return;
uint pos=0;
uint newPos=0;
std::string::size_type pos=0;
std::string::size_type newPos=0;
while( (newPos= str.find_first_of(separators,pos)) != string::npos)
{
// if not empty sub str. (skip repetition of separator )

View file

@ -480,7 +480,7 @@ void CMissionQueue::addPlayer( const NLMISC::CEntityId &id, CMission *mission, b
if (!forceTopOfQueue)
{
entity.Position = _Entities.size();
entity.Position = (uint16)_Entities.size();
entity.PositionOnline = nbOnline;
_Entities.push_back(entity);

View file

@ -78,7 +78,7 @@ void CMissionQueueManager::characterLoadedCallback(CCharacter *c)
for ( uint i = 0 ; i < queues.QueueIds.size() ; )
{
// check coherency with infos kept in manager
const uint size2 = playerQueues.size();
const uint size2 = (uint)playerQueues.size();
uint j;
for ( j = 0 ; j < size2 ; ++j)
{
@ -154,7 +154,7 @@ void CMissionQueueManager::saveToFile()
{
std::string s;
pdr.toString(s);
msg.DataMsg.serialBuffer((uint8*)&s[0], s.size());
msg.DataMsg.serialBuffer((uint8*)&s[0], (uint)s.size());
}
Bsi.sendFile( msg );
}

View file

@ -48,7 +48,7 @@ public:
#ifdef NL_DEBUG
nlassert(find(id) == true);
#endif
const uint size = QueueIds.size();
const uint size = (uint)QueueIds.size();
for ( uint i = 0 ; i < size ; ++i )
{
if (QueueIds[i] == id)
@ -62,7 +62,7 @@ public:
bool find(uint32 id) const
{
const uint size = QueueIds.size();
const uint size = (uint)QueueIds.size();
for ( uint i = 0 ; i < size ; ++i )
{
if (QueueIds[i] == id)

View file

@ -995,7 +995,7 @@ void CMissionStepVisit::getTextParams( uint & nbSubSteps,const std::string* & te
static std::vector<std::string> wornTexts;
if ( _WornItems.size() > wornTexts.size() )
{
uint i = wornTexts.size();
uint i = (uint)wornTexts.size();
wornTexts.resize( _WornItems.size() );
for (; i < wornTexts.size(); i++ )
{

View file

@ -425,7 +425,7 @@ class CMissionStepGiveItem : public IMissionStepTemplate
gift = true;
TVectorParamCheck vect( 1 + _Params.size() );
vect[0].Type = STRING_MANAGER::integer;
vect[0].Int = _SubSteps.size();
vect[0].Int = (sint32)_SubSteps.size();
if ( !_PhraseId.empty() )
{

View file

@ -1332,7 +1332,7 @@ bool COutpost::insertDefaultSquad(OUTPOSTENUMS::TPVPSide side, uint32 squadSlot)
// right shift slots
if (squads->size() >= 2)
{
uint32 i = squads->size()-2;
uint32 i = (uint32)squads->size()-2;
while (i >= squadIndex)
{
(*squads)[i+1] = (*squads)[i];
@ -1400,7 +1400,7 @@ uint32 COutpost::getChallengeCost() const
TAIAlias COutpost::getRandomSpawnZone() const
{
// choose a random spawn zone
sint32 randomCount = RandomGenerator.rand(_SpawnZones.size() - 1);
sint32 randomCount = RandomGenerator.rand((uint16)_SpawnZones.size() - 1);
nlassert(randomCount >= 0 && randomCount < (sint32)_SpawnZones.size());
return _SpawnZones[randomCount].alias();
}
@ -1845,7 +1845,7 @@ bool COutpost::convertShopSquadIndex(uint32 shopSquadIndex, COutpostSquadDescrip
}
else
{
shopSquadIndex -= _DefaultSquads.size();
shopSquadIndex -= (uint32)_DefaultSquads.size();
if (shopSquadIndex < _BuyableSquads.size())
{
squadDesc = _BuyableSquads[shopSquadIndex];

View file

@ -304,7 +304,7 @@ void COutpostManager::loadOutpostPrimitives()
OUTPOST_INF("Outpost '%s' was successfully parsed", outpost->getName().c_str());
// nb : short id starts at 1, 0 is used for invalid
_OutpostAliasToShortId.insert( make_pair( outpost->getAlias(), _Outposts.size()) );
_OutpostAliasToShortId.insert( make_pair( outpost->getAlias(), (uint16)_Outposts.size()) );
}
}
}
@ -681,7 +681,7 @@ void COutpostManager::tickUpdate()
}
else
{
uint32 nbOutpost = _Outposts.size();
uint32 nbOutpost = (uint32)_Outposts.size();
uint32 nbOutpostPerTick = (uint32)floor(double(nbOutpost) / double(OutpostUpdatePeriod.get()));
nbOutpostPerTick = std::max(uint32(1), nbOutpostPerTick); // The strict minimum is a single outpost update per tick
@ -705,7 +705,7 @@ void COutpostManager::tickUpdate()
}
else
{
endIndex -= _Outposts.size();
endIndex -= (uint32)_Outposts.size();
for (uint32 i = beginIndex; i < _Outposts.size(); i++)
_Outposts[i]->updateOutpost(currentTime);
for (uint32 i = 0; i < endIndex; i++)
@ -784,7 +784,7 @@ void COutpostManager::saveOutpost(NLMISC::CSmartPtr<COutpost> outpost)
H_AUTO(COutpostSerialXML);
std::string s;
pdr.toString(s);
msg.DataMsg.serialBuffer((uint8*)&s[0], s.size());
msg.DataMsg.serialBuffer((uint8*)&s[0], (uint)s.size());
}
else
{

View file

@ -71,7 +71,7 @@ bool CAuraRootEffect::update(CTimerEvent * event, bool )
// create or update effect on entities returned
const vector<CEntityBase*> &entities = entitiesSelector.getEntities();
const uint size = entities.size();
const uint size = (uint)entities.size();
for (uint i = 0; i < size ; ++i)
{
if (entities[i] && isEntityValidTarget(entities[i], creator) )

View file

@ -92,7 +92,7 @@ CEntityBase *CBounceEffect::getTargetForBounce() const
// select valid entities
const vector<CEntityBase*> &entities = entitiesSelector.getEntities();
const uint size = entities.size();
const uint size = (uint)entities.size();
vector<CEntityBase*> selectedEntities;
selectedEntities.reserve(size);
@ -108,7 +108,7 @@ CEntityBase *CBounceEffect::getTargetForBounce() const
if (selectedEntities.empty())
return NULL;
uint32 num = RandomGenerator.rand(selectedEntities.size()-1);
uint32 num = RandomGenerator.rand((uint16)selectedEntities.size()-1);
return selectedEntities[num];

View file

@ -67,7 +67,7 @@ void CCombatAiActionEffect::apply( CCombatPhrase *phrase )
H_AUTO(CCombatAiActionEffect_apply);
const vector<CCombatPhrase::TTargetInfos> & targets = phrase->getTargets();
const uint nbTargets = targets.size();
const uint nbTargets = (uint)targets.size();
for (uint i = 0 ; i < nbTargets ; ++i)
{
//if ( !phrase->hasTargetDodged(i) )

View file

@ -61,7 +61,7 @@ void CCombatActionDisarm::apply( CCombatPhrase *phrase )
H_AUTO(CCombatActionDisarm_apply);
const vector<CCombatPhrase::TTargetInfos> &targets = phrase->getTargets();
const uint nbTargets = targets.size();
const uint nbTargets = (uint)targets.size();
for (uint i = 0 ; i < nbTargets ; ++i)
{
//if ( !phrase->hasTargetDodged(i) )

View file

@ -73,7 +73,7 @@ void CCombatActionDoT::apply( CCombatPhrase *phrase )
const TGameCycle endDate = CTickEventHandler::getGameCycle() + _EffectDuration;
const vector<CCombatPhrase::TTargetInfos> &targets = phrase->getTargets();
const uint nbTargets = targets.size();
const uint nbTargets = (uint)targets.size();
for (uint i = 0 ; i < nbTargets ; ++i)
{
// if ( !phrase->hasTargetDodged(i) )

View file

@ -336,7 +336,7 @@ CCombatPhrase::~CCombatPhrase()
clearTargets();
const uint size = _CombatActions.size();
const uint size = (uint)_CombatActions.size();
for (uint i = 0 ; i < size ; ++i)
{
if (_CombatActions[i] != NULL)
@ -1933,7 +1933,7 @@ bool CCombatPhrase::launch()
buildTargetList(true, false);
const uint32 nbTargets = _Targets.size();
const uint32 nbTargets = (uint32)_Targets.size();
// update behaviour
if ( _Behaviour.isCombat() )
@ -1994,7 +1994,7 @@ bool CCombatPhrase::launch()
buildTargetList(true, _IsMad);
// resize datas
const uint32 nbTargets = _Targets.size();
const uint32 nbTargets = (uint32)_Targets.size();
// update behaviour
if ( _Behaviour.isCombat() )
@ -2060,7 +2060,7 @@ bool CCombatPhrase::launch()
CMirrorPropValueList<uint32> targetList(TheDataset, _Attacker->getEntityRowId(), DSPropertyTARGET_LIST);
targetList.clear();
const sint size = _Targets.size();
const sint size = (sint)_Targets.size();
for (sint i = size-1 ; i >= 0 ; --i)
{
PHRASE_UTILITIES::updateMirrorTargetList(targetList, _Targets[i].Target->getEntityRowId(), _Targets[i].Distance, false);
@ -2349,7 +2349,7 @@ bool CCombatPhrase::launchAttack(CEntityBase * actingEntity, bool rightHand, boo
}
else
{
uint32 nbTargets = _Targets.size();
uint32 nbTargets = (uint32)_Targets.size();
#if !FINAL_VERSION
nlassert(nbTargets);
#endif
@ -2818,7 +2818,7 @@ void CCombatPhrase::applyAttack(CEntityBase * actingEntity, bool rightHand)
std::vector<TApplyAction> & actions = rightHand ? _RightApplyActions : _LeftApplyActions;
const uint nbActions = actions.size();
const uint nbActions = (uint)actions.size();
// if there is no action for this hand, the attack failed
if (nbActions == 0)
@ -2832,7 +2832,7 @@ void CCombatPhrase::applyAttack(CEntityBase * actingEntity, bool rightHand)
applyAction(actions[i], actionReports, rightHand);
}
const uint nbReports = actionReports.size();
const uint nbReports = (uint)actionReports.size();
// if attacker is mad, change reports
if (_IsMad)
@ -3524,7 +3524,7 @@ float CCombatPhrase::testOpponentDefense(CCombatDefenderPtr &combatDefender, boo
// compute defender malus when facing several opponents
const set<TDataSetRow> &aggressors = CPhraseManager::getInstance().getMeleeAggressors(targetRowId);
sint32 defenseModifier = 0;
uint32 nb = aggressors.size();
uint32 nb = (uint32)aggressors.size();
if (nb > NbOpponentsBeforeMalus)
{
defenseModifier = (nb - NbOpponentsBeforeMalus) * ModPerSupernumeraryOpponent;
@ -4045,7 +4045,7 @@ bool CCombatPhrase::validateCombatActions( string &errorCode )
{
H_AUTO(CCombatPhrase_validateCombatActions);
const uint size = _CombatActions.size();
const uint size = (uint)_CombatActions.size();
for (uint i = 0 ; i < size ; ++i)
{
if ( _CombatActions[i] != NULL)
@ -4067,7 +4067,7 @@ void CCombatPhrase::applyCombatActions()
// if (!_Defender) return;
const uint size = _CombatActions.size();
const uint size = (uint)_CombatActions.size();
for (uint i = 0 ; i < size ; ++i)
{
if ( _CombatActions[i] != NULL)
@ -4493,7 +4493,7 @@ void CCombatPhrase::buildTargetList(bool rightHand, bool isMad)
{
string dummy;
const uint previousNbTargets = _Targets.size();
const uint previousNbTargets = (uint)_Targets.size();
const set<TDataSetRow> &aggressors = CPhraseManager::getInstance().getMeleeAggressors(_Attacker->getEntityRowId());
set<TDataSetRow>::const_iterator it;
@ -4522,7 +4522,7 @@ void CCombatPhrase::buildTargetList(bool rightHand, bool isMad)
}
}
const uint nbTargets = _Targets.size();
const uint nbTargets = (uint)_Targets.size();
const float damageFactor = min( 1.0f, _MultiTargetGlobalDamageFactor.applyValue(_WeaponSabrinaValue) / ( 1 + nbTargets - previousNbTargets) );
// start to previousNbTarget as previous targets already processed

Some files were not shown because too many files have changed in this diff Show more