mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
backend
This commit is contained in:
parent
072af5bd6d
commit
47327e1642
@ -1060,11 +1060,9 @@ void CCastleBuildings::enterAnyThievesGuild()
|
||||
|
||||
void CCastleBuildings::enterBank()
|
||||
{
|
||||
//town
|
||||
LOCPLINT->cb->triggerTownSpecialBuildingAction(town, BuildingSubID::BANK);
|
||||
|
||||
LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.adventureMap.noTownWithTavern"));
|
||||
//LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[214], onYes, onNo, components);
|
||||
std::vector<std::shared_ptr<CComponent>> components;
|
||||
components.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, GameResID::GOLD, 2500));
|
||||
LOCPLINT->showYesNoDialog(CGI->generaltexth->translate("vcmi.adventureMap.noTownWithTavern"), [this](){ LOCPLINT->cb->triggerTownSpecialBuildingAction(town, BuildingSubID::BANK); }, nullptr, components);
|
||||
}
|
||||
|
||||
void CCastleBuildings::enterAnyMarket()
|
||||
|
@ -619,6 +619,14 @@ void CGTownInstance::newTurn(vstd::RNG & rand) const
|
||||
|
||||
for(const auto * rewardableBuilding : getBonusingBuildings(BuildingSubID::CUSTOM_VISITING_REWARD))
|
||||
rewardableBuilding->newTurn(rand);
|
||||
|
||||
if(hasBuilt(BuildingSubID::BANK) && bonusValue.second > 0)
|
||||
{
|
||||
TResources res;
|
||||
res[EGameResID::GOLD] = -500;
|
||||
cb->giveResources(getOwner(), res);
|
||||
cb->setObjPropertyValue(id, ObjProperty::BONUS_VALUE_SECOND, bonusValue.second - 500);
|
||||
}
|
||||
}
|
||||
/*
|
||||
int3 CGTownInstance::getSightCenter() const
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
std::vector<SpellID> possibleSpells, obligatorySpells;
|
||||
std::vector<std::vector<SpellID> > spells; //spells[level] -> vector of spells, first will be available in guild
|
||||
std::list<CCastleEvent> events;
|
||||
std::pair<si32, si32> bonusValue;//var to store town bonuses (rampart = resources from mystic pond);
|
||||
std::pair<si32, si32> bonusValue;//var to store town bonuses (rampart = resources from mystic pond, factory = save debts);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <typename Handler> void serialize(Handler &h)
|
||||
|
@ -2477,16 +2477,17 @@ bool CGameHandler::triggerTownSpecialBuildingAction(ObjectInstanceID tid, Buildi
|
||||
for (auto building : t->town->buildings)
|
||||
if(vstd::contains(t->builtBuildings, building.first) && building.second->subId == sid)
|
||||
hasBuilding = true;
|
||||
|
||||
|
||||
if(!hasBuilding)
|
||||
return false;
|
||||
|
||||
|
||||
if(sid == BuildingSubID::EBuildingSubID::BANK)
|
||||
{
|
||||
TResources res;
|
||||
res[EGameResID::GOLD] = 2500;
|
||||
giveResources(t->getOwner(), res);
|
||||
|
||||
setObjPropertyValue(t->id, ObjProperty::BONUS_VALUE_SECOND, 2500);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user