mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-15 13:33:36 +02:00
fix spell research crash when no more spells can be researched due to map limit
This commit is contained in:
parent
0983a1a32f
commit
2621d4f5bf
@ -85,6 +85,7 @@
|
||||
"vcmi.spellResearch.research" : "研究此法术",
|
||||
"vcmi.spellResearch.skip" : "跳过此法术",
|
||||
"vcmi.spellResearch.abort" : "中止",
|
||||
"vcmi.spellResearch.noMoreSpells" : "没有更多的法术可供研究。",
|
||||
|
||||
"vcmi.mainMenu.serverConnecting" : "连接中...",
|
||||
"vcmi.mainMenu.serverAddressEnter" : "使用地址:",
|
||||
|
@ -85,6 +85,7 @@
|
||||
"vcmi.spellResearch.research" : "Research this Spell",
|
||||
"vcmi.spellResearch.skip" : "Skip this Spell",
|
||||
"vcmi.spellResearch.abort" : "Abort",
|
||||
"vcmi.spellResearch.noMoreSpells" : "There are no more spells available for research.",
|
||||
|
||||
"vcmi.mainMenu.serverConnecting" : "Connecting...",
|
||||
"vcmi.mainMenu.serverAddressEnter" : "Enter address:",
|
||||
|
@ -2054,7 +2054,14 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition)
|
||||
auto cost = costBase * std::pow(town->spellResearchAcceptedCounter + 1, costExponent);
|
||||
|
||||
std::vector<std::shared_ptr<CComponent>> resComps;
|
||||
auto newSpell = town->spells[level].at(town->spellsAtLevel(level, false));
|
||||
|
||||
int index = town->spellsAtLevel(level, false);
|
||||
if (index >= town->spells[level].size())
|
||||
{
|
||||
LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.spellResearch.noMoreSpells"));
|
||||
return;
|
||||
}
|
||||
auto newSpell = town->spells[level].at(index);
|
||||
resComps.push_back(std::make_shared<CComponent>(ComponentType::SPELL, spell->id));
|
||||
resComps.push_back(std::make_shared<CComponent>(ComponentType::SPELL, newSpell));
|
||||
resComps.back()->newLine = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user