1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-18 03:21:27 +02:00

code review + text

This commit is contained in:
Laserlicht 2024-09-28 16:10:03 +02:00
parent f94f0a3274
commit 8461189e95
4 changed files with 12 additions and 12 deletions

View File

@ -176,7 +176,7 @@ void ApplyClientNetPackVisitor::visitSetMovePoints(SetMovePoints & pack)
void ApplyClientNetPackVisitor::visitSetResearchedSpells(SetResearchedSpells & pack)
{
for(const auto & win : GH.windows().findWindows<CMageGuildScreen>())
win->updateSpells();
win->updateSpells(pack.tid);
}
void ApplyClientNetPackVisitor::visitFoWChange(FoWChange & pack)

View File

@ -1982,11 +1982,14 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner, const ImagePath & i
exit = std::make_shared<CButton>(Point(748, 556), AnimationPath::builtin("TPMAGE1.DEF"), CButton::tooltip(CGI->generaltexth->allTexts[593]), [&](){ close(); }, EShortcut::GLOBAL_RETURN);
updateSpells();
updateSpells(townId);
}
void CMageGuildScreen::updateSpells()
void CMageGuildScreen::updateSpells(ObjectInstanceID tID)
{
if(tID != townId)
return;
OBJECT_CONSTRUCTION;
static const std::vector<std::vector<Point> > positions =
{
@ -2063,15 +2066,12 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition)
pom.emplace_back(AnimationPath::builtin("ibuy30.DEF"), nullptr);
pom.emplace_back(AnimationPath::builtin("hsbtns4.DEF"), nullptr);
pom.emplace_back(AnimationPath::builtin("ICANCEL.DEF"), nullptr);
auto temp = std::make_shared<CInfoWindow>(CGI->generaltexth->translate("vcmi.spellResearch.pay"), LOCPLINT->playerID, resComps, pom);
auto text = CGI->generaltexth->translate(LOCPLINT->cb->getResourceAmount().canAfford(cost) ? "vcmi.spellResearch.pay" : "vcmi.spellResearch.canNotAfford");
auto temp = std::make_shared<CInfoWindow>(text, LOCPLINT->playerID, resComps, pom);
temp->buttons[0]->addCallback([this, resComps, town, cost](){
if(LOCPLINT->cb->getResourceAmount().canAfford(cost))
LOCPLINT->cb->spellResearch(town, spell->id, true);
else
LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.spellResearch.canNotAfford"), resComps);
});
temp->buttons[0]->addCallback([this, resComps, town, cost](){ LOCPLINT->cb->spellResearch(town, spell->id, true); });
temp->buttons[0]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.research")); });
temp->buttons[0]->setEnabled(LOCPLINT->cb->getResourceAmount().canAfford(cost));
temp->buttons[1]->addCallback([this, town](){ LOCPLINT->cb->spellResearch(town, spell->id, false); });
temp->buttons[1]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.skip")); });
temp->buttons[2]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.abort")); });

View File

@ -398,7 +398,7 @@ class CMageGuildScreen : public CStatusbarWindow
public:
CMageGuildScreen(CCastleInterface * owner, const ImagePath & image);
void updateSpells();
void updateSpells(ObjectInstanceID tID);
};
/// The blacksmith window where you can buy available in town war machine

View File

@ -319,7 +319,7 @@
// Costs depends on level for an spell research
"spellResearchCostPerLevel": { "wood" : 2, "mercury": 2, "ore": 2, "sulfur": 2, "crystal": 2, "gems": 2 },
// Exponent for increasing cost for each research
"spellResearchCostExponentPerResearch": 1.5
"spellResearchCostExponentPerResearch": 1.25
},
"combat":