mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 09:36:43 +00:00
Cleanup, replaced if with switch
This commit is contained in:
parent
08f8701b33
commit
3cc81d74bc
1 changed files with 48 additions and 62 deletions
|
@ -180,71 +180,57 @@ void WindowManager::updateVisible()
|
||||||
// Mouse is visible whenever we're not in game mode
|
// Mouse is visible whenever we're not in game mode
|
||||||
MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
|
MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
|
||||||
|
|
||||||
// If in game mode, don't show anything.
|
int eff;
|
||||||
if(mode == GM_Game) //Use a switch/case structure
|
switch(mode) {
|
||||||
{
|
case GM_Game:
|
||||||
return;
|
// If in game mode, don't show anything.
|
||||||
}
|
break;
|
||||||
|
case GM_MainMenu:
|
||||||
|
menu->setVisible(true);
|
||||||
|
break;
|
||||||
|
case GM_Console:
|
||||||
|
console->enable();
|
||||||
|
break;
|
||||||
|
case GM_Name:
|
||||||
|
case GM_Race:
|
||||||
|
case GM_Class:
|
||||||
|
case GM_ClassPick:
|
||||||
|
case GM_ClassCreate:
|
||||||
|
case GM_Birth:
|
||||||
|
case GM_ClassGenerate:
|
||||||
|
case GM_Review:
|
||||||
|
mCharGen->spawnDialog(mode);
|
||||||
|
break;
|
||||||
|
case GM_Inventory:
|
||||||
|
// First, compute the effective set of windows to show.
|
||||||
|
// This is controlled both by what windows the
|
||||||
|
// user has opened/closed (the 'shown' variable) and by what
|
||||||
|
// windows we are allowed to show (the 'allowed' var.)
|
||||||
|
eff = shown & allowed;
|
||||||
|
|
||||||
if(mode == GM_MainMenu)
|
// Show the windows we want
|
||||||
{
|
map -> setVisible( (eff & GW_Map) != 0 );
|
||||||
// Enable the main menu
|
stats -> setVisible( (eff & GW_Stats) != 0 );
|
||||||
menu->setVisible(true);
|
break;
|
||||||
return;
|
case GM_Dialogue:
|
||||||
}
|
dialogueWindow->open();
|
||||||
|
break;
|
||||||
if(mode == GM_Console)
|
case GM_InterMessageBox:
|
||||||
{
|
if(!mMessageBoxManager->isInteractiveMessageBox()) {
|
||||||
console->enable();
|
setGuiMode(GM_Game);
|
||||||
return;
|
}
|
||||||
}
|
break;
|
||||||
|
case GM_Journal:
|
||||||
//There must be a more elegant solution
|
mJournal->setVisible(true);
|
||||||
if (mode == GM_Name || mode == GM_Race || mode == GM_Class || mode == GM_ClassPick || mode == GM_ClassCreate || mode == GM_Birth || mode == GM_ClassGenerate || mode == GM_Review)
|
mJournal->open();
|
||||||
{
|
break;
|
||||||
mCharGen->spawnDialog(mode);
|
default:
|
||||||
return;
|
// Unsupported mode, switch back to game
|
||||||
}
|
// Note: The call will eventually end up this method again but
|
||||||
|
// will stop at the check if mode is GM_Game.
|
||||||
if(mode == GM_Inventory)
|
|
||||||
{
|
|
||||||
// Ah, inventory mode. First, compute the effective set of
|
|
||||||
// windows to show. This is controlled both by what windows the
|
|
||||||
// user has opened/closed (the 'shown' variable) and by what
|
|
||||||
// windows we are allowed to show (the 'allowed' var.)
|
|
||||||
int eff = shown & allowed;
|
|
||||||
|
|
||||||
// Show the windows we want
|
|
||||||
map -> setVisible( (eff & GW_Map) != 0 );
|
|
||||||
stats -> setVisible( (eff & GW_Stats) != 0 );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_Dialogue)
|
|
||||||
{
|
|
||||||
dialogueWindow->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mode == GM_InterMessageBox)
|
|
||||||
{
|
|
||||||
if(!mMessageBoxManager->isInteractiveMessageBox()) {
|
|
||||||
setGuiMode(GM_Game);
|
setGuiMode(GM_Game);
|
||||||
}
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == GM_Journal)
|
|
||||||
{
|
|
||||||
mJournal->setVisible(true);
|
|
||||||
mJournal->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unsupported mode, switch back to game
|
|
||||||
// Note: The call will eventually end up this method again but
|
|
||||||
// will stop at the check if(mode == GM_Game) above.
|
|
||||||
setGuiMode(GM_Game);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
||||||
|
|
Loading…
Reference in a new issue