1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Removed CGI in favor of VLC. Map handle is for now global variable

This commit is contained in:
Ivan Savenko
2025-02-10 22:52:48 +00:00
parent f657e85305
commit ffd37a8fa8
106 changed files with 940 additions and 1211 deletions

View File

@ -12,7 +12,6 @@
#include "CHeroBackpackWindow.h"
#include "../CGameInfo.h"
#include "../CPlayerInterface.h"
#include "../GameEngine.h"
@ -57,7 +56,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
auto genTitle = [](const CGHeroInstance * h)
{
boost::format fmt(CGI->generaltexth->allTexts[138]);
boost::format fmt(VLC->generaltexth->allTexts[138]);
fmt % h->getNameTranslated() % h->level % h->getClassNameTranslated();
return boost::str(fmt);
};
@ -116,10 +115,10 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
primSkillAreas[g]->pos = Rect(Point(pos.x + 324, pos.y + 12 + 26 * g), Point(152, 22));
else
primSkillAreas[g]->pos = Rect(Point(pos.x + 329, pos.y + 19 + 36 * g), Point(140, 32));
primSkillAreas[g]->text = CGI->generaltexth->arraytxt[2+g];
primSkillAreas[g]->text = VLC->generaltexth->arraytxt[2+g];
primSkillAreas[g]->component = Component( ComponentType::PRIM_SKILL, PrimarySkill(g));
primSkillAreas[g]->hoverText = CGI->generaltexth->heroscrn[1];
boost::replace_first(primSkillAreas[g]->hoverText, "%s", CGI->generaltexth->primarySkillNames[g]);
primSkillAreas[g]->hoverText = VLC->generaltexth->heroscrn[1];
boost::replace_first(primSkillAreas[g]->hoverText, "%s", VLC->generaltexth->primarySkillNames[g]);
}
//heroes related thing
@ -136,21 +135,21 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
specialtyAreas[b] = std::make_shared<LRClickableAreaWText>();
specialtyAreas[b]->pos = Rect(Point(pos.x + 69 + 490 * b, pos.y + (qeLayout ? 41 : 45)), Point(32, 32));
specialtyAreas[b]->hoverText = CGI->generaltexth->heroscrn[27];
specialtyAreas[b]->hoverText = VLC->generaltexth->heroscrn[27];
specialtyAreas[b]->text = hero->getHeroType()->getSpecialtyDescriptionTranslated();
experienceAreas[b] = std::make_shared<LRClickableAreaWText>();
experienceAreas[b]->pos = Rect(Point(pos.x + 105 + 490 * b, pos.y + (qeLayout ? 41 : 45)), Point(32, 32));
experienceAreas[b]->hoverText = CGI->generaltexth->heroscrn[9];
experienceAreas[b]->text = CGI->generaltexth->allTexts[2];
experienceAreas[b]->hoverText = VLC->generaltexth->heroscrn[9];
experienceAreas[b]->text = VLC->generaltexth->allTexts[2];
boost::algorithm::replace_first(experienceAreas[b]->text, "%d", std::to_string(hero->level));
boost::algorithm::replace_first(experienceAreas[b]->text, "%d", std::to_string(CGI->heroh->reqExp(hero->level+1)));
boost::algorithm::replace_first(experienceAreas[b]->text, "%d", std::to_string(VLC->heroh->reqExp(hero->level+1)));
boost::algorithm::replace_first(experienceAreas[b]->text, "%d", std::to_string(hero->exp));
spellPointsAreas[b] = std::make_shared<LRClickableAreaWText>();
spellPointsAreas[b]->pos = Rect(Point(pos.x + 141 + 490 * b, pos.y + (qeLayout ? 41 : 45)), Point(32, 32));
spellPointsAreas[b]->hoverText = CGI->generaltexth->heroscrn[22];
spellPointsAreas[b]->text = CGI->generaltexth->allTexts[205];
spellPointsAreas[b]->hoverText = VLC->generaltexth->heroscrn[22];
spellPointsAreas[b]->text = VLC->generaltexth->allTexts[205];
boost::algorithm::replace_first(spellPointsAreas[b]->text, "%s", hero->getNameTranslated());
boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", std::to_string(hero->mana));
boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", std::to_string(hero->manaLimit()));
@ -159,12 +158,12 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
luck[b] = std::make_shared<MoraleLuckBox>(false, Rect(Point(212 + 490 * b, 39), Point(32, 32)), true);
}
quit = std::make_shared<CButton>(Point(732, 567), AnimationPath::builtin("IOKAY.DEF"), CGI->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), EShortcut::GLOBAL_ACCEPT);
quit = std::make_shared<CButton>(Point(732, 567), AnimationPath::builtin("IOKAY.DEF"), VLC->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), EShortcut::GLOBAL_ACCEPT);
if(queryID.getNum() > 0)
quit->addCallback([=](){ LOCPLINT->cb->selectionMade(0, queryID); });
questlogButton[0] = std::make_shared<CButton>(Point( 10, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this));
questlogButton[1] = std::make_shared<CButton>(Point(740, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(CGI->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this));
questlogButton[0] = std::make_shared<CButton>(Point( 10, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(VLC->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this));
questlogButton[1] = std::make_shared<CButton>(Point(740, qeLayout ? 39 : 44), AnimationPath::builtin("hsbtns4.def"), CButton::tooltip(VLC->generaltexth->heroscrn[0]), std::bind(&CExchangeWindow::questLogShortcut, this));
Rect barRect(5, 578, 725, 18);
statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), barRect, 5, 578));
@ -173,43 +172,43 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
garr = std::make_shared<CGarrisonInt>(Point(69, qeLayout ? 122 : 131), 4, Point(418,0), heroInst[0], heroInst[1], true, true);
auto splitButtonCallback = [&](){ garr->splitClick(); };
garr->addSplitBtn(std::make_shared<CButton>( Point( 10, qeLayout ? 122 : 132), AnimationPath::builtin("TSBTNS.DEF"), CButton::tooltip(CGI->generaltexth->tcommands[3]), splitButtonCallback, EShortcut::HERO_ARMY_SPLIT));
garr->addSplitBtn(std::make_shared<CButton>( Point(744, qeLayout ? 122 : 132), AnimationPath::builtin("TSBTNS.DEF"), CButton::tooltip(CGI->generaltexth->tcommands[3]), splitButtonCallback, EShortcut::HERO_ARMY_SPLIT));
garr->addSplitBtn(std::make_shared<CButton>( Point( 10, qeLayout ? 122 : 132), AnimationPath::builtin("TSBTNS.DEF"), CButton::tooltip(VLC->generaltexth->tcommands[3]), splitButtonCallback, EShortcut::HERO_ARMY_SPLIT));
garr->addSplitBtn(std::make_shared<CButton>( Point(744, qeLayout ? 122 : 132), AnimationPath::builtin("TSBTNS.DEF"), CButton::tooltip(VLC->generaltexth->tcommands[3]), splitButtonCallback, EShortcut::HERO_ARMY_SPLIT));
if(qeLayout)
{
buttonMoveUnitsFromLeftToRight = std::make_shared<CButton>(
Point(325, 118),
AnimationPath::builtin("quick-exchange/armRight.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveAllUnits")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.moveAllUnits")),
[this](){ this->moveUnitsShortcut(true); });
buttonMoveUnitsFromRightToLeft = std::make_shared<CButton>(
Point(425, 118),
AnimationPath::builtin("quick-exchange/armLeft.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveAllUnits")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.moveAllUnits")),
[this](){ this->moveUnitsShortcut(false); });
buttonMoveArtifactsFromLeftToRight = std::make_shared<CButton>(
Point(325, 154), AnimationPath::builtin("quick-exchange/artRight.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveAllArtifacts")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.moveAllArtifacts")),
[this](){ this->moveArtifactsCallback(true);});
buttonMoveArtifactsFromRightToLeft = std::make_shared<CButton>(
Point(425, 154), AnimationPath::builtin("quick-exchange/artLeft.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveAllArtifacts")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.moveAllArtifacts")),
[this](){ this->moveArtifactsCallback(false);});
exchangeUnitsButton = std::make_shared<CButton>(
Point(377, 118),
AnimationPath::builtin("quick-exchange/swapAll.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.swapAllUnits")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.swapAllUnits")),
[this](){ controller.swapArmy(); });
exchangeArtifactsButton = std::make_shared<CButton>(
Point(377, 154),
AnimationPath::builtin("quick-exchange/swapAll.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.swapAllArtifacts")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.swapAllArtifacts")),
[this](){ this->swapArtifactsCallback(); });
backpackButtonLeft = std::make_shared<CButton>(
@ -247,7 +246,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
std::make_shared<CButton>(
Point(484 + 35 * i, 154),
AnimationPath::builtin("quick-exchange/unitLeft.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveUnit")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.moveUnit")),
[this, i]() { creatureArrowButtonCallback(false, SlotID(i)); }));
moveUnitFromRightToLeftButtons.back()->block(leftHeroBlock);
@ -255,7 +254,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
std::make_shared<CButton>(
Point(66 + 35 * i, 154),
AnimationPath::builtin("quick-exchange/unitRight.DEF"),
CButton::tooltip(CGI->generaltexth->translate("vcmi.quickExchange.moveUnit")),
CButton::tooltip(VLC->generaltexth->translate("vcmi.quickExchange.moveUnit")),
[this, i]() { creatureArrowButtonCallback(true, SlotID(i)); }));
moveUnitFromLeftToRightButtons.back()->block(rightHeroBlock);
}