diff --git a/Mods/vcmi/Content/config/english.json b/Mods/vcmi/Content/config/english.json index 0b4a22d92..1c18ea354 100644 --- a/Mods/vcmi/Content/config/english.json +++ b/Mods/vcmi/Content/config/english.json @@ -416,7 +416,6 @@ "vcmi.townStructure.bank.borrow" : "You enter the bank. A banker sees you and says: \"We have made a special offer for you. You can take a loan of 2500 gold from us for 5 days. You will have to repay 500 gold every day.\"", "vcmi.townStructure.bank.payBack" : "You enter the bank. A banker sees you and says: \"You have already got your loan. Pay it back before taking a new one.\"", - "vcmi.townWindow.upgradeAll.upgradable" : "Do you want to upgrade following creatures?", "vcmi.townWindow.upgradeAll.notAllUpgradable" : "Not enough resources to upgrade all creatures. Do you want to upgrade following creatures?", "vcmi.townWindow.upgradeAll.notUpgradable" : "Not enough resources to upgrade any creature.", diff --git a/Mods/vcmi/Content/config/german.json b/Mods/vcmi/Content/config/german.json index ff9ba71f0..a8386dd6a 100644 --- a/Mods/vcmi/Content/config/german.json +++ b/Mods/vcmi/Content/config/german.json @@ -416,7 +416,6 @@ "vcmi.townStructure.bank.borrow" : "Ihr betretet die Bank. Ein Bankangestellter sieht Euch und sagt: \"Wir haben ein spezielles Angebot für Euch gemacht. Ihr könnt bei uns einen Kredit von 2500 Gold für 5 Tage aufnehmen. Ihr werdet jeden Tag 500 Gold zurückzahlen müssen.\"", "vcmi.townStructure.bank.payBack" : "Ihr betretet die Bank. Ein Bankangestellter sieht Euch und sagt: \"Ihr habt Euren Kredit bereits erhalten. Zahlt Ihn ihn zurück, bevor Ihr einen neuen aufnehmt.\"", - "vcmi.townWindow.upgradeAll.upgradable" : "Folgende Kreaturen aufrüsten?", "vcmi.townWindow.upgradeAll.notAllUpgradable" : "Nicht genügend Ressourcen um alle Kreaturen aufzurüsten. Folgende Kreaturen aufrüsten?", "vcmi.townWindow.upgradeAll.notUpgradable" : "Nicht genügend Ressourcen um mindestens eine Kreatur aufzurüsten.", diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 4022c8ae3..8e002c3bc 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -399,9 +399,9 @@ void CHeroGSlot::gesture(bool on, const Point & initialPosition, const Point & f resComps.push_back(std::make_shared(ComponentType::RESOURCE, i->resType, i->resVal)); resComps.back()->newLine = true; for(auto & upgradeInfo : upgradableSlots.upgradeInfos) - resComps.push_back(std::make_shared(ComponentType::CREATURE, upgradeInfo.second.getUpgrade(), std::nullopt)); + resComps.push_back(std::make_shared(ComponentType::CREATURE, upgradeInfo.second.getUpgrade(), obj->Slots().at(upgradeInfo.first)->count)); - std::string textID = upgradableSlots.canAffordAll ? "vcmi.townWindow.upgradeAll.upgradable" : "vcmi.townWindow.upgradeAll.notAllUpgradable"; + std::string textID = upgradableSlots.canAffordAll ? "core.genrltxt.207" : "vcmi.townWindow.upgradeAll.notAllUpgradable"; LOCPLINT->showYesNoDialog(CGI->generaltexth->translate(textID), [upgradableSlots, obj](){ for(auto & upgradeInfo : upgradableSlots.upgradeInfos) @@ -436,19 +436,15 @@ void CHeroGSlot::gesture(bool on, const Point & initialPosition, const Point & f { RadialMenuConfig::ITEM_NE, twoHeroes, "stackSplitDialog", "vcmi.radialWheel.heroSwapArmy", [heroId, heroOtherId](){CExchangeController(heroId, heroOtherId).swapArmy();} }, { RadialMenuConfig::ITEM_EE, twoHeroes, "tradeHeroes", "vcmi.radialWheel.heroExchange", [heroId, heroOtherId](){LOCPLINT->showHeroExchange(heroId, heroOtherId);} }, { RadialMenuConfig::ITEM_SW, twoHeroes, "moveArtifacts", "vcmi.radialWheel.heroGetArtifacts", [heroId, heroOtherId](){CExchangeController(heroId, heroOtherId).moveArtifacts(false, true, true);} }, - { RadialMenuConfig::ITEM_SE, twoHeroes, "swapArtifacts", "vcmi.radialWheel.heroSwapArtifacts", [heroId, heroOtherId](){CExchangeController(heroId, heroOtherId).swapArtifacts(true, true);} }, - { RadialMenuConfig::ITEM_WW, true, !upgradableSlots.isCreatureUpgradePossible ? "dismissHero" : "upgradeCreatures", !upgradableSlots.isCreatureUpgradePossible ? "vcmi.radialWheel.heroDismiss" : "vcmi.radialWheel.upgradeCreatures", [this, upgradableSlots, upgradeAll]() - { - if(upgradableSlots.isCreatureUpgradePossible) - upgradeAll(); - else - { - CFunctionList ony = [=](){ }; - ony += [=](){ LOCPLINT->cb->dismissHero(hero); }; - LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[22], ony, nullptr); - } - } }, + { RadialMenuConfig::ITEM_SE, twoHeroes, "swapArtifacts", "vcmi.radialWheel.heroSwapArtifacts", [heroId, heroOtherId](){CExchangeController(heroId, heroOtherId).swapArtifacts(true, true);} } }; + RadialMenuConfig upgradeSlot = { RadialMenuConfig::ITEM_WW, true, "upgradeCreatures", "vcmi.radialWheel.upgradeCreatures", [upgradeAll](){ upgradeAll(); } }; + RadialMenuConfig dismissSlot = { RadialMenuConfig::ITEM_WW, true, "dismissHero", "vcmi.radialWheel.heroDismiss", [this](){ LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[22], [=](){ LOCPLINT->cb->dismissHero(hero); }, nullptr); } }; + + if(upgradableSlots.isCreatureUpgradePossible) + menuElements.push_back(upgradeSlot); + else + menuElements.push_back(dismissSlot); GH.windows().createAndPushWindow(pos.center(), menuElements); }