1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Code style: and one more pass on lambda expressions parameter list

This commit is contained in:
Arseniy Shestakov 2017-07-19 02:06:05 +03:00
parent b540ab73ed
commit 6d9f99d4de
9 changed files with 24 additions and 24 deletions

View File

@ -3740,7 +3740,7 @@ void CBonusSelection::startMap()
if(LOCPLINT) // we're currently ingame, so ask for starting new map and end game
{
GH.popInt(this);
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]()
{
updateCampaignState();
endGame();
@ -3758,7 +3758,7 @@ void CBonusSelection::startMap()
void CBonusSelection::restartMap()
{
GH.popInt(this);
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [=]()
{
updateCampaignState();
auto si = new StartInfo(startInfo);

View File

@ -2233,7 +2233,7 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
consoleMsg = (boost::format(CGI->generaltexth->allTexts[294]) % activeStack->getName()).str(); //Move %s here
}
realizeAction = [=]
realizeAction = [=]()
{
if(activeStack->doubleWide())
{
@ -2256,7 +2256,7 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
{
setBattleCursor(myNumber); //handle direction of cursor and attackable tile
setCursor = false; //don't overwrite settings from the call above //TODO: what does it mean?
realizeAction = [=]
realizeAction = [=]()
{
BattleHex attackFromHex = fromWhichHexAttack(myNumber);
if (attackFromHex >= 0) //we can be in this line when unreachable creature is L - clicked (as of revision 1308)
@ -2333,7 +2333,7 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
break;
case RISE_DEMONS:
cursorType = ECursor::SPELLBOOK;
realizeAction = [=]
realizeAction = [=]()
{
giveCommand(Battle::DAEMON_SUMMONING, myNumber, activeStack->ID);
};
@ -2395,7 +2395,7 @@ void CBattleInterface::handleHex(BattleHex myNumber, int eventType)
break;
}
realizeAction = [=]
realizeAction = [=]()
{
if (secondaryTarget) //select that target now
{
@ -2794,7 +2794,7 @@ void CBattleInterface::requestAutofightingAIToTakeAction()
{
assert(curInt->isAutoFightOn);
boost::thread aiThread([&]
boost::thread aiThread([&]()
{
auto ba = make_unique<BattleAction>(curInt->autofightingAI->activeStack(activeStack));

View File

@ -1226,8 +1226,8 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
if(isActive() && LOCPLINT->ctrlPressed())
{
LOCPLINT->showYesNoDialog("Are you sure you want to restart game?",
[]{ LOCPLINT->sendCustomEvent(RESTART_GAME); },
[]{}, true);
[](){ LOCPLINT->sendCustomEvent(RESTART_GAME); },
[](){}, true);
}
return;
case SDLK_SPACE: //space - try to revisit current object with selected hero

View File

@ -828,9 +828,9 @@ void CCastleBuildings::enterMagesGuild()
}
else
{
CFunctionList<void()> onYes = [this]{ openMagesGuild(); };
CFunctionList<void()> onYes = [this](){ openMagesGuild(); };
CFunctionList<void()> onNo = onYes;
onYes += [hero]{ LOCPLINT->cb->buyArtifact(hero, ArtifactID::SPELLBOOK); };
onYes += [hero](){ LOCPLINT->cb->buyArtifact(hero, ArtifactID::SPELLBOOK); };
std::vector<CComponent*> components(1, new CComponent(CComponent::artifact,ArtifactID::SPELLBOOK,0));
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[214], onYes, onNo, true, components);
@ -1760,7 +1760,7 @@ CBlacksmithDialog::CBlacksmithDialog(bool possible, CreatureID creMachineID, Art
cancel = new CButton(Point(224, 312), "ICANCEL.DEF", CButton::tooltip(text), [&](){ close(); }, SDLK_ESCAPE);
if(possible)
buy->addCallback([=]{ LOCPLINT->cb->buyArtifact(LOCPLINT->cb->getHero(hid),aid); });
buy->addCallback([=](){ LOCPLINT->cb->buyArtifact(LOCPLINT->cb->getHero(hid),aid); });
else
buy->block(true);

View File

@ -469,7 +469,7 @@ void CStackWindow::CWindowSection::createCommander()
if(parent->selectedSkill == index)
parent->setSelection(index, icon);
icon->callback = [=]
icon->callback = [=]()
{
parent->setSelection(index, icon);
};
@ -496,7 +496,7 @@ CIntObject * CStackWindow::createSkillEntry(int index)
const auto bonus = CGI->creh->skillRequirements[skillID-100].first;
const CStackInstance *stack = info->commander;
CCommanderSkillIcon * icon = new CCommanderSkillIcon(new CPicture(stack->bonusToGraphics(bonus)), [](){});
icon->callback = [=]
icon->callback = [=]()
{
setSelection(skillID, icon);
};

View File

@ -633,7 +633,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
const CGHeroInstance *h = owner->myHero;
GH.popInt(owner);
auto guard = vstd::makeScopeGuard([this]
auto guard = vstd::makeScopeGuard([this]()
{
owner->myInt->spellbookSettings.spellbookLastTabAdvmap = owner->selectedTab;
owner->myInt->spellbookSettings.spellbokLastPageAdvmap = owner->currentPage;

View File

@ -645,7 +645,7 @@ void CSystemOptionsWindow::setGameRes(int index)
void CSystemOptionsWindow::bquitf()
{
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this]{ closeAndPushEvent(SDL_USEREVENT, FORCE_QUIT); }, 0);
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this](){ closeAndPushEvent(SDL_USEREVENT, FORCE_QUIT); }, 0);
}
void CSystemOptionsWindow::breturnf()
@ -655,7 +655,7 @@ void CSystemOptionsWindow::breturnf()
void CSystemOptionsWindow::bmainmenuf()
{
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this]{ closeAndPushEvent(SDL_USEREVENT, RETURN_TO_MAIN_MENU); }, 0);
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this](){ closeAndPushEvent(SDL_USEREVENT, RETURN_TO_MAIN_MENU); }, 0);
}
void CSystemOptionsWindow::bloadf()
@ -672,7 +672,7 @@ void CSystemOptionsWindow::bsavef()
void CSystemOptionsWindow::brestartf()
{
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [this]{ closeAndPushEvent(SDL_USEREVENT, RESTART_GAME); }, 0);
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[67], [this](){ closeAndPushEvent(SDL_USEREVENT, RESTART_GAME); }, 0);
}
void CSystemOptionsWindow::closeAndPushEvent(int eventType, int code)
@ -985,7 +985,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
//buttons
quit = new CButton(Point(732, 567), "IOKAY.DEF", CGI->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), SDLK_RETURN);
if(queryID.getNum() > 0)
quit->addCallback([=]{ LOCPLINT->cb->selectionMade(0, queryID); });
quit->addCallback([=](){ LOCPLINT->cb->selectionMade(0, queryID); });
questlogButton[0] = new CButton(Point( 10, 44), "hsbtns4.def", CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questlog,this, 0));
questlogButton[1] = new CButton(Point(740, 44), "hsbtns4.def", CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questlog,this, 1));
@ -1348,7 +1348,7 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bo
boost::replace_first(text, "%s", CGI->generaltexth->skillName[SKILL]);
boost::replace_first(text, "%d", "2000");
confirm= new CButton(Point(148, 299), "IBY6432.DEF", CButton::tooltip(hoverText, text), [=]{makeDeal(SKILL);}, SDLK_RETURN);
confirm= new CButton(Point(148, 299), "IBY6432.DEF", CButton::tooltip(hoverText, text), [=](){makeDeal(SKILL);}, SDLK_RETURN);
confirm->block(!available);
cancel = new CButton(Point(252,299), "ICANCEL.DEF", CGI->generaltexth->zelp[631], [&](){ close(); }, SDLK_ESCAPE);
@ -1380,7 +1380,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance *visitor, const CGObjectIn
for (int i = 0; i < slotsCount; i++)
{
upgrade[i] = new CButton(Point(107 + i * 76, 171), "", CButton::tooltip(getTextForSlot(SlotID(i))), [=]{ makeDeal(SlotID(i)); }, SDLK_1 + i);
upgrade[i] = new CButton(Point(107 + i * 76, 171), "", CButton::tooltip(getTextForSlot(SlotID(i))), [=](){ makeDeal(SlotID(i)); }, SDLK_1 + i);
for (auto image : { "APHLF1R.DEF", "APHLF1Y.DEF", "APHLF1G.DEF" })
upgrade[i]->addImage(image);

View File

@ -771,7 +771,7 @@ namespace
{
validator.currentPath.push_back(JsonNode());
validator.currentPath.back().Float() = index;
auto onExit = vstd::makeScopeGuard([&]
auto onExit = vstd::makeScopeGuard([&]()
{
validator.currentPath.pop_back();
});
@ -920,7 +920,7 @@ namespace
{
validator.currentPath.push_back(JsonNode());
validator.currentPath.back().String() = nodeName;
auto onExit = vstd::makeScopeGuard([&]
auto onExit = vstd::makeScopeGuard([&]()
{
validator.currentPath.pop_back();
});

View File

@ -3806,7 +3806,7 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
StartAction startAction(ba);
sendAndApply(&startAction);
return vstd::makeScopeGuard([&]
return vstd::makeScopeGuard([&]()
{
sendAndApply(&end_action);
});