From a8d25ea7b2b149dbf0967130f3ee1aa697a62ff9 Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Fri, 28 Oct 2016 13:27:45 +0300 Subject: [PATCH] CHeroWindow tweaks # Conflicts: # AI/FuzzyLite # client/windows/CHeroWindow.cpp --- client/windows/CHeroWindow.cpp | 25 ++++++++++++------------- client/windows/CHeroWindow.h | 1 - 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/client/windows/CHeroWindow.cpp b/client/windows/CHeroWindow.cpp index a7f69fdc6..8a6dce30b 100644 --- a/client/windows/CHeroWindow.cpp +++ b/client/windows/CHeroWindow.cpp @@ -24,6 +24,7 @@ #include "../gui/SDL_Extensions.h" #include "../gui/CGuiHandler.h" +#include "../gui/CAnimation.h" #include "../widgets/MiscWidgets.h" #include "../widgets/CComponent.h" @@ -107,7 +108,7 @@ CHeroWindow::CHeroWindow(const CGHeroInstance *hero): quitButton = new CButton(Point(609, 516), "hsbtns.def", CButton::tooltip(heroscrn[17]), [&](){ close(); }, SDLK_RETURN); quitButton->assignedKeys.insert(SDLK_ESCAPE); dismissButton = new CButton(Point(454, 429), "hsbtns2.def", CButton::tooltip(heroscrn[28]), [&](){ dismissCurrent(); }, SDLK_d); - questlogButton = new CButton(Point(314, 429), "hsbtns4.def", CButton::tooltip(heroscrn[0]), [&](){ questlog(); }, SDLK_q); + questlogButton = new CButton(Point(314, 429), "hsbtns4.def", CButton::tooltip(heroscrn[0]), [=](){ LOCPLINT->showQuestLog(); }, SDLK_q); formations = new CToggleGroup(0); formations->addToggle(0, new CToggleButton(Point(481, 483), "hsbtns6.def", std::make_pair(heroscrn[23], heroscrn[29]), 0, SDLK_t)); @@ -144,11 +145,12 @@ CHeroWindow::CHeroWindow(const CGHeroInstance *hero): luck = new MoraleLuckBox(false, Rect(233,179,53,45)); spellPointsArea = new LRClickableAreaWText(Rect(162,228, 136, 42), CGI->generaltexth->heroscrn[22]); + auto secSkills = std::make_shared("SECSKILL"); for(int i = 0; i < std::min(hero->secSkills.size(), 8u); ++i) { Rect r = Rect(i%2 == 0 ? 18 : 162, 276 + 48 * (i/2), 136, 42); secSkillAreas.push_back(new LRClickableAreaWTextComp(r, CComponent::secskill)); - secSkillImages.push_back(new CAnimImage("SECSKILL", 0, 0, r.x, r.y)); + secSkillImages.push_back(new CAnimImage(secSkills, 0, 0, r.x, r.y)); } //dismiss / quest log @@ -158,12 +160,14 @@ CHeroWindow::CHeroWindow(const CGHeroInstance *hero): //////////////////////////////////////////////////////////////////////////??????????????? //primary skills & exp and mana - new CAnimImage("PSKIL42", 0, 0, 32, 111, false); - new CAnimImage("PSKIL42", 1, 0, 102, 111, false); - new CAnimImage("PSKIL42", 2, 0, 172, 111, false); - new CAnimImage("PSKIL42", 3, 0, 162, 230, false); - new CAnimImage("PSKIL42", 4, 0, 20, 230, false); - new CAnimImage("PSKIL42", 5, 0, 242, 111, false); + auto primSkills = std::make_shared("PSKIL42"); + primSkills->preload(); + new CAnimImage(primSkills, 0, 0, 32, 111); + new CAnimImage(primSkills, 1, 0, 102, 111); + new CAnimImage(primSkills, 2, 0, 172, 111); + new CAnimImage(primSkills, 3, 0, 162, 230); + new CAnimImage(primSkills, 4, 0, 20, 230); + new CAnimImage(primSkills, 5, 0, 242, 111); // various texts new CLabel( 52, 99, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[1]); @@ -306,11 +310,6 @@ void CHeroWindow::dismissCurrent() LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[22], ony, 0, false); } -void CHeroWindow::questlog() -{ - LOCPLINT->showQuestLog(); -} - void CHeroWindow::commanderWindow() { //TODO: allow equipping commander artifacts by drag / drop diff --git a/client/windows/CHeroWindow.h b/client/windows/CHeroWindow.h index efb0b0a6f..40c9788fa 100644 --- a/client/windows/CHeroWindow.h +++ b/client/windows/CHeroWindow.h @@ -86,7 +86,6 @@ public: void showAll(SDL_Surface * to) override; void dismissCurrent(); //dissmissed currently displayed hero (curHero) - void questlog(); //show quest log in hero window void commanderWindow(); void switchHero(); //changes displayed hero virtual void updateGarrisons() override; //updates the morale widget and calls the parent