mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 22:08:43 +00:00
Changed: Replace (uint16)~0 by std::numeric_limits<uint16>::max()
This commit is contained in:
parent
1132eb9fae
commit
c7dcdf56ec
15 changed files with 36 additions and 32 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/net/unified_network.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
/*
|
||||
* Types for options of CMirroredDataSet::declareProperty()
|
||||
|
@ -374,13 +375,13 @@ const TPropertyIndex INVALID_PROPERTY_INDEX = (TPropertyIndex)~0;
|
|||
#ifdef MIRROR_LIST_ROW_32BITS
|
||||
|
||||
typedef uint32 TSharedListRow;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = ~0; //((uint16)~0)-1;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = std::numeric_limits<uint16>::max(); // std::numeric_limits<uint16>::max()-1;
|
||||
const uint NB_SHAREDLIST_CELLS = 500000; // property+list container footprint with data size of 32 bit and 500000 rows: 5.8 MB
|
||||
|
||||
#else
|
||||
|
||||
typedef uint16 TSharedListRow;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = ((uint16)~0)-1;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = std::numeric_limits<uint16>::max()-1;
|
||||
const uint NB_SHAREDLIST_CELLS = INVALID_SHAREDLIST_ROW; // property+list container footprint with data size of 32 bit and 500000 rows: 1.3 MB
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,7 +68,7 @@ struct TChangeTrackerHeader
|
|||
};
|
||||
|
||||
|
||||
const uint16 LOCAL_TRACKER_SERVICE_ID = (uint16)~0;
|
||||
const uint16 LOCAL_TRACKER_SERVICE_ID = std::numeric_limits<uint16>::max();
|
||||
|
||||
/**
|
||||
* Item in a tracker
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <nel/misc/types_nl.h>
|
||||
//#include <sstream>
|
||||
|
||||
#include <limits>
|
||||
|
||||
const uint MAX_NB_DATASETS = 4;
|
||||
extern bool VerboseWarnWhenMirrorReturningUnknownEntityId;
|
||||
|
@ -260,7 +261,7 @@ inline uint16 datasetToBitIndex( CMirroredDataSet *dataSet )
|
|||
if ( DataSetQuickArray[i] == dataSet )
|
||||
return (uint16)i;
|
||||
}
|
||||
return (uint16)~0;
|
||||
return std::numeric_limits<uint16>::max();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -370,13 +370,13 @@ void PERSISTENT_CLASS::store(CPersistentDataRecord &pdr _PERSISTENT_STORE_ARGS)
|
|||
|
||||
#else
|
||||
// define the set of tokens - this makes sure that the tokens exist in the map and that we only look them up the once
|
||||
static uint16 __Tok__MapKey= (uint16)~0u; pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
static uint16 __Tok__MapKey = std::numeric_limits<uint16>::max(); pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal = std::numeric_limits<uint16>::max(); pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
PERSISTENT_DATA
|
||||
#undef _PROP
|
||||
#undef _STRUCT
|
||||
|
@ -471,13 +471,13 @@ void PERSISTENT_CLASS::apply(CPersistentDataRecord &pdr _PERSISTENT_APPLY_ARGS)
|
|||
#endif
|
||||
|
||||
// define the set of tokens - this makes sure that the tokens exist in the map and that we only look them up the once
|
||||
static uint16 __Tok__MapKey= (uint16)~0u; pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
static uint16 __Tok__MapKey = std::numeric_limits<uint16>::max(); pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal = std::numeric_limits<uint16>::max(); pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
PERSISTENT_DATA
|
||||
#undef _PROP
|
||||
#undef _STRUCT
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "property_allocator.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace NLNET
|
||||
{
|
||||
class CMessage;
|
||||
|
@ -40,7 +42,7 @@ class CPropertyAllocatorClient : public CPropertyAllocator
|
|||
public:
|
||||
|
||||
/// Constructor
|
||||
CPropertyAllocatorClient() : _LocalMSId((uint16)~0) {}
|
||||
CPropertyAllocatorClient() : _LocalMSId(std::numeric_limits<uint16>::max()) {}
|
||||
|
||||
/** Ask to allocate, if not done yet, a segment for the specified property.
|
||||
* The pointer will be soon returned by getPropertySegment(), but not always
|
||||
|
|
|
@ -228,7 +228,7 @@ inline CAIMapSurfaceNeighbour::CAIMapSurfaceNeighbour(bool isNoGo) // constructo
|
|||
nlassert(isNoGo=true); // by definition this code can't be executed with isNoGo false
|
||||
|
||||
_surface=NULL;
|
||||
_distance=(uint16)-1;
|
||||
_distance = std::numeric_limits<uint16>::max();
|
||||
//bool _sameRegion=false;
|
||||
memset(_direction,0,sizeof(_direction));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
class CDeposit;
|
||||
|
||||
const uint16 MaxNbActiveSources = (uint16)~0;
|
||||
const uint16 MaxNbActiveSources = std::numeric_limits<uint16>::max();
|
||||
|
||||
/**
|
||||
* A recent forage site prevents from extracting too much material from the same place in a short time.
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
std::map<std::string, size_t>::const_iterator it = _AnimIdMap.find(animId);
|
||||
if (it!=_AnimIdMap.end())
|
||||
return (uint16)it->second;
|
||||
return (uint16)~0;
|
||||
return std::numeric_limits<uint16>::max();
|
||||
}
|
||||
|
||||
/// Removed
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
std::map<std::string, size_t>::const_iterator it = _EmoteIdMap.find(emoteId);
|
||||
if (it!=_EmoteIdMap.end())
|
||||
return (uint16)it->second;
|
||||
return (uint16)~0;
|
||||
return std::numeric_limits<uint16>::max();
|
||||
}
|
||||
MBEHAV::EBehaviour getEmoteBehav(const std::string& emoteId) const;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ CSpecialPowerPhrase::CSpecialPowerPhrase()
|
|||
_IsStatic = false;
|
||||
_AddRecastTime = 0;
|
||||
_PhraseType = BRICK_TYPE::SPECIAL_POWER;
|
||||
_ConsumableFamilyId = (uint16)~0;
|
||||
_ConsumableFamilyId = std::numeric_limits<uint16>::max();
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
|
|
|
@ -54,7 +54,7 @@ bool CSpecialPowerShielding::validate(std::string &errorCode)
|
|||
}
|
||||
|
||||
TGameCycle endDate;
|
||||
if (!actor->canUsePower(_PowerType, (uint16)~0, endDate))
|
||||
if (!actor->canUsePower(_PowerType, std::numeric_limits<uint16>::max(), endDate))
|
||||
{
|
||||
uint16 seconds = uint16((endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep());
|
||||
uint8 minutes = uint8(seconds/60);
|
||||
|
|
|
@ -66,7 +66,7 @@ bool CSpecialPowerTaunt::validate(std::string &errorCode)
|
|||
}
|
||||
|
||||
TGameCycle endDate;
|
||||
if (!actor->canUsePower(_PowerType, (uint16)~0, endDate))
|
||||
if (!actor->canUsePower(_PowerType, std::numeric_limits<uint16>::max(), endDate))
|
||||
{
|
||||
uint16 seconds = uint16( (endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep() );
|
||||
uint8 minutes = uint8(seconds/60);
|
||||
|
|
|
@ -2611,7 +2611,7 @@ void CCharacter::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
|||
void CCharacter::setPositionToDefaultRespawnPoint()
|
||||
{
|
||||
CContinent * continent = CZoneManager::getInstance().getContinent( getX(), getY() );
|
||||
uint16 zoneId = (uint16)~0;
|
||||
uint16 zoneId = std::numeric_limits<uint16>::max();
|
||||
if( continent == 0 )
|
||||
{
|
||||
nlwarning("<CHAR_TP_TOWN: Character %s : continent null for pos %d %d", getId().toString().c_str(), getX(), getY());
|
||||
|
@ -2660,7 +2660,7 @@ void CCharacter::setPositionToDefaultRespawnPoint()
|
|||
break;
|
||||
}
|
||||
|
||||
if( zoneId != (uint16)~0 )
|
||||
if( zoneId != std::numeric_limits<uint16>::max() )
|
||||
{
|
||||
// get the tp coords
|
||||
const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone( zoneId );
|
||||
|
|
|
@ -60,7 +60,7 @@ void CPowerActivationDateVector::clearConsumable()
|
|||
{
|
||||
for(sint32 i = (sint32)PowerActivationDates.size()-1; i >= 0; --i )
|
||||
{
|
||||
if (PowerActivationDates[i].ConsumableFamilyId != (uint16)~0)
|
||||
if (PowerActivationDates[i].ConsumableFamilyId != std::numeric_limits<uint16>::max())
|
||||
{
|
||||
PowerActivationDates[i] = PowerActivationDates[PowerActivationDates.size()-1];
|
||||
PowerActivationDates.pop_back();
|
||||
|
@ -117,7 +117,7 @@ bool CPowerActivationDateVector::isPowerAllowed(POWERS::TPowerType type, uint16
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( (*it).PowerType == type || ((*it).ConsumableFamilyId != (uint16)~0 && (*it).ConsumableFamilyId == consumableFamilyId))
|
||||
if ( (*it).PowerType == type || ((*it).ConsumableFamilyId != std::numeric_limits<uint16>::max() && (*it).ConsumableFamilyId == consumableFamilyId))
|
||||
{
|
||||
endDate = (*it).ActivationDate;
|
||||
result = false;
|
||||
|
@ -195,7 +195,7 @@ void CAuraActivationDateVector::clear()
|
|||
//-----------------------------------------------------------------------------
|
||||
void CAuraActivationDateVector::disableAura(POWERS::TPowerType type, NLMISC::TGameCycle startDate, NLMISC::TGameCycle endDate, const NLMISC::CEntityId &userId)
|
||||
{
|
||||
_AuraActivationDates.push_back( CPowerActivationDate(type,(uint16)~0, startDate, endDate) );
|
||||
_AuraActivationDates.push_back( CPowerActivationDate(type, std::numeric_limits<uint16>::max(), startDate, endDate) );
|
||||
_AuraUsers.push_back(userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ struct CPowerActivationDate
|
|||
NLMISC::TGameCycle DeactivationDate;
|
||||
NLMISC::TGameCycle ActivationDate;
|
||||
|
||||
CPowerActivationDate() : PowerType(POWERS::UnknownType), ConsumableFamilyId((uint16)~0), DeactivationDate(0), ActivationDate(0)
|
||||
CPowerActivationDate() : PowerType(POWERS::UnknownType), ConsumableFamilyId(std::numeric_limits<uint16>::max()), DeactivationDate(0), ActivationDate(0)
|
||||
{}
|
||||
|
||||
CPowerActivationDate(POWERS::TPowerType type, uint16 consumableFamilyId, NLMISC::TGameCycle dateOff, NLMISC::TGameCycle dateOn) : PowerType(type), ConsumableFamilyId(consumableFamilyId), DeactivationDate(dateOff), ActivationDate(dateOn)
|
||||
|
|
Loading…
Reference in a new issue