diff --git a/client/widgets/CArtifactHolder.cpp b/client/widgets/CArtifactHolder.cpp index 77f988e0d..c32d26b6b 100644 --- a/client/widgets/CArtifactHolder.cpp +++ b/client/widgets/CArtifactHolder.cpp @@ -946,6 +946,7 @@ bool CArtifactsOfHero::SCommonPart::Artpos::valid() CArtPlace::CArtPlace(Point position, const CArtifactInstance * Art) : ourArt(Art) { + image = nullptr; pos += position; pos.w = pos.h = 44; } diff --git a/client/widgets/CGarrisonInt.cpp b/client/widgets/CGarrisonInt.cpp index 21fbe18d3..fa39461f1 100644 --- a/client/widgets/CGarrisonInt.cpp +++ b/client/widgets/CGarrisonInt.cpp @@ -475,6 +475,7 @@ CGarrisonInt::CGarrisonInt(int x, int y, int inx, const Point &garsOffset, inSplittingMode(false), interx(inx), garOffset(garsOffset), + pb(false), smallIcons(smallImgs), removableUnits(_removableUnits), twoRows(_twoRows) diff --git a/client/widgets/CGarrisonInt.h b/client/widgets/CGarrisonInt.h index 494a3863e..4fe8efe43 100644 --- a/client/widgets/CGarrisonInt.h +++ b/client/widgets/CGarrisonInt.h @@ -78,19 +78,14 @@ public: std::vector splitButtons; ///< May be empty if no buttons SlotID p2; ///< TODO: comment me - int shiftPos; ///< 1st slot of the second row, set shiftPoint for effect bool pb, smallIcons, ///< true - 32x32 imgs, false - 58x64 removableUnits, ///< player Can remove units from up twoRows, ///< slots Will be placed in 2 rows owned[2]; ///< player Owns up or down army ([0] upper, [1] lower) -// const CCreatureSet *set1; ///< Top set of creatures -// const CCreatureSet *set2; ///< Bottom set of creatures - std::vector slotsUp, slotsDown; ///< Slots of upper and lower garrison const CArmedInstance *armedObjs[2]; ///< [0] is upper, [1] is down - //const CArmedInstance *oup, *odown; ///< Upper and lower garrisons (heroes or towns) void setArmy(const CArmedInstance *army, bool bottomGarrison); void addSplitBtn(CButton * button); diff --git a/client/widgets/MiscWidgets.cpp b/client/widgets/MiscWidgets.cpp index 7b1b03be0..22c740df4 100644 --- a/client/widgets/MiscWidgets.cpp +++ b/client/widgets/MiscWidgets.cpp @@ -94,7 +94,7 @@ void LRClickableAreaWTextComp::clickLeft(tribool down, bool previousState) } LRClickableAreaWTextComp::LRClickableAreaWTextComp(const Rect &Pos, int BaseType) - : LRClickableAreaWText(Pos), baseType(BaseType), bonusValue(-1) + : LRClickableAreaWText(Pos), baseType(BaseType), bonusValue(-1), type(-1) { } @@ -170,8 +170,8 @@ void LRClickableAreaOpenTown::clickRight(tribool down, bool previousState) LOCPLINT->openTownWindow(town);//TODO: popup? } -LRClickableAreaOpenTown::LRClickableAreaOpenTown() - : LRClickableAreaWTextComp(Rect(0,0,0,0), -1) +LRClickableAreaOpenTown::LRClickableAreaOpenTown(const Rect & Pos, const CGTownInstance * Town) + : LRClickableAreaWTextComp(Pos, -1), town(Town) { } @@ -376,9 +376,9 @@ void MoraleLuckBox::set(const IBonusBearer *node) baseType = componentType[morale]; text = CGI->generaltexth->arraytxt[textId[morale]]; boost::algorithm::replace_first(text,"%s",CGI->generaltexth->arraytxt[neutralDescr[morale]-mrlt]); - - if (morale && node && (node->hasBonusOfType(Bonus::UNDEAD) - || node->hasBonusOfType(Bonus::BLOCK_MORALE) + + if (morale && node && (node->hasBonusOfType(Bonus::UNDEAD) + || node->hasBonusOfType(Bonus::BLOCK_MORALE) || node->hasBonusOfType(Bonus::NON_LIVING))) { text += CGI->generaltexth->arraytxt[113]; //unaffected by morale diff --git a/client/widgets/MiscWidgets.h b/client/widgets/MiscWidgets.h index 94f4e8d98..5c923813a 100644 --- a/client/widgets/MiscWidgets.h +++ b/client/widgets/MiscWidgets.h @@ -139,7 +139,7 @@ public: const CGTownInstance * town; void clickLeft(tribool down, bool previousState) override; void clickRight(tribool down, bool previousState) override; - LRClickableAreaOpenTown(); + LRClickableAreaOpenTown(const Rect & Pos, const CGTownInstance * Town); }; class MoraleLuckBox : public LRClickableAreaWTextComp diff --git a/client/windows/CKingdomInterface.cpp b/client/windows/CKingdomInterface.cpp index 177898afb..52f5c5ad8 100644 --- a/client/windows/CKingdomInterface.cpp +++ b/client/windows/CKingdomInterface.cpp @@ -792,9 +792,7 @@ CTownItem::CTownItem(const CGTownInstance* Town): size_t iconIndex = town->town->clientInfo.icons[town->hasFort()][town->builded >= CGI->modh->settings.MAX_BUILDING_PER_TURN]; picture = new CAnimImage("ITPT", iconIndex, 0, 5, 6); - townArea = new LRClickableAreaOpenTown; - townArea->pos = Rect(pos.x+5, pos.y+6, 58, 64); - townArea->town = town; + new LRClickableAreaOpenTown(Rect(5, 6, 58, 64), town); for (size_t i=0; icreatures.size(); i++) { diff --git a/client/windows/CKingdomInterface.h b/client/windows/CKingdomInterface.h index 261b80f6d..e6b31966b 100644 --- a/client/windows/CKingdomInterface.h +++ b/client/windows/CKingdomInterface.h @@ -33,12 +33,12 @@ class CKingdHeroList; class CKingdTownList; class IInfoBoxData; -/* +/* * Several classes to display basically any data. * Main part - class InfoBox which controls how data will be formatted\positioned * InfoBox have image and 0-2 labels * In constructor it should receive object that implements IInfoBoxData interface - * + * * interface IInfoBoxData defines way to get data for use in InfoBox * have several implementations: * InfoBoxHeroData - to display one of fields from hero (e.g. absolute value of primary skills) @@ -265,7 +265,6 @@ class CTownItem : public CIntObject, public CGarrisonHolder CLabel *name; CLabel *income; CGarrisonInt *garr; - LRClickableAreaOpenTown *townArea; HeroSlots *heroes; CTownInfo *hall, *fort; @@ -338,11 +337,11 @@ private: CLabel * townLabel; CLabel * garrHeroLabel; CLabel * visitHeroLabel; - + CIntObject* createTownItem(size_t index); public: CKingdTownList(size_t maxSize); - + void townChanged(const CGTownInstance *town); void updateGarrisons() override; };