1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Renamed & unified OBJECT_CONSTRUCTION macro set

This commit is contained in:
Ivan Savenko
2024-08-09 15:30:04 +00:00
parent 337431901f
commit 9fba3d97f1
80 changed files with 287 additions and 308 deletions

View File

@@ -73,7 +73,7 @@ void CButton::addPopupCallback(const std::function<void()> & callback)
void ButtonBase::setTextOverlay(const std::string & Text, EFonts font, ColorRGBA color)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
setOverlay(std::make_shared<CLabel>(pos.w/2, pos.h/2, font, ETextAlignment::CENTER, color, Text));
update();
}
@@ -92,7 +92,7 @@ void ButtonBase::setOverlay(const std::shared_ptr<CIntObject>& newOverlay)
void ButtonBase::setImage(const AnimationPath & defName, bool playerColoredButton)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
configurable.reset();
image = std::make_shared<CAnimImage>(defName, vstd::to_underlying(getState()));
@@ -125,7 +125,7 @@ const JsonNode & ButtonBase::getCurrentConfig() const
void ButtonBase::setConfigurable(const JsonPath & jsonName, bool playerColoredButton)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
config = std::make_unique<JsonNode>(jsonName);
@@ -162,7 +162,7 @@ void ButtonBase::setStateImpl(EButtonState newState)
if (configurable)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
configurable = std::make_shared<InterfaceObjectConfigurable>(getCurrentConfig());
pos = configurable->pos;

View File

@@ -80,7 +80,7 @@ CArtPlace::CArtPlace(Point position, const CArtifactInstance * art)
, ourArt(art)
, locked(false)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
imageIndex = 0;
if(locked)

View File

@@ -73,7 +73,7 @@ size_t CArtifactsOfHeroBackpack::getSlotsNum()
void CArtifactsOfHeroBackpack::initAOHbackpack(size_t slots, bool slider)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
backpack.resize(slots);
size_t artPlaceIdx = 0;

View File

@@ -50,8 +50,8 @@ void CArtifactsOfHeroBase::init(
const Point & position,
const BpackScrollFunctor & scrollCallback)
{
// CArtifactsOfHeroBase::init may be transform to CArtifactsOfHeroBase::CArtifactsOfHeroBase if OBJECT_CONSTRUCTION_CAPTURING is removed
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
// CArtifactsOfHeroBase::init may be transform to CArtifactsOfHeroBase::CArtifactsOfHeroBase if OBJECT_CONSTRUCTION is removed
OBJECT_CONSTRUCTION;
pos += position;
for(int g = 0; g < ArtifactPosition::BACKPACK_START; g++)
{

View File

@@ -58,7 +58,7 @@ CComponent::CComponent(const Component & c, ESize imageSize, EFonts font)
void CComponent::init(ComponentType Type, ComponentSubType Subtype, std::optional<int32_t> Val, ESize imageSize, EFonts fnt, const std::string & ValText)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
addUsedEvents(SHOW_POPUP);
@@ -323,7 +323,7 @@ std::string CComponent::getSubtitle() const
void CComponent::setSurface(const AnimationPath & defName, int imgPos)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
image = std::make_shared<CAnimImage>(defName, imgPos);
}
@@ -434,7 +434,7 @@ int CComponentBox::getDistance(CComponent *left, CComponent *right)
void CComponentBox::placeComponents(bool selectable)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
if (components.empty())
return;

View File

@@ -429,7 +429,7 @@ CGarrisonSlot::CGarrisonSlot(CGarrisonInt * Owner, int x, int y, SlotID IID, EGa
creature(creature_ ? creature_->type : nullptr),
upg(Upg)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
pos.x += x;
pos.y += y;
@@ -715,7 +715,7 @@ CGarrisonInt::CGarrisonInt(const Point & position, int inx, const Point & garsOf
, removableUnits(_removableUnits)
, layout(_layout)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
setArmy(s1, EGarrisonType::UPPER);
setArmy(s2, EGarrisonType::LOWER);

View File

@@ -35,7 +35,7 @@ CTextInput::CTextInput(const Rect & Pos)
void CTextInput::createLabel(bool giveFocusToInput)
{
OBJ_CONSTRUCTION;
OBJECT_CONSTRUCTION;
label = std::make_shared<CLabel>();
label->pos = pos;
label->alignment = originalAlignment;
@@ -59,7 +59,7 @@ CTextInput::CTextInput(const Rect & Pos, EFonts font, ETextAlignment alignment,
CTextInput::CTextInput(const Rect & Pos, const Point & bgOffset, const ImagePath & bgName)
: CTextInput(Pos)
{
OBJ_CONSTRUCTION;
OBJECT_CONSTRUCTION;
if (!bgName.empty())
background = std::make_shared<CPicture>(bgName, bgOffset.x, bgOffset.y);
else
@@ -71,7 +71,7 @@ CTextInput::CTextInput(const Rect & Pos, const Point & bgOffset, const ImagePath
CTextInput::CTextInput(const Rect & Pos, std::shared_ptr<IImage> srf)
: CTextInput(Pos)
{
OBJ_CONSTRUCTION;
OBJECT_CONSTRUCTION;
background = std::make_shared<CPicture>(srf, Pos);
pos.w = background->pos.w;
pos.h = background->pos.h;

View File

@@ -15,7 +15,7 @@
CreatureCostBox::CreatureCostBox(Rect position, std::string titleText)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
setRedrawParent(true);
pos = position + pos.topLeft();
@@ -33,7 +33,7 @@ void CreatureCostBox::createItems(TResources res)
{
resources.clear();
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
TResources::nziterator iter(res);
while(iter.valid())

View File

@@ -128,7 +128,7 @@ CHeroArea::CHeroArea(int x, int y, const CGHeroInstance * hero)
clickFunctor(nullptr),
clickRFunctor(nullptr)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
pos.x += x;
pos.w = 58;
@@ -243,7 +243,7 @@ void CMinorResDataBar::showAll(Canvas & to)
CMinorResDataBar::CMinorResDataBar()
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
pos.x = 7;
pos.y = 575;
@@ -259,7 +259,7 @@ CMinorResDataBar::~CMinorResDataBar() = default;
void CArmyTooltip::init(const InfoAboutArmy &army)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
title = std::make_shared<CLabel>(66, 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, army.name);
@@ -322,7 +322,7 @@ CArmyTooltip::CArmyTooltip(Point pos, const CArmedInstance * army):
void CHeroTooltip::init(const InfoAboutHero & hero)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
portrait = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), hero.getIconIndex(), 0, 3, 2);
if(hero.details)
@@ -354,13 +354,13 @@ CInteractableHeroTooltip::CInteractableHeroTooltip(Point pos, const CGHeroInstan
{
init(InfoAboutHero(hero, InfoAboutHero::EInfoLevel::DETAILED));
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
garrison = std::make_shared<CGarrisonInt>(pos + Point(0, 73), 4, Point(0, 0), hero, nullptr, true, true, CGarrisonInt::ESlotsLayout::REVERSED_TWO_ROWS);
}
void CInteractableHeroTooltip::init(const InfoAboutHero & hero)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
portrait = std::make_shared<CAnimImage>(AnimationPath::builtin("PortraitsLarge"), hero.getIconIndex(), 0, 3, 2);
title = std::make_shared<CLabel>(66, 2, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, hero.name);
@@ -379,7 +379,7 @@ void CInteractableHeroTooltip::init(const InfoAboutHero & hero)
void CTownTooltip::init(const InfoAboutTown & town)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
//order of icons in def: fort, citadel, castle, no fort
size_t fortIndex = town.fortLevel ? town.fortLevel - 1 : 3;
@@ -435,13 +435,13 @@ CInteractableTownTooltip::CInteractableTownTooltip(Point pos, const CGTownInstan
{
init(town);
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
garrison = std::make_shared<CGarrisonInt>(pos + Point(0, 73), 4, Point(0, 0), town->getUpperArmy(), nullptr, true, true, CGarrisonInt::ESlotsLayout::REVERSED_TWO_ROWS);
}
void CInteractableTownTooltip::init(const CGTownInstance * town)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
const InfoAboutTown townInfo = InfoAboutTown(town, true);
int townId = town->id;
@@ -530,7 +530,7 @@ void CInteractableTownTooltip::init(const CGTownInstance * town)
CreatureTooltip::CreatureTooltip(Point pos, const CGCreature * creature)
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
OBJECT_CONSTRUCTION;
auto creatureID = creature->getCreature();
int32_t creatureIconIndex = CGI->creatures()->getById(creatureID)->getIconIndex();
@@ -553,7 +553,7 @@ CreatureTooltip::CreatureTooltip(Point pos, const CGCreature * creature)
void MoraleLuckBox::set(const AFactionMember * node)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
const std::array textId = {62, 88}; //eg %s \n\n\n {Current Luck Modifiers:}
const int noneTxtId = 108; //Russian version uses same text for neutral morale\luck
@@ -629,7 +629,7 @@ MoraleLuckBox::MoraleLuckBox(bool Morale, const Rect &r, bool Small)
CCreaturePic::CCreaturePic(int x, int y, const CCreature * cre, bool Big, bool Animated)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
pos.x+=x;
pos.y+=y;
@@ -680,7 +680,7 @@ SelectableSlot::SelectableSlot(Rect area, Point oversize, const int width)
: LRClickableAreaWTextComp(area)
, selected(false)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
selection = std::make_shared<TransparentFilledRectangle>( Rect(-oversize, area.dimensions() + oversize * 2), Colors::TRANSPARENCY, Colors::YELLOW, width);
selectSlot(false);
@@ -709,7 +709,7 @@ bool SelectableSlot::isSelected() const
void SelectableSlot::setSelectionWidth(int width)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
selection = std::make_shared<TransparentFilledRectangle>( selection->pos - pos.topLeft(), Colors::TRANSPARENCY, Colors::YELLOW, width);
selectSlot(selected);
}

View File

@@ -28,7 +28,7 @@ void CObjectList::deleteItem(std::shared_ptr<CIntObject> item)
std::shared_ptr<CIntObject> CObjectList::createItem(size_t index)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
std::shared_ptr<CIntObject> item = createObject(index);
if(!item)
item = std::make_shared<CIntObject>();
@@ -90,7 +90,7 @@ CListBox::CListBox(CreateFunc create, Point Pos, Point ItemOffset, size_t Visibl
if(Slider & 1)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
slider = std::make_shared<CSlider>(
SliderPos.topLeft(),
SliderPos.w,

View File

@@ -25,7 +25,7 @@ RadialMenuItem::RadialMenuItem(const std::string & imageName, const std::string
: callback(callback)
, hoverText(hoverText)
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
OBJECT_CONSTRUCTION;
inactiveImage = std::make_shared<CPicture>(ImagePath::builtin(alternativeLayout ? "radialMenu/itemInactiveAlt" : "radialMenu/itemInactive"), Point(0, 0));
selectedImage = std::make_shared<CPicture>(ImagePath::builtin(alternativeLayout ? "radialMenu/itemEmptyAlt" : "radialMenu/itemEmpty"), Point(0, 0));
@@ -45,7 +45,7 @@ void RadialMenuItem::setSelected(bool selected)
RadialMenu::RadialMenu(const Point & positionToCenter, const std::vector<RadialMenuConfig> & menuConfig, bool alternativeLayout):
centerPosition(positionToCenter), alternativeLayout(alternativeLayout)
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
OBJECT_CONSTRUCTION;
pos += positionToCenter;
Point itemSize = alternativeLayout ? Point(80, 70) : Point(70, 80);

View File

@@ -183,7 +183,7 @@ CSlider::CSlider(Point position, int totalw, const SliderMovingFunctor & Moved,
value(Value),
moved(Moved)
{
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
OBJECT_CONSTRUCTION;
setAmount(amount);
vstd::amax(value, 0);
vstd::amin(value, positions);

View File

@@ -343,7 +343,7 @@ CLabelGroup::CLabelGroup(EFonts Font, ETextAlignment Align, const ColorRGBA & Co
void CLabelGroup::add(int x, int y, const std::string & text)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
labels.push_back(std::make_shared<CLabel>(x, y, font, align, color, text));
}
@@ -356,7 +356,7 @@ CTextBox::CTextBox(std::string Text, const Rect & rect, int SliderStyle, EFonts
sliderStyle(SliderStyle),
slider(nullptr)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
label = std::make_shared<CMultiLineLabel>(rect, Font, Align, Color);
setRedrawParent(true);
@@ -421,7 +421,7 @@ void CTextBox::setText(const std::string & text)
assert(label->pos.w > 0);
label->setText(text);
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
slider = std::make_shared<CSlider>(Point(pos.w - 16, 0), pos.h, std::bind(&CTextBox::sliderMoved, this, _1),
label->pos.h, label->textSize.y, 0, Orientation::VERTICAL, CSlider::EStyle(sliderStyle));
slider->setScrollStep((int)graphics->fonts[label->font]->getLineHeight());
@@ -504,7 +504,7 @@ CGStatusBar::CGStatusBar(int x, int y, const ImagePath & name, int maxw)
{
addUsedEvents(LCLICK);
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
auto backgroundImage = std::make_shared<CPicture>(name);
background = backgroundImage;

View File

@@ -29,7 +29,7 @@
CAltarArtifacts::CAltarArtifacts(const IMarket * market, const CGHeroInstance * hero)
: CMarketBase(market, hero)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
assert(dynamic_cast<const CGArtifactsAltar*>(market));
auto altarObj = dynamic_cast<const CGArtifactsAltar*>(market);

View File

@@ -30,7 +30,7 @@ CAltarCreatures::CAltarCreatures(const IMarket * market, const CGHeroInstance *
, CMarketSlider(std::bind(&CAltarCreatures::onOfferSliderMoved, this, _1))
, CMarketTraderText(Point(28, 31), FONT_MEDIUM, Colors::YELLOW)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
deal = std::make_shared<CButton>(dealButtonPosWithSlider, AnimationPath::builtin("ALTSACR.DEF"),
CGI->generaltexth->zelp[584], [this]() {CAltarCreatures::makeDeal();}, EShortcut::MARKET_DEAL);

View File

@@ -32,7 +32,7 @@ CArtifactsBuying::CArtifactsBuying(const IMarket * market, const CGHeroInstance
: CMarketBase(market, hero)
, CResourcesSelling([this](const std::shared_ptr<CTradeableItem> & heroSlot){CArtifactsBuying::onSlotClickPressed(heroSlot, bidTradePanel);})
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
std::string title;
if(auto townMarket = dynamic_cast<const CGTownInstance*>(market))

View File

@@ -35,7 +35,7 @@ CArtifactsSelling::CArtifactsSelling(const IMarket * market, const CGHeroInstanc
[this](const std::shared_ptr<CTradeableItem> & resSlot){CArtifactsSelling::onSlotClickPressed(resSlot, offerTradePanel);},
[this](){CArtifactsSelling::updateSubtitles();})
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
std::string title;
if(const auto townMarket = dynamic_cast<const CGTownInstance*>(market))

View File

@@ -32,7 +32,7 @@ CFreelancerGuild::CFreelancerGuild(const IMarket * market, const CGHeroInstance
[this](){CMarketBase::updateSubtitlesForBid(EMarketMode::CREATURE_RESOURCE, bidTradePanel->getSelectedItemId());})
, CMarketSlider([this](int newVal){CMarketSlider::onOfferSliderMoved(newVal);})
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
labels.emplace_back(std::make_shared<CLabel>(titlePos.x, titlePos.y, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW,
VLC->generaltexth->translate("object.core.freelancersGuild.name")));

View File

@@ -122,7 +122,7 @@ void CMarketBase::highlightingChanged()
CExperienceAltar::CExperienceAltar()
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
// Experience needed to reach next level
texts.emplace_back(std::make_shared<CTextBox>(CGI->generaltexth->allTexts[475], Rect(15, 415, 125, 50), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW));
@@ -144,7 +144,7 @@ void CExperienceAltar::update()
CCreaturesSelling::CCreaturesSelling()
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
assert(hero);
CreaturesPanel::slotsData slots;
@@ -171,7 +171,7 @@ void CCreaturesSelling::updateSubtitles() const
CResourcesBuying::CResourcesBuying(const CTradeableItem::ClickPressedFunctor & clickPressedCallback,
const TradePanelBase::UpdateSlotsFunctor & updSlotsCallback)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
offerTradePanel = std::make_shared<ResourcesPanel>(clickPressedCallback, updSlotsCallback);
offerTradePanel->moveTo(pos.topLeft() + Point(327, 182));
@@ -180,7 +180,7 @@ CResourcesBuying::CResourcesBuying(const CTradeableItem::ClickPressedFunctor & c
CResourcesSelling::CResourcesSelling(const CTradeableItem::ClickPressedFunctor & clickPressedCallback)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
bidTradePanel = std::make_shared<ResourcesPanel>(clickPressedCallback, std::bind(&CResourcesSelling::updateSubtitles, this));
labels.emplace_back(std::make_shared<CLabel>(156, 148, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[270]));
@@ -194,7 +194,7 @@ void CResourcesSelling::updateSubtitles() const
CMarketSlider::CMarketSlider(const CSlider::SliderMovingFunctor & movingCallback)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
offerSlider = std::make_shared<CSlider>(Point(230, 489), 137, movingCallback, 0, 0, 0, Orientation::HORIZONTAL);
maxAmount = std::make_shared<CButton>(Point(228, 520), AnimationPath::builtin("IRCBTNS.DEF"), CGI->generaltexth->zelp[596],
@@ -224,7 +224,7 @@ void CMarketSlider::onOfferSliderMoved(int newVal)
CMarketTraderText::CMarketTraderText(const Point & pos, const EFonts & font, const ColorRGBA & color)
: madeTransaction(false)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
traderText = std::make_shared<CTextBox>("", Rect(pos, traderTextDimensions), 0, font, ETextAlignment::CENTER, color);
}

View File

@@ -32,7 +32,7 @@ CMarketResources::CMarketResources(const IMarket * market, const CGHeroInstance
[this](){CMarketResources::updateSubtitles();})
, CMarketSlider([this](int newVal){CMarketSlider::onOfferSliderMoved(newVal);})
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
labels.emplace_back(std::make_shared<CLabel>(titlePos.x, titlePos.y, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[158]));
deal = std::make_shared<CButton>(dealButtonPosWithSlider, AnimationPath::builtin("TPMRKB.DEF"),

View File

@@ -30,7 +30,7 @@ CTransferResources::CTransferResources(const IMarket * market, const CGHeroInsta
, CMarketSlider([this](int newVal){CMarketSlider::onOfferSliderMoved(newVal);})
, CMarketTraderText(Point(28, 48))
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
labels.emplace_back(std::make_shared<CLabel>(titlePos.x, titlePos.y, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[158]));
labels.emplace_back(std::make_shared<CLabel>(445, 56, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[169]));

View File

@@ -29,7 +29,7 @@ CTradeableItem::CTradeableItem(const Rect & area, EType Type, int ID, int Serial
, id(ID)
, serial(Serial)
{
OBJECT_CONSTRUCTION_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
addUsedEvents(LCLICK);
addUsedEvents(HOVER);
@@ -46,7 +46,7 @@ void CTradeableItem::setType(EType newType)
{
if(type != newType)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
type = newType;
if(getIndex() < 0)
@@ -270,7 +270,7 @@ ResourcesPanel::ResourcesPanel(const CTradeableItem::ClickPressedFunctor & click
const UpdateSlotsFunctor & updateSubtitles)
{
assert(resourcesForTrade.size() == slotsPos.size());
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
for(const auto & res : resourcesForTrade)
{
@@ -287,7 +287,7 @@ ArtifactsPanel::ArtifactsPanel(const CTradeableItem::ClickPressedFunctor & click
{
assert(slotsForTrade == slotsPos.size());
assert(slotsForTrade == arts.size());
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
for(auto slotIdx = 0; slotIdx < slotsForTrade; slotIdx++)
{
@@ -308,7 +308,7 @@ ArtifactsPanel::ArtifactsPanel(const CTradeableItem::ClickPressedFunctor & click
PlayersPanel::PlayersPanel(const CTradeableItem::ClickPressedFunctor & clickPressedCallback)
{
assert(PlayerColor::PLAYER_LIMIT_I <= slotsPos.size() + 1);
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
std::vector<PlayerColor> players;
for(auto player = PlayerColor(0); player < PlayerColor::PLAYER_LIMIT_I; player++)
@@ -334,7 +334,7 @@ CreaturesPanel::CreaturesPanel(const CTradeableItem::ClickPressedFunctor & click
{
assert(initialSlots.size() <= GameConstants::ARMY_SIZE);
assert(slotsPos.size() <= GameConstants::ARMY_SIZE);
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
for(const auto & [creatureId, slotId, creaturesNum] : initialSlots)
{
@@ -352,7 +352,7 @@ CreaturesPanel::CreaturesPanel(const CTradeableItem::ClickPressedFunctor & click
const std::vector<std::shared_ptr<CTradeableItem>> & srcSlots, bool emptySlots)
{
assert(slots.size() <= GameConstants::ARMY_SIZE);
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
for(const auto & srcSlot : srcSlots)
{
@@ -367,7 +367,7 @@ CreaturesPanel::CreaturesPanel(const CTradeableItem::ClickPressedFunctor & click
ArtifactsAltarPanel::ArtifactsAltarPanel(const CTradeableItem::ClickPressedFunctor & clickPressedCallback)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255 - DISPOSE);
OBJECT_CONSTRUCTION;
int slotNum = 0;
for(auto & altarSlotPos : slotsPos)