|
@@ -410,7 +410,19 @@ CGarrisonSlot::CGarrisonSlot(CGarrisonInt * Owner, int x, int y, SlotID IID, CGa
|
|
|
pos.h = 64;
|
|
|
}
|
|
|
|
|
|
- stackCount = std::make_shared<CLabel>(pos.w, pos.h, owner->smallIcons ? FONT_TINY : FONT_MEDIUM, ETextAlignment::BOTTOMRIGHT, Colors::WHITE);
|
|
|
+ int labelPosW = pos.w;
|
|
|
+ int labelPosH = pos.h;
|
|
|
+
|
|
|
+ if(Owner->layout == CGarrisonInt::EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS) //labels under icon
|
|
|
+ {
|
|
|
+ labelPosW = pos.w / 2 + 1;
|
|
|
+ labelPosH += 7;
|
|
|
+ }
|
|
|
+ ETextAlignment labelAlignment = Owner->layout == CGarrisonInt::EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS
|
|
|
+ ? ETextAlignment::CENTER
|
|
|
+ : ETextAlignment::BOTTOMRIGHT;
|
|
|
+
|
|
|
+ stackCount = std::make_shared<CLabel>(labelPosW, labelPosH, owner->smallIcons ? FONT_TINY : FONT_MEDIUM, labelAlignment, Colors::WHITE);
|
|
|
|
|
|
update();
|
|
|
}
|
|
@@ -488,7 +500,7 @@ void CGarrisonInt::addSplitBtn(std::shared_ptr<CButton> button)
|
|
|
void CGarrisonInt::createSlots()
|
|
|
{
|
|
|
int distance = interx + (smallIcons ? 32 : 58);
|
|
|
- for(int i=0; i<2; i++)
|
|
|
+ for(int i = 0; i < 2; i++)
|
|
|
{
|
|
|
std::vector<std::shared_ptr<CGarrisonSlot>> garrisonSlots;
|
|
|
garrisonSlots.resize(7);
|
|
@@ -499,14 +511,26 @@ void CGarrisonInt::createSlots()
|
|
|
garrisonSlots[elem.first.getNum()] = std::make_shared<CGarrisonSlot>(this, i*garOffset.x + (elem.first.getNum()*distance), i*garOffset.y, elem.first, static_cast<CGarrisonSlot::EGarrisonType>(i), elem.second);
|
|
|
}
|
|
|
}
|
|
|
- for(int j=0; j<7; j++)
|
|
|
+ for(int j = 0; j < 7; 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);
|
|
|
- if(twoRows && j>=4)
|
|
|
+
|
|
|
+ if(layout == EGarrisonIntSlotsLayout::TWO_ROWS && j >= 4)
|
|
|
{
|
|
|
garrisonSlots[j]->moveBy(Point(-126, 37));
|
|
|
}
|
|
|
+ else if(layout == EGarrisonIntSlotsLayout::REVERSED_TWO_ROWS)
|
|
|
+ {
|
|
|
+ if(j >= 3)
|
|
|
+ {
|
|
|
+ garrisonSlots[j]->moveBy(Point(-90, 49));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ garrisonSlots[j]->moveBy(Point(36, 0));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
vstd::concatenate(availableSlots, garrisonSlots);
|
|
|
}
|
|
@@ -646,16 +670,16 @@ 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, bool _twoRows)
|
|
|
- : highlighted(nullptr),
|
|
|
- inSplittingMode(false),
|
|
|
- interx(inx),
|
|
|
- garOffset(garsOffset),
|
|
|
- pb(false),
|
|
|
- smallIcons(smallImgs),
|
|
|
- removableUnits(_removableUnits),
|
|
|
- twoRows(_twoRows)
|
|
|
+ const CArmedInstance * s1, const CArmedInstance * s2,
|
|
|
+ bool _removableUnits, bool smallImgs, EGarrisonIntSlotsLayout _layout)
|
|
|
+ : highlighted(nullptr),
|
|
|
+ inSplittingMode(false),
|
|
|
+ interx(inx),
|
|
|
+ garOffset(garsOffset),
|
|
|
+ pb(false),
|
|
|
+ smallIcons(smallImgs),
|
|
|
+ removableUnits(_removableUnits),
|
|
|
+ layout(_layout)
|
|
|
{
|
|
|
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
|
|
|