|
@@ -135,11 +135,11 @@ void CRecruitmentWindow::select(std::shared_ptr<CCreatureCard> card)
|
|
else // if slider already at 0 - emulate call to sliderMoved()
|
|
else // if slider already at 0 - emulate call to sliderMoved()
|
|
sliderMoved(maxAmount);
|
|
sliderMoved(maxAmount);
|
|
|
|
|
|
- costPerTroopValue->createItems(card->creature->cost);
|
|
|
|
- totalCostValue->createItems(card->creature->cost);
|
|
|
|
|
|
+ costPerTroopValue->createItems(card->creature->getFullRecruitCost());
|
|
|
|
+ totalCostValue->createItems(card->creature->getFullRecruitCost());
|
|
|
|
|
|
- costPerTroopValue->set(card->creature->cost);
|
|
|
|
- totalCostValue->set(card->creature->cost * maxAmount);
|
|
|
|
|
|
+ costPerTroopValue->set(card->creature->getFullRecruitCost());
|
|
|
|
+ totalCostValue->set(card->creature->getFullRecruitCost() * maxAmount);
|
|
|
|
|
|
//Recruit %s
|
|
//Recruit %s
|
|
title->setText(boost::str(boost::format(CGI->generaltexth->tcommands[21]) % card->creature->getNamePluralTranslated()));
|
|
title->setText(boost::str(boost::format(CGI->generaltexth->tcommands[21]) % card->creature->getNamePluralTranslated()));
|
|
@@ -151,7 +151,7 @@ void CRecruitmentWindow::select(std::shared_ptr<CCreatureCard> card)
|
|
|
|
|
|
void CRecruitmentWindow::buy()
|
|
void CRecruitmentWindow::buy()
|
|
{
|
|
{
|
|
- CreatureID crid = selected->creature->idNumber;
|
|
|
|
|
|
+ CreatureID crid = selected->creature->getId();
|
|
SlotID dstslot = dst-> getSlotFor(crid);
|
|
SlotID dstslot = dst-> getSlotFor(crid);
|
|
|
|
|
|
if(!dstslot.validSlot() && (selected->creature->warMachine == ArtifactID::NONE)) //no available slot
|
|
if(!dstslot.validSlot() && (selected->creature->warMachine == ArtifactID::NONE)) //no available slot
|
|
@@ -296,7 +296,7 @@ void CRecruitmentWindow::sliderMoved(int to)
|
|
availableValue->setText(std::to_string(selected->amount - to));
|
|
availableValue->setText(std::to_string(selected->amount - to));
|
|
toRecruitValue->setText(std::to_string(to));
|
|
toRecruitValue->setText(std::to_string(to));
|
|
|
|
|
|
- totalCostValue->set(selected->creature->cost * to);
|
|
|
|
|
|
+ totalCostValue->set(selected->creature->getFullRecruitCost() * to);
|
|
}
|
|
}
|
|
|
|
|
|
CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, int)> callback_, int leftMin_, int rightMin_, int leftAmount_, int rightAmount_)
|
|
CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, int)> callback_, int leftMin_, int rightMin_, int leftAmount_, int rightAmount_)
|
|
@@ -463,7 +463,7 @@ CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj)
|
|
recruit = std::make_shared<CButton>(Point(272, 355), "TPTAV01.DEF", CButton::tooltip(), std::bind(&CTavernWindow::recruitb, this), SDLK_RETURN);
|
|
recruit = std::make_shared<CButton>(Point(272, 355), "TPTAV01.DEF", CButton::tooltip(), std::bind(&CTavernWindow::recruitb, this), SDLK_RETURN);
|
|
thiefGuild = std::make_shared<CButton>(Point(22, 428), "TPTAV02.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[5]), std::bind(&CTavernWindow::thievesguildb, this), SDLK_t);
|
|
thiefGuild = std::make_shared<CButton>(Point(22, 428), "TPTAV02.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[5]), std::bind(&CTavernWindow::thievesguildb, this), SDLK_t);
|
|
|
|
|
|
- if(LOCPLINT->cb->getResourceAmount(Res::GOLD) < GameConstants::HERO_GOLD_COST) //not enough gold
|
|
|
|
|
|
+ if(LOCPLINT->cb->getResourceAmount(EGameResID::GOLD) < GameConstants::HERO_GOLD_COST) //not enough gold
|
|
{
|
|
{
|
|
recruit->addHoverText(CButton::NORMAL, CGI->generaltexth->tavernInfo[0]); //Cannot afford a Hero
|
|
recruit->addHoverText(CButton::NORMAL, CGI->generaltexth->tavernInfo[0]); //Cannot afford a Hero
|
|
recruit->block(true);
|
|
recruit->block(true);
|
|
@@ -811,7 +811,7 @@ void CExchangeController::moveArmy(bool leftToRight)
|
|
source->Slots(),
|
|
source->Slots(),
|
|
[](const std::pair<SlotID, CStackInstance *> & s) -> int
|
|
[](const std::pair<SlotID, CStackInstance *> & s) -> int
|
|
{
|
|
{
|
|
- return s.second->getCreatureID().toCreature()->AIValue;
|
|
|
|
|
|
+ return s.second->getCreatureID().toCreature()->getAIValue();
|
|
});
|
|
});
|
|
|
|
|
|
slot = weakestSlot->first;
|
|
slot = weakestSlot->first;
|
|
@@ -1093,20 +1093,20 @@ CShipyardWindow::CShipyardWindow(const TResources & cost, int state, int boatTyp
|
|
bgShip->center(waterCenter);
|
|
bgShip->center(waterCenter);
|
|
|
|
|
|
// Create resource icons and costs.
|
|
// Create resource icons and costs.
|
|
- std::string goldValue = std::to_string(cost[Res::GOLD]);
|
|
|
|
- std::string woodValue = std::to_string(cost[Res::WOOD]);
|
|
|
|
|
|
+ std::string goldValue = std::to_string(cost[EGameResID::GOLD]);
|
|
|
|
+ std::string woodValue = std::to_string(cost[EGameResID::WOOD]);
|
|
|
|
|
|
goldCost = std::make_shared<CLabel>(118, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, goldValue);
|
|
goldCost = std::make_shared<CLabel>(118, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, goldValue);
|
|
woodCost = std::make_shared<CLabel>(212, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, woodValue);
|
|
woodCost = std::make_shared<CLabel>(212, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, woodValue);
|
|
|
|
|
|
- goldPic = std::make_shared<CAnimImage>("RESOURCE", Res::GOLD, 0, 100, 244);
|
|
|
|
- woodPic = std::make_shared<CAnimImage>("RESOURCE", Res::WOOD, 0, 196, 244);
|
|
|
|
|
|
+ goldPic = std::make_shared<CAnimImage>("RESOURCE",GameResID(EGameResID::GOLD), 0, 100, 244);
|
|
|
|
+ woodPic = std::make_shared<CAnimImage>("RESOURCE", GameResID(EGameResID::WOOD), 0, 196, 244);
|
|
|
|
|
|
quit = std::make_shared<CButton>(Point(224, 312), "ICANCEL", CButton::tooltip(CGI->generaltexth->allTexts[599]), std::bind(&CShipyardWindow::close, this), SDLK_ESCAPE);
|
|
quit = std::make_shared<CButton>(Point(224, 312), "ICANCEL", CButton::tooltip(CGI->generaltexth->allTexts[599]), std::bind(&CShipyardWindow::close, this), SDLK_ESCAPE);
|
|
build = std::make_shared<CButton>(Point(42, 312), "IBUY30", CButton::tooltip(CGI->generaltexth->allTexts[598]), std::bind(&CShipyardWindow::close, this), SDLK_RETURN);
|
|
build = std::make_shared<CButton>(Point(42, 312), "IBUY30", CButton::tooltip(CGI->generaltexth->allTexts[598]), std::bind(&CShipyardWindow::close, this), SDLK_RETURN);
|
|
build->addCallback(onBuy);
|
|
build->addCallback(onBuy);
|
|
|
|
|
|
- for(Res::ERes i = Res::WOOD; i <= Res::GOLD; vstd::advance(i, 1))
|
|
|
|
|
|
+ for(auto i = EGameResID::WOOD; i <= EGameResID::GOLD; vstd::advance(i, 1))
|
|
{
|
|
{
|
|
if(cost[i] > LOCPLINT->cb->getResourceAmount(i))
|
|
if(cost[i] > LOCPLINT->cb->getResourceAmount(i))
|
|
{
|
|
{
|
|
@@ -1141,7 +1141,7 @@ void CTransformerWindow::CItem::clickLeft(tribool down, bool previousState)
|
|
|
|
|
|
void CTransformerWindow::CItem::update()
|
|
void CTransformerWindow::CItem::update()
|
|
{
|
|
{
|
|
- icon->setFrame(parent->army->getCreature(SlotID(id))->idNumber + 2);
|
|
|
|
|
|
+ icon->setFrame(parent->army->getCreature(SlotID(id))->getId() + 2);
|
|
}
|
|
}
|
|
|
|
|
|
CTransformerWindow::CItem::CItem(CTransformerWindow * parent_, int size_, int id_)
|
|
CTransformerWindow::CItem::CItem(CTransformerWindow * parent_, int size_, int id_)
|
|
@@ -1157,7 +1157,7 @@ CTransformerWindow::CItem::CItem(CTransformerWindow * parent_, int size_, int id
|
|
|
|
|
|
pos.x += 45 + (id%3)*83 + id/6*83;
|
|
pos.x += 45 + (id%3)*83 + id/6*83;
|
|
pos.y += 109 + (id/3)*98;
|
|
pos.y += 109 + (id/3)*98;
|
|
- icon = std::make_shared<CAnimImage>("TWCRPORT", parent->army->getCreature(SlotID(id))->idNumber + 2);
|
|
|
|
|
|
+ icon = std::make_shared<CAnimImage>("TWCRPORT", parent->army->getCreature(SlotID(id))->getId() + 2);
|
|
count = std::make_shared<CLabel>(28, 76,FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(size));
|
|
count = std::make_shared<CLabel>(28, 76,FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(size));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1240,7 +1240,7 @@ void CUniversityWindow::CItem::clickLeft(tribool down, bool previousState)
|
|
if(previousState && (!down))
|
|
if(previousState && (!down))
|
|
{
|
|
{
|
|
if(state() == 2)
|
|
if(state() == 2)
|
|
- GH.pushIntT<CUnivConfirmWindow>(parent, ID, LOCPLINT->cb->getResourceAmount(Res::GOLD) >= 2000);
|
|
|
|
|
|
+ GH.pushIntT<CUnivConfirmWindow>(parent, ID, LOCPLINT->cb->getResourceAmount(EGameResID::GOLD) >= 2000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1346,7 +1346,7 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * owner_, int SKILL, bo
|
|
icon = std::make_shared<CAnimImage>("SECSKILL", SKILL*3+3, 0, 211, 51);
|
|
icon = std::make_shared<CAnimImage>("SECSKILL", SKILL*3+3, 0, 211, 51);
|
|
level = std::make_shared<CLabel>(230, 107, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->levels[1]);
|
|
level = std::make_shared<CLabel>(230, 107, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->levels[1]);
|
|
|
|
|
|
- costIcon = std::make_shared<CAnimImage>("RESOURCE", Res::GOLD, 0, 210, 210);
|
|
|
|
|
|
+ costIcon = std::make_shared<CAnimImage>("RESOURCE", GameResID(EGameResID::GOLD), 0, 210, 210);
|
|
cost = std::make_shared<CLabel>(230, 267, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, "2000");
|
|
cost = std::make_shared<CLabel>(230, 267, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, "2000");
|
|
|
|
|
|
std::string hoverText = CGI->generaltexth->allTexts[609];
|
|
std::string hoverText = CGI->generaltexth->allTexts[609];
|
|
@@ -1531,7 +1531,7 @@ void CHillFortWindow::updateGarrisons()
|
|
else//free upgrade - print gold image and "Free" text
|
|
else//free upgrade - print gold image and "Free" text
|
|
{
|
|
{
|
|
slotIcons[i][0]->visible = true;
|
|
slotIcons[i][0]->visible = true;
|
|
- slotIcons[i][0]->setFrame(Res::GOLD);
|
|
|
|
|
|
+ slotIcons[i][0]->setFrame(GameResID(EGameResID::GOLD));
|
|
slotLabels[i][0]->setText(CGI->generaltexth->allTexts[344]);
|
|
slotLabels[i][0]->setText(CGI->generaltexth->allTexts[344]);
|
|
}
|
|
}
|
|
}
|
|
}
|