From 120aa0fee43630c62c7051e992530131d1b00b2d Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 23 Dec 2015 15:30:12 +0100 Subject: [PATCH] Changed: Replace ~0u by std::numeric_limits::max() --- .../src/ai_service/bot_chat_interface.cpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/code/ryzom/server/src/ai_service/bot_chat_interface.cpp b/code/ryzom/server/src/ai_service/bot_chat_interface.cpp index 4676eac84..36dc9aa42 100644 --- a/code/ryzom/server/src/ai_service/bot_chat_interface.cpp +++ b/code/ryzom/server/src/ai_service/bot_chat_interface.cpp @@ -88,7 +88,7 @@ struct SBotChatAutomatonState uint On[5]; // value to return on player click of slot 0..4 // ctor ----------------------------------------------------------------- - SBotChatAutomatonState(SBotChatPage *page,uint on0=~0u,uint on1=~0u,uint on2=~0u,uint on3=~0u,uint on4=~0u) + SBotChatAutomatonState(SBotChatPage *page,uint on0=std::numeric_limits::max(),uint on1=std::numeric_limits::max(),uint on2=std::numeric_limits::max(),uint on3=std::numeric_limits::max(),uint on4=std::numeric_limits::max()) { Page=page; On[0]=on0; @@ -100,8 +100,8 @@ struct SBotChatAutomatonState // make sure the number of arguments supplied corresponds to the // number of options prresent on the user interfac page nlassert(page->NumOptions>=0 && page->NumOptions<=4); - nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=~0u); - nlassert(page->NumOptions==4 || On[page->NumOptions]==~0u); + nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=std::numeric_limits::max()); + nlassert(page->NumOptions==4 || On[page->NumOptions]==std::numeric_limits::max()); } }; @@ -344,7 +344,7 @@ struct CBotChat void setState(uint32 state) { - if (state>=Automaton->Size && state!=~0u) + if (state>=Automaton->Size && state!=std::numeric_limits::max()) { nlwarning("CBotChatEntry()::setState: Invalid state: %d",state); return; @@ -356,7 +356,7 @@ struct CBotChat // open the new page CurrentState=state; - if (state==~0u) + if (state==std::numeric_limits::max()) Done=true; else Done=!Automaton->States[CurrentState].Page->PageType->open(Player,Bot); @@ -377,7 +377,7 @@ struct CBotChat void setAutomaton(SBotChatAutomaton *automaton) { Automaton=automaton; - CurrentState=~0u; // set this to a ~0 so that setState doesn't try to clse existing page + CurrentState=std::numeric_limits::max(); // set this to a ~0 so that setState doesn't try to clse existing page setState(0); } @@ -396,7 +396,7 @@ struct CBotChat void endChat () { - setState(~0u); + setState(std::numeric_limits::max()); } CEntityId Player; @@ -672,7 +672,7 @@ struct SBotChatAutomatonState uint On[5]; // value to return on player click of slot 0..4 // ctor ----------------------------------------------------------------- - SBotChatAutomatonState(SBotChatPage *page,uint on0=~0u,uint on1=~0u,uint on2=~0u,uint on3=~0u,uint on4=~0u) + SBotChatAutomatonState(SBotChatPage *page,uint on0=std::numeric_limits::max(),uint on1=std::numeric_limits::max(),uint on2=std::numeric_limits::max(),uint on3=std::numeric_limits::max(),uint on4=std::numeric_limits::max()) { Page=page; On[0]=on0; @@ -684,8 +684,8 @@ struct SBotChatAutomatonState // make sure the number of arguments supplied corresponds to the // number of options prresent on the user interfac page nlassert(page->NumOptions>=0 && page->NumOptions<=4); - nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=~0u); - nlassert(page->NumOptions==4 || On[page->NumOptions]==~0u); + nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=std::numeric_limits::max()); + nlassert(page->NumOptions==4 || On[page->NumOptions]==std::numeric_limits::max()); } }; @@ -928,7 +928,7 @@ struct CBotChat void setState(uint32 state) { - if (state>=Automaton->Size && state!=~0u) + if (state>=Automaton->Size && state!=std::numeric_limits::max()) { nlwarning("CBotChatEntry()::setState: Invalid state: %d",state); return; @@ -940,7 +940,7 @@ struct CBotChat // open the new page CurrentState=state; - if (state==~0u) + if (state==std::numeric_limits::max()) Done=true; else Done=!Automaton->States[CurrentState].Page->PageType->open(Player,Bot); @@ -961,7 +961,7 @@ struct CBotChat void setAutomaton(SBotChatAutomaton *automaton) { Automaton=automaton; - CurrentState=~0u; // set this to a ~0 so that setState doesn't try to clse existing page + CurrentState=std::numeric_limits::max(); // set this to a std::numeric_limits::max() so that setState doesn't try to clse existing page setState(0); } @@ -980,7 +980,7 @@ struct CBotChat void endChat () { - setState(~0u); + setState(std::numeric_limits::max()); } CEntityId Player;