mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Replace if.. by switch
This commit is contained in:
parent
fc37ddd017
commit
6f028085ac
101
src/event.cxx
101
src/event.cxx
@ -4938,89 +4938,86 @@ bool CEvent::TreatEventBase (const SDL_Event &event)
|
|||||||
m_pSound->SetSuspendSkip (1);
|
m_pSound->SetSuspendSkip (1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (m_phase == WM_PHASE_PLAY ||
|
|
||||||
m_phase == WM_PHASE_SETUP ||
|
switch (m_phase)
|
||||||
m_phase == WM_PHASE_SETUPp ||
|
|
||||||
m_phase == WM_PHASE_READ ||
|
|
||||||
m_phase == WM_PHASE_WRITE ||
|
|
||||||
m_phase == WM_PHASE_WRITEp ||
|
|
||||||
m_phase == WM_PHASE_HELP)
|
|
||||||
{
|
{
|
||||||
|
case WM_PHASE_PLAY:
|
||||||
|
case WM_PHASE_SETUP:
|
||||||
|
case WM_PHASE_SETUPp:
|
||||||
|
case WM_PHASE_READ:
|
||||||
|
case WM_PHASE_WRITE:
|
||||||
|
case WM_PHASE_WRITEp:
|
||||||
|
case WM_PHASE_HELP:
|
||||||
ChangePhase (WM_PHASE_STOP);
|
ChangePhase (WM_PHASE_STOP);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_STOP ||
|
case WM_PHASE_STOP:
|
||||||
m_phase == WM_PHASE_LOST ||
|
case WM_PHASE_LOST:
|
||||||
m_phase == WM_PHASE_BUILD)
|
case WM_PHASE_BUILD:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_INFO);
|
ChangePhase (WM_PHASE_INFO);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if ( m_phase == WM_PHASE_INFO
|
case WM_PHASE_INFO:
|
||||||
|| m_phase == WM_PHASE_SETTINGS)
|
case WM_PHASE_SETTINGS:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_INIT);
|
ChangePhase (WM_PHASE_INIT);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_BUTTON ||
|
case WM_PHASE_BUTTON:
|
||||||
m_phase == WM_PHASE_TERM ||
|
case WM_PHASE_TERM:
|
||||||
m_phase == WM_PHASE_MUSIC ||
|
case WM_PHASE_MUSIC:
|
||||||
m_phase == WM_PHASE_REGION)
|
case WM_PHASE_REGION:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_BUILD);
|
ChangePhase (WM_PHASE_BUILD);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_INIT)
|
case WM_PHASE_INIT:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_BYE);
|
ChangePhase (WM_PHASE_BYE);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_BYE)
|
case WM_PHASE_BYE:
|
||||||
{
|
{
|
||||||
SDL_Event ev;
|
SDL_Event ev;
|
||||||
ev.type = SDL_QUIT;
|
ev.type = SDL_QUIT;
|
||||||
SDL_PushEvent (&ev);
|
SDL_PushEvent (&ev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case SDLK_RETURN:
|
case SDLK_RETURN:
|
||||||
if (m_phase == WM_PHASE_SETTINGS)
|
switch (m_phase)
|
||||||
{
|
{
|
||||||
|
case WM_PHASE_SETTINGS:
|
||||||
ChangePhase (WM_PHASE_INIT);
|
ChangePhase (WM_PHASE_INIT);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_PLAY ||
|
case WM_PHASE_PLAY:
|
||||||
m_phase == WM_PHASE_READ ||
|
case WM_PHASE_READ:
|
||||||
m_phase == WM_PHASE_WRITE ||
|
case WM_PHASE_WRITE:
|
||||||
m_phase == WM_PHASE_SETUP)
|
case WM_PHASE_SETUP:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_STOP);
|
ChangePhase (WM_PHASE_STOP);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_INIT ||
|
case WM_PHASE_INIT:
|
||||||
m_phase == WM_PHASE_LOST ||
|
case WM_PHASE_LOST:
|
||||||
m_phase == WM_PHASE_BUILD)
|
case WM_PHASE_BUILD:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_INFO);
|
ChangePhase (WM_PHASE_INFO);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_INFO ||
|
case WM_PHASE_INFO:
|
||||||
m_phase == WM_PHASE_STOP ||
|
case WM_PHASE_STOP:
|
||||||
m_phase == WM_PHASE_HELP ||
|
case WM_PHASE_HELP:
|
||||||
m_phase == WM_PHASE_SETUPp ||
|
case WM_PHASE_SETUPp:
|
||||||
m_phase == WM_PHASE_WRITEp)
|
case WM_PHASE_WRITEp:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_PLAY);
|
ChangePhase (WM_PHASE_PLAY);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (m_phase == WM_PHASE_BUTTON ||
|
case WM_PHASE_BUTTON:
|
||||||
m_phase == WM_PHASE_TERM ||
|
case WM_PHASE_TERM:
|
||||||
m_phase == WM_PHASE_MUSIC ||
|
case WM_PHASE_MUSIC:
|
||||||
m_phase == WM_PHASE_REGION)
|
case WM_PHASE_REGION:
|
||||||
{
|
|
||||||
ChangePhase (WM_PHASE_BUILD);
|
ChangePhase (WM_PHASE_BUILD);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case SDLK_LEFT:
|
case SDLK_LEFT:
|
||||||
case SDLK_RIGHT:
|
case SDLK_RIGHT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user