mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 23:06:18 +00:00
Changed: Replaced ~0 by corresponding std::numeric_limits<T>::max()
This commit is contained in:
parent
9d0695feee
commit
3602ab47f2
29 changed files with 94 additions and 94 deletions
|
@ -224,7 +224,7 @@ uint32 CAIS::getEmotNumber(const std::string &name)
|
|||
{
|
||||
std::map<std::string, uint32>::iterator it(_EmotNames.find(name));
|
||||
if (it==_EmotNames.end())
|
||||
return ~0;
|
||||
return std::numeric_limits<uint32>::max();
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ uint32 CAIS::createAIInstance(const std::string &continentName, uint32 instanceN
|
|||
continue;
|
||||
|
||||
nlwarning("CAIS::createAIInstance: instance number %u is already in use, can't create new instance.", instanceNumber);
|
||||
return ~0;
|
||||
return std::numeric_limits<uint32>::max();
|
||||
}
|
||||
|
||||
CAIInstance *aii = _AIInstances.addChild(new CAIInstance(this));
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
// classic init(), update() and release()
|
||||
|
||||
/** create an AI instance, return the instance index in the AIList
|
||||
* Return ~0 if the instance number is already in use.
|
||||
* Return std::numeric_limits<uint32>::max() if the instance number is already in use.
|
||||
*/
|
||||
uint32 createAIInstance(const std::string &continentName, uint32 instanceNumber);
|
||||
/** destroy an AI Instance (useful for ring creation / destruction of session)
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
/// Time warp managment. This method is called when time as warped more than 600ms
|
||||
bool advanceUserTimer(uint32 nbTicks);
|
||||
|
||||
/// Retreive emot number given it's name, return ~0 if not found
|
||||
/// Retreive emot number given it's name, return std::numeric_limits<uint32>::max() if not found
|
||||
uint32 getEmotNumber(const std::string &name);
|
||||
|
||||
CCont<CAIInstance> &AIList () { return _AIInstances; }
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
class CCounter
|
||||
{
|
||||
public:
|
||||
CCounter(const uint32 max=~0):_Total(0),_Max(max)
|
||||
CCounter(const uint32 max=std::numeric_limits<uint32>::max()):_Total(0),_Max(max)
|
||||
{}
|
||||
virtual ~CCounter()
|
||||
{}
|
||||
|
|
|
@ -571,7 +571,7 @@ bool CFightOrganizer::reorganizeIteration(CBot* bot)
|
|||
ennemy=entity;
|
||||
}
|
||||
}
|
||||
entity->_ChooseLastTime=~0;
|
||||
entity->_ChooseLastTime = std::numeric_limits<uint32>::max();
|
||||
}
|
||||
|
||||
if (fleeEnnemy==NULL && !spawnBot->getUnreachableTarget().isNULL())
|
||||
|
|
|
@ -220,7 +220,7 @@ void CSpawnGroupFauna::update()
|
|||
|
||||
getPersistent().updateStateInstance();
|
||||
|
||||
if (_CurrentCycle==~0)
|
||||
if (_CurrentCycle==std::numeric_limits<uint32>::max())
|
||||
return;
|
||||
|
||||
// Respawn
|
||||
|
@ -606,9 +606,9 @@ CGrpFauna::CGrpFauna(CMgrFauna* mgr, CAIAliasDescriptionNode* aliasTree, RYAI_MA
|
|||
|
||||
// state
|
||||
|
||||
_CurPopulation = ~0u;
|
||||
_CurPopulation = std::numeric_limits<uint32>::max();
|
||||
|
||||
_CurrentCycle = ~0;
|
||||
_CurrentCycle = std::numeric_limits<sint32>::max();
|
||||
|
||||
// default values.
|
||||
setTimer(EAT_TIME, refTimer(EAT_TIME));
|
||||
|
@ -699,9 +699,9 @@ CAliasTreeOwner* CGrpFauna::createChild(IAliasCont* cont, CAIAliasDescriptionNod
|
|||
CAIPlaceXYRFauna *faunaPlace = new CAIPlaceXYRFauna(this, aliasTree);
|
||||
child = faunaPlace;
|
||||
uint placeIndex = faunaPlace->setupFromOldName(name);
|
||||
nlassert(placeIndex!=~0);
|
||||
nlassert(placeIndex!=std::numeric_limits<uint>::max());
|
||||
|
||||
if (placeIndex!=~0)
|
||||
if (placeIndex!=std::numeric_limits<uint>::max())
|
||||
cont->addAliasChild(child, placeIndex);
|
||||
|
||||
return child;
|
||||
|
@ -769,7 +769,7 @@ bool CGrpFauna::spawn()
|
|||
return false;
|
||||
|
||||
setStartState(getStartState()); // stateInstance.
|
||||
return spawnPop(~0);
|
||||
return spawnPop(std::numeric_limits<uint>::max());
|
||||
}
|
||||
|
||||
bool CGrpFauna::timeAllowSpawn(uint32 popVersion) const
|
||||
|
@ -841,7 +841,7 @@ bool CGrpFauna::spawnPop(uint popVersion)
|
|||
}
|
||||
|
||||
// check the validity of the input parameter
|
||||
if (popVersion!=~0 && popVersion>=_Populations.size())
|
||||
if (popVersion!=std::numeric_limits<uint>::max() && popVersion>=_Populations.size())
|
||||
{
|
||||
nlwarning("CGrpFauna::spawn(idx) FAILED for group %s because idx (%d) >= _Populations.size() (%d)",this->CGroup::getFullName().c_str(),popVersion,_Populations.size());
|
||||
return false;
|
||||
|
|
|
@ -495,7 +495,7 @@ uint32 CAliasCont<TChld>::getChildIndexByAlias(uint32 alias) const
|
|||
if (child!=NULL && child->getAlias()==alias)
|
||||
return (uint32)i;
|
||||
}
|
||||
return ~0;
|
||||
return std::numeric_limits<uint32>::max();
|
||||
}
|
||||
|
||||
template <class TChld>
|
||||
|
|
|
@ -577,7 +577,7 @@ NLMISC_COMMAND(createStaticAIInstance, "Create a new static AIInstance for a giv
|
|||
CUsedContinent &uc = CUsedContinent::instance();
|
||||
|
||||
const uint32 in = uc.getInstanceForContinent(args[0]);
|
||||
if (in == ~0)
|
||||
if (in == std::numeric_limits<uint32>::max())
|
||||
{
|
||||
nlwarning("The continent '%s' is unknow or not active. Can't create instance, FATAL", args[0].c_str());
|
||||
nlassert(in != ~0);
|
||||
|
|
|
@ -695,7 +695,7 @@ static CAIVector randomPos(double dispersionRadius)
|
|||
{
|
||||
return CAIVector(0., 0.);
|
||||
}
|
||||
uint32 const maxLimit=((uint32)~0U)>>1;
|
||||
uint32 const maxLimit=(std::numeric_limits<uint32>::max())>>1;
|
||||
double rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[
|
||||
double r = dispersionRadius*sqrt(rval);
|
||||
rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[
|
||||
|
|
|
@ -210,7 +210,7 @@ class CFamilyBehavior
|
|||
|
||||
void spawnBoss(NLMISC::TStringId outpostName);
|
||||
|
||||
uint32 energyScale (uint32 levelIndex=~0) const;
|
||||
uint32 energyScale (uint32 levelIndex=std::numeric_limits<uint32>::max()) const;
|
||||
|
||||
void setModifier (const float &value, const uint32 &index)
|
||||
{
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
if (_value==-1) // not for affectation.
|
||||
return;
|
||||
|
||||
if (_index==~0) // all indexs ?
|
||||
if (_index==std::numeric_limits<size_t>::max()) // all indexs ?
|
||||
{
|
||||
for (uint32 nrjIndex=0;nrjIndex<4;nrjIndex++)
|
||||
fb->setModifier (_value, nrjIndex);
|
||||
|
|
|
@ -168,11 +168,11 @@ public:
|
|||
// - This method adds the new object to the top of the CFollowPath singleton's context stack
|
||||
// parameters:
|
||||
// - contextName : an arbitrary string naming the context
|
||||
// - maxSearchDepth : the value that the path finder search depth should be limitted to (default to ~0u meaning no limit)
|
||||
// - maxSearchDepth : the value that the path finder search depth should be limitted to (default to std::numeric_limits<uint32>::max() meaning no limit)
|
||||
// - forceMaxDepth : set this flag true to override previous limit with larger value
|
||||
// example:
|
||||
// - ... Before we begin ... CFollowPath::_MaxSearchDepth = ~0u
|
||||
// - CFollowPathContext context1("tata") : CFollowPath::_MaxSearchDepth => ~0u
|
||||
// - ... Before we begin ... CFollowPath::_MaxSearchDepth = std::numeric_limits<uint32>::max()
|
||||
// - CFollowPathContext context1("tata") : CFollowPath::_MaxSearchDepth => std::numeric_limits<uint32>::max()
|
||||
// - CFollowPathContext context2("tete",456) : CFollowPath::_MaxSearchDepth => 456
|
||||
// - CFollowPathContext context3("titi",123) : CFollowPath::_MaxSearchDepth => 123
|
||||
// - CFollowPathContext context4("toto",456) : CFollowPath::_MaxSearchDepth => 123
|
||||
|
@ -182,9 +182,9 @@ public:
|
|||
// - CFollowPathContext context5.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => 123
|
||||
// - CFollowPathContext context4.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => 123
|
||||
// - CFollowPathContext context3.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => 456
|
||||
// - CFollowPathContext context2.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => ~0u
|
||||
// - CFollowPathContext context1.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => ~0u
|
||||
CFollowPathContext(const char* contextName, uint32 maxSearchDepth=~0u, bool forceMaxDepth=false);
|
||||
// - CFollowPathContext context2.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => std::numeric_limits<uint32>::max()
|
||||
// - CFollowPathContext context1.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => std::numeric_limits<uint32>::max()
|
||||
CFollowPathContext(const char* contextName, uint32 maxSearchDepth=std::numeric_limits<uint32>::max(), bool forceMaxDepth=false);
|
||||
|
||||
// dtor
|
||||
// - This method removes the destroyed object from the CFollowPath singleton's context stack
|
||||
|
@ -270,7 +270,7 @@ private:
|
|||
friend class CFollowPathContext;
|
||||
CFollowPathContext* _TopFollowPathContext;
|
||||
public:
|
||||
uint32 getMaxSearchDepth() const { return (_TopFollowPathContext==NULL)? ~0u: _TopFollowPathContext->getMaxSearchDepth(); }
|
||||
uint32 getMaxSearchDepth() const { return (_TopFollowPathContext==NULL)? std::numeric_limits<uint32>::max(): _TopFollowPathContext->getMaxSearchDepth(); }
|
||||
const char* getContextName() const;
|
||||
};
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ protected:
|
|||
CAITimerExtended _StateTimeout;
|
||||
/// current state (index into manager's state vector)
|
||||
CAIState* _state;
|
||||
/// variable set to request a state change (~0 otherwise)
|
||||
/// variable set to request a state change (std::numeric_limits<uint32>::max() otherwise)
|
||||
CAIState* _NextState;
|
||||
|
||||
/// timer for timing punctual states
|
||||
|
|
|
@ -522,7 +522,7 @@ FILE_LIST_BUILDER(NewestFile,"remove all but the latest file for each account (a
|
|||
uint32 accountId= accountIds[i];
|
||||
uint32& bestTime= bestTimes[accountId];
|
||||
uint32 timeStamp= fdc[i].FileTimeStamp;
|
||||
if (bestTime!=timeStamp || bestTime==~0u)
|
||||
if (bestTime!=timeStamp || bestTime==std::numeric_limits<uint32>::max())
|
||||
{
|
||||
fdc.removeFile(i);
|
||||
continue;
|
||||
|
|
|
@ -912,7 +912,7 @@ void cbLSChooseShard (CMessage &msgin, const std::string &serviceName, TServiceI
|
|||
}
|
||||
|
||||
|
||||
string ret = lsChooseShard(userName, cookie, userPriv, userExtended, WS::TUserRole::ur_player, 0xffffffff, ~0);
|
||||
string ret = lsChooseShard(userName, cookie, userPriv, userExtended, WS::TUserRole::ur_player, 0xffffffff, std::numeric_limits<uint32>::max());
|
||||
|
||||
if (!ret.empty())
|
||||
{
|
||||
|
|
|
@ -238,8 +238,8 @@ namespace LGS
|
|||
// create the log context closing
|
||||
_LogInfos.push_back(TLogInfo());
|
||||
_LogInfos.back().setLogName(contextName);
|
||||
// tag as 'closing' with ~0
|
||||
_LogInfos.back().setTimeStamp(~0);
|
||||
// tag as 'closing' with std::numeric_limits<uint32>::max()
|
||||
_LogInfos.back().setTimeStamp(std::numeric_limits<uint32>::max());
|
||||
}
|
||||
--_NbOpenContext;
|
||||
if (VerboseLogger)
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
virtual void description ()
|
||||
{
|
||||
className ("CUserEventMsg");
|
||||
property ("InstanceNumber", PropUInt32, uint32(~0), InstanceNumber);
|
||||
property ("InstanceNumber", PropUInt32, std::numeric_limits<uint32>::max(), InstanceNumber);
|
||||
property ("GrpAlias", PropUInt32, uint32(0xffffffff), GrpAlias);
|
||||
property ("EventId", PropUInt8, uint8(0xff), EventId);
|
||||
propertyCont ("Params", PropString, Params);
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
virtual void description ()
|
||||
{
|
||||
className ("CSetEscortTeamId");
|
||||
property ("InstanceNumber", PropUInt32, uint32(~0), InstanceNumber);
|
||||
property ("InstanceNumber", PropUInt32, std::numeric_limits<uint32>::max(), InstanceNumber);
|
||||
propertyCont ("Groups", PropUInt32, Groups);
|
||||
property ("TeamId", PropUInt16, CTEAM::InvalidTeamId, TeamId);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
virtual void description ()
|
||||
{
|
||||
className ("CPetSpawnMsg");
|
||||
property ("AIInstanceId", PropUInt32, (uint32)~0, AIInstanceId);
|
||||
property ("AIInstanceId", PropUInt32, std::numeric_limits<uint32>::max(), AIInstanceId);
|
||||
property ("SpawnMode", PropUInt16, (uint16)NEAR_PLAYER, SpawnMode);
|
||||
property ("CharacterMirrorRow", PropDataSetRow, TDataSetRow(), CharacterMirrorRow);
|
||||
property ("PetSheetId", PropSheetId, NLMISC::CSheetId::Unknown, PetSheetId);
|
||||
|
|
|
@ -147,8 +147,8 @@ namespace R2_VISION
|
|||
|
||||
void CUniverse::createInstance(uint32 aiInstance, uint32 groupId)
|
||||
{
|
||||
// just ignore attempts to create the ~0u instance
|
||||
if (aiInstance==~0u)
|
||||
// just ignore attempts to create the std::numeric_limits<uint32>::max() instance
|
||||
if (aiInstance==std::numeric_limits<uint32>::max())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ namespace R2_VISION
|
|||
|
||||
void CUniverse::removeInstance(uint32 aiInstance)
|
||||
{
|
||||
// just ignore attempts to remove the ~0u instance
|
||||
if (aiInstance==~0u)
|
||||
// just ignore attempts to remove the std::numeric_limits<uint32>::max() instance
|
||||
if (aiInstance==std::numeric_limits<uint32>::max())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ namespace R2_VISION
|
|||
SUniverseEntity& theEntity= _Entities[row];
|
||||
|
||||
// if the entity was already allocated then remove it
|
||||
if (theEntity.AIInstance == ~0u) { return; }
|
||||
if (theEntity.AIInstance == std::numeric_limits<uint32>::max()) { return; }
|
||||
|
||||
if ( theEntity.ViewerRecord)
|
||||
{
|
||||
|
@ -325,8 +325,8 @@ namespace R2_VISION
|
|||
BOMB_IF(row>=_Entities.size(),NLMISC::toString("Ignoring attempt to set entity position with invalid row value: %d",row),return);
|
||||
|
||||
// ensure that the new AIInstance exists
|
||||
BOMB_IF(aiInstance!=~0u && (aiInstance>=_Instances.size() || _Instances[aiInstance]==NULL),
|
||||
NLMISC::toString("ERROR: Failed to add entity %d to un-initialised instance: %d",row,aiInstance),aiInstance=~0u);
|
||||
BOMB_IF(aiInstance!=std::numeric_limits<uint32>::max() && (aiInstance>=_Instances.size() || _Instances[aiInstance]==NULL),
|
||||
NLMISC::toString("ERROR: Failed to add entity %d to un-initialised instance: %d",row,aiInstance),aiInstance=std::numeric_limits<uint32>::max());
|
||||
|
||||
// delegate to workhorse routine (converting y coordinate to +ve axis)
|
||||
_teleportEntity(dataSetRow,aiInstance,x,-y,invisibilityLevel);
|
||||
|
@ -429,7 +429,7 @@ namespace R2_VISION
|
|||
SUniverseEntity& theEntity= _Entities[row];
|
||||
|
||||
// if the entity was already allocated then remove it
|
||||
if (theEntity.AIInstance!=~0u)
|
||||
if (theEntity.AIInstance!=std::numeric_limits<uint32>::max())
|
||||
{
|
||||
_removeEntity(dataSetRow);
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ namespace R2_VISION
|
|||
{
|
||||
// detach the entity from the instance it's currently in
|
||||
_Instances[theEntity.AIInstance]->removeEntity(theEntity);
|
||||
theEntity.AIInstance= ~0u;
|
||||
theEntity.AIInstance= std::numeric_limits<uint32>::max();
|
||||
theEntity.ViewerRecord= NULL;
|
||||
}
|
||||
}
|
||||
|
@ -466,8 +466,8 @@ namespace R2_VISION
|
|||
SUniverseEntity& theEntity= _Entities[dataSetRow.getIndex()];
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
nlassert(theEntity.AIInstance==~0u || theEntity.AIInstance<_Instances.size());
|
||||
nlassert(theEntity.AIInstance==~0u || _Instances[theEntity.AIInstance]!=NULL);
|
||||
nlassert(theEntity.AIInstance==std::numeric_limits<uint32>::max() || theEntity.AIInstance<_Instances.size());
|
||||
nlassert(theEntity.AIInstance==std::numeric_limits<uint32>::max() || _Instances[theEntity.AIInstance]!=NULL);
|
||||
#endif
|
||||
|
||||
// if the entity is a viewer then move the view coordinates
|
||||
|
@ -477,7 +477,7 @@ namespace R2_VISION
|
|||
}
|
||||
|
||||
// if the entity is not currently in an AIInstance then stop here
|
||||
if (theEntity.AIInstance==~0u)
|
||||
if (theEntity.AIInstance==std::numeric_limits<uint32>::max())
|
||||
return;
|
||||
|
||||
// set the instance entity record position
|
||||
|
@ -498,10 +498,10 @@ namespace R2_VISION
|
|||
// set the new AIInstance value for the entity
|
||||
theEntity.AIInstance= aiInstance;
|
||||
|
||||
// if the aiInstance is set to ~0u (a reserved value) then we stop here
|
||||
if (aiInstance==~0u)
|
||||
// if the aiInstance is set to std::numeric_limits<uint32>::max() (a reserved value) then we stop here
|
||||
if (aiInstance==std::numeric_limits<uint32>::max())
|
||||
{
|
||||
// clear out the vision for an entity in aiInstance ~0u
|
||||
// clear out the vision for an entity in aiInstance std::numeric_limits<uint32>::max()
|
||||
if (getEntity(dataSetRow)->ViewerRecord!=NULL)
|
||||
{
|
||||
TVision emptyVision(2);
|
||||
|
@ -785,7 +785,7 @@ namespace R2_VISION
|
|||
// locate the old vision group (the one we're allocated to before isolation)
|
||||
uint32 visionId= viewerRecord->VisionId;
|
||||
NLMISC::CSmartPtr<CVisionGroup>& oldVisionGroup= _VisionGroups[visionId];
|
||||
BOMB_IF(visionId>=_VisionGroups.size() ||oldVisionGroup==NULL,"Trying to remove entity from vision group with unknown vision id",viewerRecord->VisionId=~0u;return);
|
||||
BOMB_IF(visionId>=_VisionGroups.size() ||oldVisionGroup==NULL,"Trying to remove entity from vision group with unknown vision id",viewerRecord->VisionId=std::numeric_limits<uint32>::max();return);
|
||||
|
||||
// if we're the only viewer then already isolated so just return
|
||||
if (oldVisionGroup->numViewers()==1)
|
||||
|
@ -830,7 +830,7 @@ namespace R2_VISION
|
|||
if (viewerRecord!=NULL)
|
||||
{
|
||||
uint32 visionId= viewerRecord->VisionId;
|
||||
BOMB_IF(visionId>=_VisionGroups.size() ||_VisionGroups[visionId]==NULL,"Trying to remove entity with unknown vision id",viewerRecord->VisionId=~0u;return);
|
||||
BOMB_IF(visionId>=_VisionGroups.size() ||_VisionGroups[visionId]==NULL,"Trying to remove entity with unknown vision id",viewerRecord->VisionId=std::numeric_limits<uint32>::max();return);
|
||||
_VisionGroups[visionId]->removeViewer(viewerRecord);
|
||||
}
|
||||
|
||||
|
@ -847,8 +847,8 @@ namespace R2_VISION
|
|||
_Entities.pop_back();
|
||||
|
||||
// invalidate the InstanceIndex value for the entity we just removed
|
||||
entity.InstanceIndex=~0u;
|
||||
entity.AIInstance=~0u;
|
||||
entity.InstanceIndex=std::numeric_limits<uint32>::max();
|
||||
entity.AIInstance=std::numeric_limits<uint32>::max();
|
||||
}
|
||||
|
||||
void CInstance::release()
|
||||
|
@ -899,11 +899,11 @@ namespace R2_VISION
|
|||
|
||||
CVisionGroup::CVisionGroup()
|
||||
{
|
||||
_XMin=~0u;
|
||||
_XMin=std::numeric_limits<uint32>::max();
|
||||
_XMax=0;
|
||||
_YMin=~0u;
|
||||
_YMin=std::numeric_limits<uint32>::max();
|
||||
_YMax=0;
|
||||
_VisionId=~0u;
|
||||
_VisionId=std::numeric_limits<uint32>::max();
|
||||
// setup the dummy entry in the vision buffer
|
||||
_Vision.reserve(AllocatedVisionVectorSize);
|
||||
vectAppend(_Vision).DataSetRow= ZeroDataSetRow;
|
||||
|
@ -923,8 +923,8 @@ namespace R2_VISION
|
|||
// ensure that the viewer wasn't aleady attached to another vision group
|
||||
#ifdef NL_DEBUG
|
||||
nlassert(viewer!=NULL);
|
||||
nlassert(viewer->VisionId==~0u);
|
||||
nlassert(viewer->VisionIndex==~0u);
|
||||
nlassert(viewer->VisionId==std::numeric_limits<uint32>::max());
|
||||
nlassert(viewer->VisionIndex==std::numeric_limits<uint32>::max());
|
||||
#endif
|
||||
TEST(("add viewer %d to grp %d",viewer->getViewerId().getIndex(),_VisionId));
|
||||
|
||||
|
@ -961,8 +961,8 @@ namespace R2_VISION
|
|||
|
||||
// pop the back entry off the vector and flag oursleves as unused
|
||||
_Viewers.pop_back();
|
||||
viewer->VisionId= ~0u;
|
||||
viewer->VisionIndex= ~0u;
|
||||
viewer->VisionId= std::numeric_limits<uint32>::max();
|
||||
viewer->VisionIndex= std::numeric_limits<uint32>::max();
|
||||
|
||||
// NOTE: after this the boundary may be out of date - this will be recalculated at the next
|
||||
// vision update so we don't take time to do it here
|
||||
|
@ -1171,8 +1171,8 @@ namespace R2_VISION
|
|||
return;
|
||||
|
||||
// calculate the bouding box for our viewers
|
||||
uint32 xmin= ~0u;
|
||||
uint32 ymin= ~0u;
|
||||
uint32 xmin= std::numeric_limits<uint32>::max();
|
||||
uint32 ymin= std::numeric_limits<uint32>::max();
|
||||
uint32 xmax= 0;
|
||||
uint32 ymax= 0;
|
||||
for (uint32 i=(uint32)_Viewers.size();i--;)
|
||||
|
@ -1247,7 +1247,7 @@ namespace R2_VISION
|
|||
// reset the vision vector and add in the dummy entry with DataSetRow=0
|
||||
_Vision.resize(AllocatedVisionVectorSize);
|
||||
_Vision[0].DataSetRow= ZeroDataSetRow;
|
||||
_Vision[0].VisionSlot= ~0u;
|
||||
_Vision[0].VisionSlot= std::numeric_limits<uint32>::max();
|
||||
|
||||
// setup a vision slot iterator for filling in the vision buffer (=1 to skip passed the dummy entry)
|
||||
uint32 nextVisionSlot=1;
|
||||
|
@ -1380,8 +1380,8 @@ namespace R2_VISION
|
|||
|
||||
CViewer::CViewer()
|
||||
{
|
||||
VisionId=~0u;
|
||||
VisionIndex=~0u;
|
||||
VisionId=std::numeric_limits<uint32>::max();
|
||||
VisionIndex=std::numeric_limits<uint32>::max();
|
||||
_VisionResetCount= 0;
|
||||
}
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ namespace R2_VISION
|
|||
|
||||
// setup the dummy entry with DataSetRow=0
|
||||
_Vision[0].DataSetRow= ZeroDataSetRow;
|
||||
_Vision[0].VisionSlot= ~0u;
|
||||
_Vision[0].VisionSlot= std::numeric_limits<uint32>::max();
|
||||
|
||||
// setup the vision slots in reverse order from 254..0 (because they're popped from the back)
|
||||
_FreeVisionSlots.clear();
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace R2_VISION
|
|||
// ctor
|
||||
SViewedEntity()
|
||||
{
|
||||
VisionSlot=~0u;
|
||||
VisionSlot=std::numeric_limits<uint32>::max();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -196,15 +196,15 @@ namespace R2_VISION
|
|||
struct SUniverseEntity
|
||||
{
|
||||
TDataSetRow DataSetRow; // the complete data set row for the entity
|
||||
uint32 AIInstance; // the id of the instance that we're currently in (~0u by default)
|
||||
uint32 AIInstance; // the id of the instance that we're currently in (std::numeric_limits<uint32>::max() by default)
|
||||
mutable uint32 InstanceIndex; // the index within the instance's _Entities vector
|
||||
NLMISC::CSmartPtr<CViewer> ViewerRecord; // pointer to the CViewer record for viewers (or NULL)
|
||||
|
||||
// ctor
|
||||
SUniverseEntity()
|
||||
{
|
||||
AIInstance=~0u;
|
||||
InstanceIndex=~0u;
|
||||
AIInstance=std::numeric_limits<uint32>::max();
|
||||
InstanceIndex=std::numeric_limits<uint32>::max();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ uint32 CUsedContinent::getInstanceForContinent(const std::string &continentName)
|
|||
if (it != _Continents.end())
|
||||
return it->ContinentInstance;
|
||||
else
|
||||
return ~0;
|
||||
return std::numeric_limits<uint32>::max();
|
||||
}
|
||||
|
||||
uint32 CUsedContinent::getInstanceForContinent(CONTINENT::TContinent continentEnum) const
|
||||
|
@ -115,7 +115,7 @@ uint32 CUsedContinent::getInstanceForContinent(CONTINENT::TContinent continentEn
|
|||
if (it != _Continents.end())
|
||||
return it->ContinentInstance;
|
||||
else
|
||||
return ~0;
|
||||
return std::numeric_limits<uint32>::max();
|
||||
}
|
||||
|
||||
const std::string &CUsedContinent::getContinentForInstance(uint32 instanceNumber) const
|
||||
|
|
|
@ -60,12 +60,12 @@ public:
|
|||
bool isContinentUsed(const std::string &continentName) const;
|
||||
|
||||
/** Return the static instance number associated with a continent name.
|
||||
* If the continent name is unknow, return ~0
|
||||
* If the continent name is unknow, return std::numeric_limits<uint32>::max()
|
||||
*/
|
||||
uint32 getInstanceForContinent(const std::string &continentName) const;
|
||||
|
||||
/** Return the static instance number associated with a continent enum value
|
||||
* If the continent name is unknow, return ~0
|
||||
* If the continent name is unknow, return std::numeric_limits<uint32>::max()
|
||||
*/
|
||||
uint32 getInstanceForContinent(CONTINENT::TContinent continentEnum) const;
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ namespace CHARSYNC
|
|||
for (; first != last; ++first)
|
||||
{
|
||||
// default to no limit
|
||||
uint32 limit=~0u;
|
||||
uint32 limit=std::numeric_limits<uint32>::max();
|
||||
|
||||
// if there's a limit in the limis map then use it instead...
|
||||
if (limitsMap.find(first->first)!=limitsMap.end())
|
||||
|
|
|
@ -472,7 +472,7 @@ void CRangeList::acquireFirstRow()
|
|||
*/
|
||||
bool CRangeList::acquireRange( NLNET::TServiceId ownerServiceId, NLNET::TServiceId mirrorServiceId, sint32 nbRows, TDataSetIndex *first, TDataSetIndex *last )
|
||||
{
|
||||
TDataSetIndex prevlast(~0);
|
||||
TDataSetIndex prevlast(std::numeric_limits<uint32>::max());
|
||||
TRangeList::iterator irl = _RangeList.begin();
|
||||
|
||||
// Find a compatible range
|
||||
|
|
|
@ -46,7 +46,7 @@ class CRangeList
|
|||
public:
|
||||
|
||||
/// Default constructor
|
||||
CRangeList() : _TotalMaxRows(~0) { acquireFirstRow(); }
|
||||
CRangeList() : _TotalMaxRows(std::numeric_limits<sint32>::max()) { acquireFirstRow(); }
|
||||
|
||||
/// Constructor
|
||||
CRangeList( sint32 totalMaxRows ) : _TotalMaxRows( totalMaxRows ) { acquireFirstRow(); }
|
||||
|
|
|
@ -825,7 +825,7 @@ bool CTickService::loadGameCycle()
|
|||
/*
|
||||
*
|
||||
*/
|
||||
CTickServiceGameCycleTimeMeasure::CTickServiceGameCycleTimeMeasure() : HistoryMain( CTickService::getInstance()->getServiceId(), NLNET::TServiceId(~0), false ) {}
|
||||
CTickServiceGameCycleTimeMeasure::CTickServiceGameCycleTimeMeasure() : HistoryMain( CTickService::getInstance()->getServiceId(), NLNET::TServiceId(std::numeric_limits<uint16>::max()), false ) {}
|
||||
|
||||
|
||||
/*
|
||||
|
@ -904,7 +904,7 @@ void CTickServiceGameCycleTimeMeasure::displayStat( NLMISC::CLog *log, TTimeMeas
|
|||
uint divideBy = (HistoryMain.NbMeasures==0) ? 0 : ((stat==MHTSum) ? HistoryMain.NbMeasures : 1);
|
||||
HistoryMain.Stats[stat].displayStat( log, TickServiceTimeMeasureTypeToCString, divideBy );
|
||||
{
|
||||
CMirrorTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, ~0, 0 };
|
||||
CMirrorTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, std::numeric_limits<uint16>::max(), 0 };
|
||||
for ( std::vector<CMirrorTimeMeasureHistory>::const_iterator ihm=HistoryByMirror.begin(); ihm!=HistoryByMirror.end(); ++ihm )
|
||||
{
|
||||
log->displayRawNL( "\tMS-%hu, %u measures:", (*ihm).ServiceId.get(), (*ihm).NbMeasures );
|
||||
|
@ -921,7 +921,7 @@ void CTickServiceGameCycleTimeMeasure::displayStat( NLMISC::CLog *log, TTimeMeas
|
|||
}
|
||||
}
|
||||
{
|
||||
CServiceTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, ~0, 0 };
|
||||
CServiceTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, std::numeric_limits<uint16>::max(), 0 };
|
||||
for ( std::vector<CServiceTimeMeasureHistory>::const_iterator ihs=HistoryByService.begin(); ihs!=HistoryByService.end(); ++ihs )
|
||||
{
|
||||
log->displayRawNL( "\t%s (on MS-%hu), %u measures:", CUnifiedNetwork::getInstance()->getServiceUnifiedName( (*ihs).ServiceId ).c_str(), (*ihs).ParentServiceId.get(), (*ihs).NbMeasures );
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
NbMeasures = 0;
|
||||
Stats.resize( NbTimeMeasureHistoryStats );
|
||||
Stats[MHTSum] = 0;
|
||||
Stats[MHTMin] = ~0;
|
||||
Stats[MHTMin] = std::numeric_limits<T>::max();
|
||||
Stats[MHTMax] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,17 +55,17 @@ public:
|
|||
* Display the item as a row of a HTML table.
|
||||
* If (key!=previousKey) and (name==previousName), the row will not be displayed entirely to save space
|
||||
*
|
||||
* \param keyColumn If not ~0, column used for sorting => this column displays only the field matching the key
|
||||
* \param keyColumn If not std::numeric_limits<uint32>::max(), column used for sorting => this column displays only the field matching the key
|
||||
* \param key The key used for sorting (see keyColumn)
|
||||
* \param previousKey Previous key
|
||||
* \param nameColumn If not ~0, column used for the unique name (column must have exaclty one element)
|
||||
* \param nameColumn If not std::numeric_limits<uint32>::max(), column used for the unique name (column must have exaclty one element)
|
||||
* \param previousName Previous name
|
||||
*/
|
||||
std::string toHTMLRow( uint32 keyColumn=~0, const string& key=string(), const string& previousKey=string(),
|
||||
uint32 nameColumn=~0, const string& previousName=string() ) const
|
||||
std::string toHTMLRow( uint32 keyColumn=std::numeric_limits<uint32>::max(), const string& key=string(), const string& previousKey=string(),
|
||||
uint32 nameColumn=std::numeric_limits<uint32>::max(), const string& previousName=string() ) const
|
||||
{
|
||||
std::string s = "<tr>";
|
||||
bool lightMode = (nameColumn == ~0) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName));
|
||||
bool lightMode = (nameColumn == std::numeric_limits<uint32>::max()) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName));
|
||||
for ( uint32 c=0; c!=NC; ++c )
|
||||
{
|
||||
s += "<td>";
|
||||
|
@ -86,11 +86,11 @@ public:
|
|||
|
||||
|
||||
///
|
||||
std::string toCSVLine( char columnSeparator=',', string internalSeparator=" - ", uint32 keyColumn=~0, const string& key=string(), const string& previousKey=string(),
|
||||
uint32 nameColumn=~0, const string& previousName=string() ) const
|
||||
std::string toCSVLine( char columnSeparator=',', string internalSeparator=" - ", uint32 keyColumn=std::numeric_limits<uint32>::max(), const string& key=string(), const string& previousKey=string(),
|
||||
uint32 nameColumn=std::numeric_limits<uint32>::max(), const string& previousName=string() ) const
|
||||
{
|
||||
std::string s;
|
||||
bool lightMode = (nameColumn == ~0) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName));
|
||||
bool lightMode = (nameColumn == std::numeric_limits<uint32>::max()) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName));
|
||||
for ( uint32 c=0; c!=NC; ++c )
|
||||
{
|
||||
if ( c == keyColumn )
|
||||
|
|
|
@ -149,7 +149,7 @@ CPackageDescription::CPackageDescription()
|
|||
|
||||
void CPackageDescription::clear()
|
||||
{
|
||||
_NextVersionNumber= ~0u;
|
||||
_NextVersionNumber= std::numeric_limits<uint32>::max();
|
||||
_VersionNumberReserved = false;
|
||||
_Categories.clear();
|
||||
_IndexFileName.clear();
|
||||
|
|
|
@ -237,8 +237,8 @@ CProximityZone::CProximityZone(uint32 scanWidth,uint32 scanHeight,sint32 xOffset
|
|||
|
||||
_MaxOffset = scanWidth * scanHeight -1;
|
||||
|
||||
_XMin = ~0u;
|
||||
_YMin = ~0u;
|
||||
_XMin = std::numeric_limits<uint32>::max();
|
||||
_YMin = std::numeric_limits<uint32>::max();
|
||||
_XMax = 0;
|
||||
_YMax = 0;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ void CProximityMapBuffer::load(const std::string& name)
|
|||
}
|
||||
}
|
||||
// setup the next pixel in the output buffers...
|
||||
_Buffer[y*_ScanWidth+x]= (isAccessible? 0: (TBufferEntry)~0u);
|
||||
_Buffer[y*_ScanWidth+x]= (isAccessible? 0: (TBufferEntry)std::numeric_limits<uint16>::max());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ void CProximityMapBuffer::_prepareBufferForZoneProximityMap(const CProximityZone
|
|||
uint32 zoneWidth= zone.getZoneWidth();
|
||||
uint32 zoneHeight= zone.getZoneHeight();
|
||||
zoneBuffer.clear();
|
||||
zoneBuffer.resize(zoneWidth*zoneHeight,(TBufferEntry)~0u);
|
||||
zoneBuffer.resize(zoneWidth*zoneHeight,(TBufferEntry)std::numeric_limits<uint16>::max());
|
||||
|
||||
// setup the buffer's accessible points and prime vects[0] with the set of accessible points in the zone buffer
|
||||
for (uint32 i=0;i<zone.getOffsets().size();++i)
|
||||
|
|
|
@ -443,7 +443,7 @@ void CPackedWorldBuilder::fly(std::vector<CIslandInfo> &islands, float camSpeed
|
|||
texturedMaterial.setDoubleSided(true);
|
||||
texturedMaterial.setZFunc(CMaterial::lessequal);
|
||||
//
|
||||
uint currWorldIndex = ~0;
|
||||
uint currWorldIndex = std::numeric_limits<uint>::max();
|
||||
bool newPosWanted = true;
|
||||
//
|
||||
std::vector<TPackedZoneBaseSPtr> zones;
|
||||
|
|
Loading…
Reference in a new issue