mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Only visiting heroes can now activate manual rewardable buildings
- This is more clear - in case if building generates queries - Avoids some edge cases, like what to do if building is single-use and town has 2 heroes - In line with hota version of this feature
This commit is contained in:
parent
c2dc88bf06
commit
1d7a89c79b
@ -845,7 +845,18 @@ bool CCastleBuildings::buildingTryActivateCustomUI(BuildingID buildingToTest, Bu
|
||||
|
||||
void CCastleBuildings::enterRewardable(BuildingID building)
|
||||
{
|
||||
LOCPLINT->cb->visitTownBuilding(town, building);
|
||||
if (town->visitingHero == nullptr)
|
||||
{
|
||||
MetaString message;
|
||||
message.appendTextID("core.genrltxt.273"); // only visiting heroes may visit %s
|
||||
message.replaceTextID(town->town->buildings.at(building)->getNameTextID());
|
||||
|
||||
LOCPLINT->showInfoDialog(message.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOCPLINT->cb->visitTownBuilding(town, building);
|
||||
}
|
||||
}
|
||||
|
||||
void CCastleBuildings::enterBlacksmith(BuildingID building, ArtifactID artifactID)
|
||||
|
@ -197,6 +197,7 @@ These are just a couple of examples of what can be done in VCMI. See vcmi config
|
||||
"bonuses" : [ BONUS_FORMAT ]
|
||||
|
||||
// If set to true, this building will not automatically activate on new day or on entering town and needs to be activated manually on click
|
||||
// Note that such building can only be activated by visiting hero, and not by garrisoned hero.
|
||||
"manualHeroVisit" : false,
|
||||
|
||||
// Bonuses provided by this special building if this building or any of its upgrades are constructed in town
|
||||
|
@ -2175,7 +2175,7 @@ bool CGameHandler::visitTownBuilding(ObjectInstanceID tid, BuildingID bid)
|
||||
|
||||
if (t->rewardableBuildings.count(bid))
|
||||
{
|
||||
auto & hero = t->garrisonHero ? t->garrisonHero : t->visitingHero;
|
||||
auto & hero = t->visitingHero;
|
||||
auto * building = t->rewardableBuildings.at(bid);
|
||||
|
||||
if (hero && t->town->buildings.at(bid)->manualHeroVisit)
|
||||
|
Loading…
Reference in New Issue
Block a user