diff --git a/Mods/vcmi/config/vcmi/chinese.json b/Mods/vcmi/config/vcmi/chinese.json index 96adec1ed..c4b70fa33 100644 --- a/Mods/vcmi/config/vcmi/chinese.json +++ b/Mods/vcmi/config/vcmi/chinese.json @@ -85,6 +85,7 @@ "vcmi.spellResearch.research" : "研究此法术", "vcmi.spellResearch.skip" : "跳过此法术", "vcmi.spellResearch.abort" : "中止", + "vcmi.spellResearch.noMoreSpells" : "没有更多的法术可供研究。", "vcmi.mainMenu.serverConnecting" : "连接中...", "vcmi.mainMenu.serverAddressEnter" : "使用地址:", diff --git a/Mods/vcmi/config/vcmi/english.json b/Mods/vcmi/config/vcmi/english.json index b6ec4f1ae..69dfe3c3b 100644 --- a/Mods/vcmi/config/vcmi/english.json +++ b/Mods/vcmi/config/vcmi/english.json @@ -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:", diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 28984167b..ea72008d7 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -2054,7 +2054,14 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition) auto cost = costBase * std::pow(town->spellResearchAcceptedCounter + 1, costExponent); std::vector> 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(ComponentType::SPELL, spell->id)); resComps.push_back(std::make_shared(ComponentType::SPELL, newSpell)); resComps.back()->newLine = true;