mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- use lambdas instead of templates for chaining ExitFromMenu's actions.
This commit is contained in:
parent
f2f095c469
commit
7887c4e80d
2 changed files with 19 additions and 28 deletions
|
@ -195,7 +195,6 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE);
|
|||
void initwaterdrip(DDukeActor* actj, DDukeActor* acti);
|
||||
int initreactor(DDukeActor* actj, DDukeActor* acti, bool isrecon);
|
||||
void spawneffector(DDukeActor* actor);
|
||||
void gameexitfrommenu();
|
||||
int startrts(int lumpNum, int localPlayer);
|
||||
|
||||
void pickrandomspot(int pn);
|
||||
|
|
|
@ -84,27 +84,6 @@ GameStats GameInterface::getStats()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
template<class func>
|
||||
void runbonus(func completion)
|
||||
{
|
||||
// MP scoreboard
|
||||
if (playerswhenstarted > 1 && !ud.coop)
|
||||
{
|
||||
dobonus(1, completion);
|
||||
}
|
||||
else completion(false);
|
||||
|
||||
}
|
||||
|
||||
template <class func>
|
||||
void runtwoscreens(func completion)
|
||||
{
|
||||
// shareware and TEN screens
|
||||
if (isShareware() && !isRR())
|
||||
showtwoscreens(completion);
|
||||
else completion(false);
|
||||
}
|
||||
|
||||
static void endthegame(bool)
|
||||
{
|
||||
endoomName = isRR() ? "redneck.bin" : !isShareware() ? "duke3d.bin" : "dukesw.bin";
|
||||
|
@ -112,14 +91,27 @@ static void endthegame(bool)
|
|||
}
|
||||
|
||||
|
||||
void gameexitfrommenu()
|
||||
{
|
||||
runbonus([](bool aborted) { runtwoscreens(endthegame); });
|
||||
}
|
||||
|
||||
void GameInterface::ExitFromMenu()
|
||||
{
|
||||
gameexitfrommenu();
|
||||
auto runbonus = [=](auto completion)
|
||||
{
|
||||
// MP scoreboard
|
||||
if (playerswhenstarted > 1 && !ud.coop)
|
||||
{
|
||||
dobonus(1, completion);
|
||||
}
|
||||
else completion(false);
|
||||
};
|
||||
|
||||
auto runtwoscreens = [](auto completion)
|
||||
{
|
||||
// shareware and TEN screens
|
||||
if (isShareware() && !isRR())
|
||||
showtwoscreens(completion);
|
||||
else completion(false);
|
||||
};
|
||||
|
||||
runbonus([=](bool aborted) { runtwoscreens(endthegame); });
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue