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
|
||||
{
|
||||
std::variant<std::shared_ptr<CHeroTooltip>, std::shared_ptr<CInteractableHeroTooltip>> heroTooltip;
|
||||
std::shared_ptr<CIntObject> heroTooltip; //should have CHeroTooltip or CInteractableHeroTooltip;
|
||||
public:
|
||||
VisibleHeroInfo(const CGHeroInstance * hero);
|
||||
};
|
||||
|
||||
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:
|
||||
VisibleTownInfo(const CGTownInstance * town);
|
||||
};
|
||||
|
@@ -413,12 +413,12 @@ CGarrisonSlot::CGarrisonSlot(CGarrisonInt * Owner, int x, int y, SlotID IID, CGa
|
||||
int labelPosW = pos.w;
|
||||
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;
|
||||
labelPosH += 7;
|
||||
}
|
||||
ETextAlignment labelAlignment = Owner->layout == CGarrisonInt::EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS
|
||||
ETextAlignment labelAlignment = Owner->layout == CGarrisonInt::ESlotsLayout::REVERSED_TWO_ROWS
|
||||
? ETextAlignment::CENTER
|
||||
: ETextAlignment::BOTTOMRIGHT;
|
||||
|
||||
@@ -516,11 +516,11 @@ void CGarrisonInt::createSlots()
|
||||
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);
|
||||
|
||||
if(layout == EGarrisonIntSlotsLayout::TWO_ROWS && j >= 4)
|
||||
if(layout == ESlotsLayout::TWO_ROWS && j >= 4)
|
||||
{
|
||||
garrisonSlots[j]->moveBy(Point(-126, 37));
|
||||
}
|
||||
else if(layout == EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS)
|
||||
else if(layout == ESlotsLayout::REVERSED_TWO_ROWS)
|
||||
{
|
||||
if(j >= 3)
|
||||
{
|
||||
@@ -671,7 +671,7 @@ void CGarrisonInt::bulkSmartSplitStack(const CGarrisonSlot * selected)
|
||||
|
||||
CGarrisonInt::CGarrisonInt(int x, int y, int inx, const Point & garsOffset,
|
||||
const CArmedInstance * s1, const CArmedInstance * s2,
|
||||
bool _removableUnits, bool smallImgs, EGarrisonIntSlotsLayout _layout)
|
||||
bool _removableUnits, bool smallImgs, ESlotsLayout _layout)
|
||||
: highlighted(nullptr),
|
||||
inSplittingMode(false),
|
||||
interx(inx),
|
||||
|
@@ -81,7 +81,7 @@ class CGarrisonInt :public CIntObject
|
||||
bool checkSelected(const CGarrisonSlot * selected, TQuantity min = 0) const;
|
||||
|
||||
public:
|
||||
enum class EGarrisonIntSlotsLayout
|
||||
enum class ESlotsLayout
|
||||
{
|
||||
ONE_ROW,
|
||||
TWO_ROWS,
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
removableUnits, ///< player Can remove units from up
|
||||
owned[2]; ///< player Owns up or down army ([0] upper, [1] lower)
|
||||
|
||||
EGarrisonIntSlotsLayout layout;
|
||||
ESlotsLayout layout;
|
||||
|
||||
void selectSlot(CGarrisonSlot * slot); ///< @param slot null = deselect
|
||||
const CGarrisonSlot * getSelection() const;
|
||||
@@ -133,11 +133,11 @@ public:
|
||||
/// @param smallImgs Units images size 64x58 or 32x32
|
||||
/// @param _layout - when TWO_ROWS - Display slots in 2 rows (1st row = 4 slots, 2nd = 3 slots), REVERSED_TWO_ROWS = 3 slots in 1st row
|
||||
CGarrisonInt(int x, int y, int inx,
|
||||
const Point & garsOffset,
|
||||
const CArmedInstance * s1, const CArmedInstance * s2 = nullptr,
|
||||
bool _removableUnits = true,
|
||||
bool smallImgs = false,
|
||||
EGarrisonIntSlotsLayout _layout = EGarrisonIntSlotsLayout::ONE_ROW);
|
||||
const Point & garsOffset,
|
||||
const CArmedInstance * s1, const CArmedInstance * s2 = nullptr,
|
||||
bool _removableUnits = true,
|
||||
bool smallImgs = false,
|
||||
ESlotsLayout _layout = ESlotsLayout::ONE_ROW);
|
||||
};
|
||||
|
||||
class CGarrisonHolder
|
||||
|
@@ -304,7 +304,7 @@ CHeroTooltip::CHeroTooltip(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));
|
||||
}
|
||||
@@ -383,7 +383,7 @@ CTownTooltip::CTownTooltip(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));
|
||||
}
|
||||
|
@@ -772,7 +772,7 @@ CTownItem::CTownItem(const CGTownInstance * Town)
|
||||
hall = std::make_shared<CTownInfo>( 69, 31, town, true);
|
||||
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);
|
||||
|
||||
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