mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Changes from code review
This commit is contained in:
@@ -69,14 +69,14 @@ private:
|
|||||||
|
|
||||||
class VisibleHeroInfo : public CVisibleInfo
|
class VisibleHeroInfo : public CVisibleInfo
|
||||||
{
|
{
|
||||||
std::variant<std::shared_ptr<CHeroTooltip>, std::shared_ptr<CInteractableHeroTooltip>> heroTooltip;
|
std::shared_ptr<CIntObject> heroTooltip; //should have CHeroTooltip or CInteractableHeroTooltip;
|
||||||
public:
|
public:
|
||||||
VisibleHeroInfo(const CGHeroInstance * hero);
|
VisibleHeroInfo(const CGHeroInstance * hero);
|
||||||
};
|
};
|
||||||
|
|
||||||
class VisibleTownInfo : public CVisibleInfo
|
class VisibleTownInfo : public CVisibleInfo
|
||||||
{
|
{
|
||||||
std::variant<std::shared_ptr<CTownTooltip>, std::shared_ptr<CInteractableTownTooltip>> townTooltip;
|
std::shared_ptr<CIntObject> townTooltip; //should have CTownTooltip or CInteractableTownTooltip;
|
||||||
public:
|
public:
|
||||||
VisibleTownInfo(const CGTownInstance * town);
|
VisibleTownInfo(const CGTownInstance * town);
|
||||||
};
|
};
|
||||||
|
@@ -413,12 +413,12 @@ CGarrisonSlot::CGarrisonSlot(CGarrisonInt * Owner, int x, int y, SlotID IID, CGa
|
|||||||
int labelPosW = pos.w;
|
int labelPosW = pos.w;
|
||||||
int labelPosH = pos.h;
|
int labelPosH = pos.h;
|
||||||
|
|
||||||
if(Owner->layout == CGarrisonInt::EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS) //labels under icon
|
if(Owner->layout == CGarrisonInt::ESlotsLayout::REVERSED_TWO_ROWS) //labels under icon
|
||||||
{
|
{
|
||||||
labelPosW = pos.w / 2 + 1;
|
labelPosW = pos.w / 2 + 1;
|
||||||
labelPosH += 7;
|
labelPosH += 7;
|
||||||
}
|
}
|
||||||
ETextAlignment labelAlignment = Owner->layout == CGarrisonInt::EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS
|
ETextAlignment labelAlignment = Owner->layout == CGarrisonInt::ESlotsLayout::REVERSED_TWO_ROWS
|
||||||
? ETextAlignment::CENTER
|
? ETextAlignment::CENTER
|
||||||
: ETextAlignment::BOTTOMRIGHT;
|
: ETextAlignment::BOTTOMRIGHT;
|
||||||
|
|
||||||
@@ -516,11 +516,11 @@ void CGarrisonInt::createSlots()
|
|||||||
if(!garrisonSlots[j])
|
if(!garrisonSlots[j])
|
||||||
garrisonSlots[j] = std::make_shared<CGarrisonSlot>(this, i*garOffset.x + (j*distance), i*garOffset.y, SlotID(j), static_cast<CGarrisonSlot::EGarrisonType>(i), nullptr);
|
garrisonSlots[j] = std::make_shared<CGarrisonSlot>(this, i*garOffset.x + (j*distance), i*garOffset.y, SlotID(j), static_cast<CGarrisonSlot::EGarrisonType>(i), nullptr);
|
||||||
|
|
||||||
if(layout == EGarrisonIntSlotsLayout::TWO_ROWS && j >= 4)
|
if(layout == ESlotsLayout::TWO_ROWS && j >= 4)
|
||||||
{
|
{
|
||||||
garrisonSlots[j]->moveBy(Point(-126, 37));
|
garrisonSlots[j]->moveBy(Point(-126, 37));
|
||||||
}
|
}
|
||||||
else if(layout == EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS)
|
else if(layout == ESlotsLayout::REVERSED_TWO_ROWS)
|
||||||
{
|
{
|
||||||
if(j >= 3)
|
if(j >= 3)
|
||||||
{
|
{
|
||||||
@@ -671,7 +671,7 @@ void CGarrisonInt::bulkSmartSplitStack(const CGarrisonSlot * selected)
|
|||||||
|
|
||||||
CGarrisonInt::CGarrisonInt(int x, int y, int inx, const Point & garsOffset,
|
CGarrisonInt::CGarrisonInt(int x, int y, int inx, const Point & garsOffset,
|
||||||
const CArmedInstance * s1, const CArmedInstance * s2,
|
const CArmedInstance * s1, const CArmedInstance * s2,
|
||||||
bool _removableUnits, bool smallImgs, EGarrisonIntSlotsLayout _layout)
|
bool _removableUnits, bool smallImgs, ESlotsLayout _layout)
|
||||||
: highlighted(nullptr),
|
: highlighted(nullptr),
|
||||||
inSplittingMode(false),
|
inSplittingMode(false),
|
||||||
interx(inx),
|
interx(inx),
|
||||||
|
@@ -81,7 +81,7 @@ class CGarrisonInt :public CIntObject
|
|||||||
bool checkSelected(const CGarrisonSlot * selected, TQuantity min = 0) const;
|
bool checkSelected(const CGarrisonSlot * selected, TQuantity min = 0) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class EGarrisonIntSlotsLayout
|
enum class ESlotsLayout
|
||||||
{
|
{
|
||||||
ONE_ROW,
|
ONE_ROW,
|
||||||
TWO_ROWS,
|
TWO_ROWS,
|
||||||
@@ -98,7 +98,7 @@ public:
|
|||||||
removableUnits, ///< player Can remove units from up
|
removableUnits, ///< player Can remove units from up
|
||||||
owned[2]; ///< player Owns up or down army ([0] upper, [1] lower)
|
owned[2]; ///< player Owns up or down army ([0] upper, [1] lower)
|
||||||
|
|
||||||
EGarrisonIntSlotsLayout layout;
|
ESlotsLayout layout;
|
||||||
|
|
||||||
void selectSlot(CGarrisonSlot * slot); ///< @param slot null = deselect
|
void selectSlot(CGarrisonSlot * slot); ///< @param slot null = deselect
|
||||||
const CGarrisonSlot * getSelection() const;
|
const CGarrisonSlot * getSelection() const;
|
||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
const CArmedInstance * s1, const CArmedInstance * s2 = nullptr,
|
const CArmedInstance * s1, const CArmedInstance * s2 = nullptr,
|
||||||
bool _removableUnits = true,
|
bool _removableUnits = true,
|
||||||
bool smallImgs = false,
|
bool smallImgs = false,
|
||||||
EGarrisonIntSlotsLayout _layout = EGarrisonIntSlotsLayout::ONE_ROW);
|
ESlotsLayout _layout = ESlotsLayout::ONE_ROW);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGarrisonHolder
|
class CGarrisonHolder
|
||||||
|
@@ -304,7 +304,7 @@ CHeroTooltip::CHeroTooltip(Point pos, const CGHeroInstance * hero):
|
|||||||
}
|
}
|
||||||
|
|
||||||
CInteractableHeroTooltip::CInteractableHeroTooltip(Point pos, const CGHeroInstance * hero):
|
CInteractableHeroTooltip::CInteractableHeroTooltip(Point pos, const CGHeroInstance * hero):
|
||||||
CGarrisonInt(pos.x, pos.y+73, 4, Point(0, 0), hero, nullptr, true, true, CGarrisonInt::EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS)
|
CGarrisonInt(pos.x, pos.y+73, 4, Point(0, 0), hero, nullptr, true, true, CGarrisonInt::ESlotsLayout::REVERSED_TWO_ROWS)
|
||||||
{
|
{
|
||||||
init(InfoAboutHero(hero, InfoAboutHero::EInfoLevel::DETAILED));
|
init(InfoAboutHero(hero, InfoAboutHero::EInfoLevel::DETAILED));
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ CTownTooltip::CTownTooltip(Point pos, const CGTownInstance * town)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CInteractableTownTooltip::CInteractableTownTooltip(Point pos, const CGTownInstance * town)
|
CInteractableTownTooltip::CInteractableTownTooltip(Point pos, const CGTownInstance * town)
|
||||||
: CGarrisonInt(pos.x, pos.y+73, 4, Point(0, 0), town->getUpperArmy(), nullptr, true, true, CGarrisonInt::EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS)
|
: CGarrisonInt(pos.x, pos.y+73, 4, Point(0, 0), town->getUpperArmy(), nullptr, true, true, CGarrisonInt::ESlotsLayout::REVERSED_TWO_ROWS)
|
||||||
{
|
{
|
||||||
init(InfoAboutTown(town, true));
|
init(InfoAboutTown(town, true));
|
||||||
}
|
}
|
||||||
|
@@ -772,7 +772,7 @@ CTownItem::CTownItem(const CGTownInstance * Town)
|
|||||||
hall = std::make_shared<CTownInfo>( 69, 31, town, true);
|
hall = std::make_shared<CTownInfo>( 69, 31, town, true);
|
||||||
fort = std::make_shared<CTownInfo>(111, 31, town, false);
|
fort = std::make_shared<CTownInfo>(111, 31, town, false);
|
||||||
|
|
||||||
garr = std::make_shared<CGarrisonInt>(313, 3, 4, Point(232,0), town->getUpperArmy(), town->visitingHero, true, true, CGarrisonInt::EGarrisonIntSlotsLayout::TWO_ROWS);
|
garr = std::make_shared<CGarrisonInt>(313, 3, 4, Point(232,0), town->getUpperArmy(), town->visitingHero, true, true, CGarrisonInt::ESlotsLayout::TWO_ROWS);
|
||||||
heroes = std::make_shared<HeroSlots>(town, Point(244,6), Point(475,6), garr, false);
|
heroes = std::make_shared<HeroSlots>(town, Point(244,6), Point(475,6), garr, false);
|
||||||
|
|
||||||
size_t iconIndex = town->town->clientInfo.icons[town->hasFort()][town->builded >= CGI->settings()->getInteger(EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP)];
|
size_t iconIndex = town->town->clientInfo.icons[town->hasFort()][town->builded >= CGI->settings()->getInteger(EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP)];
|
||||||
|
Reference in New Issue
Block a user