diff --git a/code/ryzom/common/src/game_share/persistent_data.cpp b/code/ryzom/common/src/game_share/persistent_data.cpp index 9d8f8a893..dffbfa7ed 100644 --- a/code/ryzom/common/src/game_share/persistent_data.cpp +++ b/code/ryzom/common/src/game_share/persistent_data.cpp @@ -277,7 +277,7 @@ uint16 CPersistentDataRecord::addString(const string& name) uint16 result= (uint16)_StringTable.size(); _StringTable.push_back(name); - BOMB_IF(result==(uint16)~0u,"No more room in string table!!!",_StringTable.pop_back()); + BOMB_IF(result==std::numeric_limits::max(),"No more room in string table!!!",_StringTable.pop_back()); return result; } } diff --git a/code/ryzom/common/src/game_share/persistent_data_tree.cpp b/code/ryzom/common/src/game_share/persistent_data_tree.cpp index 58b029a66..156e4177f 100644 --- a/code/ryzom/common/src/game_share/persistent_data_tree.cpp +++ b/code/ryzom/common/src/game_share/persistent_data_tree.cpp @@ -133,7 +133,7 @@ CPersistentDataTreeNode::CPersistentDataTreeNode(const NLMISC::CSString& name,CP bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent) { - return attachToParent(parent,parent==NULL?~0u:(uint32)parent->_Children.size()); + return attachToParent(parent,parent==NULL?std::numeric_limits::max():(uint32)parent->_Children.size()); } bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent,uint32 idx) @@ -216,8 +216,8 @@ bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent,uin bool CPersistentDataTreeNode::readFromPdr(CPersistentDataRecord& pdr) { - static uint16 mapKeyToken= (uint16)~0u; pdr.addString("__Key__",mapKeyToken); - static uint16 mapValToken= (uint16)~0u; pdr.addString("__Val__",mapValToken); + static uint16 mapKeyToken= std::numeric_limits::max(); pdr.addString("__Key__",mapKeyToken); + static uint16 mapValToken= std::numeric_limits::max(); pdr.addString("__Val__",mapValToken); while (!pdr.isEndOfData()) { @@ -378,8 +378,8 @@ bool CPersistentDataTreeNode::writeToPdr(CPersistentDataRecord& pdr) const // if this is a map entry then split into map key and value if (isMapEntry()) { - static uint16 mapKeyToken= (uint16)~0u; pdr.addString("__Key__",mapKeyToken); - static uint16 mapValToken= (uint16)~0u; pdr.addString("__Val__",mapValToken); + static uint16 mapKeyToken= std::numeric_limits::max(); pdr.addString("__Key__",mapKeyToken); + static uint16 mapValToken= std::numeric_limits::max(); pdr.addString("__Val__",mapValToken); // write a value - try to match a reasonably compact format if one exists pdrPushCompactValue(pdr,mapKeyToken,name); diff --git a/code/ryzom/common/src/game_share/property_allocator_client.cpp b/code/ryzom/common/src/game_share/property_allocator_client.cpp index b5cd00200..f4c3c340f 100644 --- a/code/ryzom/common/src/game_share/property_allocator_client.cpp +++ b/code/ryzom/common/src/game_share/property_allocator_client.cpp @@ -44,7 +44,7 @@ void CPropertyAllocatorClient::allocProperty( if ( ! (propinfo.allocated() || propinfo.Pending) ) { // Send alloc request to the local Mirror Service - if ( _LocalMSId != TServiceId(~0) ) + if ( _LocalMSId != TServiceId(std::numeric_limits::max()) ) { // Check options if ( (options & PSOReadOnly) && (options & PSOWriteOnly) ) diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index a8744e8bf..1db870ca9 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -402,10 +402,10 @@ public: CAnimationSession() { WeatherValue = 0; // auto weather - CurrSeason = ~0; + CurrSeason = std::numeric_limits::max(); StartingAct = false; InitialAct = 1; - AiInstance = ~0;//wrong value + AiInstance = std::numeric_limits::max(); //wrong value DateOfLastNewLocation = 0; InitialX = 0; @@ -3578,7 +3578,7 @@ TSessionId CServerAnimationModule::getScenarioId(uint32 charId) { return found->second; } - return TSessionId(~0u); + return TSessionId(std::numeric_limits::max()); } void CServerAnimationModule::disconnectChar(TCharId charId) @@ -3651,7 +3651,7 @@ void CServerAnimationModule::scheduleStartSessionImpl(const CAnimationMessageAni nlinfo("R2An: Char %u is connected as animator", *first); } } - session->CurrSeason = ~0; + session->CurrSeason = std::numeric_limits::max(); } diff --git a/code/ryzom/common/src/game_share/time_weather_season/weather_predict.cpp b/code/ryzom/common/src/game_share/time_weather_season/weather_predict.cpp index 7526eb74f..30f7e6ed2 100644 --- a/code/ryzom/common/src/game_share/time_weather_season/weather_predict.cpp +++ b/code/ryzom/common/src/game_share/time_weather_season/weather_predict.cpp @@ -268,7 +268,7 @@ float CPredictWeather::predictWeather(uint64 day, float hour, const CWeatherFunc static const CFctCtrlPoint *lastFct; static uint lastNumPoints; static CWeatherFunctionParamsSheetBase lastDesc; - static uint64 lastCycle = ~0; + static uint64 lastCycle = std::numeric_limits::max(); static EWeatherCycleType weatherCycle = HighPressure; static const CWeatherFunction *lastWf = NULL; diff --git a/code/ryzom/common/src/game_share/utils.cpp b/code/ryzom/common/src/game_share/utils.cpp index b5d443559..3601acef6 100644 --- a/code/ryzom/common/src/game_share/utils.cpp +++ b/code/ryzom/common/src/game_share/utils.cpp @@ -62,7 +62,7 @@ CSString cleanPath(const CSString& path,bool addTrailingSlash) break; } // if we found an element then remove it and the '..' as well - if (j!=~0u) + if (j!=std::numeric_limits::max()) { pathComponents[j].clear(); pathComponents[i].clear();