Changed: Replace ~0u by std::numeric_limits<uint>::max()
This commit is contained in:
parent
20dac0bdf9
commit
590dfeebc1
1 changed files with 14 additions and 14 deletions
|
@ -88,7 +88,7 @@ struct SBotChatAutomatonState
|
||||||
uint On[5]; // value to return on player click of slot 0..4
|
uint On[5]; // value to return on player click of slot 0..4
|
||||||
|
|
||||||
// ctor -----------------------------------------------------------------
|
// 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<uint>::max(),uint on1=std::numeric_limits<uint>::max(),uint on2=std::numeric_limits<uint>::max(),uint on3=std::numeric_limits<uint>::max(),uint on4=std::numeric_limits<uint>::max())
|
||||||
{
|
{
|
||||||
Page=page;
|
Page=page;
|
||||||
On[0]=on0;
|
On[0]=on0;
|
||||||
|
@ -100,8 +100,8 @@ struct SBotChatAutomatonState
|
||||||
// make sure the number of arguments supplied corresponds to the
|
// make sure the number of arguments supplied corresponds to the
|
||||||
// number of options prresent on the user interfac page
|
// number of options prresent on the user interfac page
|
||||||
nlassert(page->NumOptions>=0 && page->NumOptions<=4);
|
nlassert(page->NumOptions>=0 && page->NumOptions<=4);
|
||||||
nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=~0u);
|
nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=std::numeric_limits<uint>::max());
|
||||||
nlassert(page->NumOptions==4 || On[page->NumOptions]==~0u);
|
nlassert(page->NumOptions==4 || On[page->NumOptions]==std::numeric_limits<uint>::max());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ struct CBotChat
|
||||||
|
|
||||||
void setState(uint32 state)
|
void setState(uint32 state)
|
||||||
{
|
{
|
||||||
if (state>=Automaton->Size && state!=~0u)
|
if (state>=Automaton->Size && state!=std::numeric_limits<uint32>::max())
|
||||||
{
|
{
|
||||||
nlwarning("CBotChatEntry()::setState: Invalid state: %d",state);
|
nlwarning("CBotChatEntry()::setState: Invalid state: %d",state);
|
||||||
return;
|
return;
|
||||||
|
@ -356,7 +356,7 @@ struct CBotChat
|
||||||
|
|
||||||
// open the new page
|
// open the new page
|
||||||
CurrentState=state;
|
CurrentState=state;
|
||||||
if (state==~0u)
|
if (state==std::numeric_limits<uint32>::max())
|
||||||
Done=true;
|
Done=true;
|
||||||
else
|
else
|
||||||
Done=!Automaton->States[CurrentState].Page->PageType->open(Player,Bot);
|
Done=!Automaton->States[CurrentState].Page->PageType->open(Player,Bot);
|
||||||
|
@ -377,7 +377,7 @@ struct CBotChat
|
||||||
void setAutomaton(SBotChatAutomaton *automaton)
|
void setAutomaton(SBotChatAutomaton *automaton)
|
||||||
{
|
{
|
||||||
Automaton=automaton;
|
Automaton=automaton;
|
||||||
CurrentState=~0u; // set this to a ~0 so that setState doesn't try to clse existing page
|
CurrentState=std::numeric_limits<uint32>::max(); // set this to a ~0 so that setState doesn't try to clse existing page
|
||||||
setState(0);
|
setState(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ struct CBotChat
|
||||||
|
|
||||||
void endChat ()
|
void endChat ()
|
||||||
{
|
{
|
||||||
setState(~0u);
|
setState(std::numeric_limits<uint32>::max());
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntityId Player;
|
CEntityId Player;
|
||||||
|
@ -672,7 +672,7 @@ struct SBotChatAutomatonState
|
||||||
uint On[5]; // value to return on player click of slot 0..4
|
uint On[5]; // value to return on player click of slot 0..4
|
||||||
|
|
||||||
// ctor -----------------------------------------------------------------
|
// 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<uint>::max(),uint on1=std::numeric_limits<uint>::max(),uint on2=std::numeric_limits<uint>::max(),uint on3=std::numeric_limits<uint>::max(),uint on4=std::numeric_limits<uint>::max())
|
||||||
{
|
{
|
||||||
Page=page;
|
Page=page;
|
||||||
On[0]=on0;
|
On[0]=on0;
|
||||||
|
@ -684,8 +684,8 @@ struct SBotChatAutomatonState
|
||||||
// make sure the number of arguments supplied corresponds to the
|
// make sure the number of arguments supplied corresponds to the
|
||||||
// number of options prresent on the user interfac page
|
// number of options prresent on the user interfac page
|
||||||
nlassert(page->NumOptions>=0 && page->NumOptions<=4);
|
nlassert(page->NumOptions>=0 && page->NumOptions<=4);
|
||||||
nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=~0u);
|
nlassert(page->NumOptions==0 || On[page->NumOptions-1]!=std::numeric_limits<uint>::max());
|
||||||
nlassert(page->NumOptions==4 || On[page->NumOptions]==~0u);
|
nlassert(page->NumOptions==4 || On[page->NumOptions]==std::numeric_limits<uint>::max());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -928,7 +928,7 @@ struct CBotChat
|
||||||
|
|
||||||
void setState(uint32 state)
|
void setState(uint32 state)
|
||||||
{
|
{
|
||||||
if (state>=Automaton->Size && state!=~0u)
|
if (state>=Automaton->Size && state!=std::numeric_limits<uint32>::max())
|
||||||
{
|
{
|
||||||
nlwarning("CBotChatEntry()::setState: Invalid state: %d",state);
|
nlwarning("CBotChatEntry()::setState: Invalid state: %d",state);
|
||||||
return;
|
return;
|
||||||
|
@ -940,7 +940,7 @@ struct CBotChat
|
||||||
|
|
||||||
// open the new page
|
// open the new page
|
||||||
CurrentState=state;
|
CurrentState=state;
|
||||||
if (state==~0u)
|
if (state==std::numeric_limits<uint32>::max())
|
||||||
Done=true;
|
Done=true;
|
||||||
else
|
else
|
||||||
Done=!Automaton->States[CurrentState].Page->PageType->open(Player,Bot);
|
Done=!Automaton->States[CurrentState].Page->PageType->open(Player,Bot);
|
||||||
|
@ -961,7 +961,7 @@ struct CBotChat
|
||||||
void setAutomaton(SBotChatAutomaton *automaton)
|
void setAutomaton(SBotChatAutomaton *automaton)
|
||||||
{
|
{
|
||||||
Automaton=automaton;
|
Automaton=automaton;
|
||||||
CurrentState=~0u; // set this to a ~0 so that setState doesn't try to clse existing page
|
CurrentState=std::numeric_limits<uint32>::max(); // set this to a std::numeric_limits<uint32>::max() so that setState doesn't try to clse existing page
|
||||||
setState(0);
|
setState(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -980,7 +980,7 @@ struct CBotChat
|
||||||
|
|
||||||
void endChat ()
|
void endChat ()
|
||||||
{
|
{
|
||||||
setState(~0u);
|
setState(std::numeric_limits<uint32>::max());
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntityId Player;
|
CEntityId Player;
|
||||||
|
|
Loading…
Reference in a new issue