mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +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:
@@ -844,9 +844,20 @@ bool CCastleBuildings::buildingTryActivateCustomUI(BuildingID buildingToTest, Bu
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCastleBuildings::enterRewardable(BuildingID building)
|
void CCastleBuildings::enterRewardable(BuildingID 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);
|
LOCPLINT->cb->visitTownBuilding(town, building);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CCastleBuildings::enterBlacksmith(BuildingID building, ArtifactID artifactID)
|
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 ]
|
"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
|
// 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,
|
"manualHeroVisit" : false,
|
||||||
|
|
||||||
// Bonuses provided by this special building if this building or any of its upgrades are constructed in town
|
// 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))
|
if (t->rewardableBuildings.count(bid))
|
||||||
{
|
{
|
||||||
auto & hero = t->garrisonHero ? t->garrisonHero : t->visitingHero;
|
auto & hero = t->visitingHero;
|
||||||
auto * building = t->rewardableBuildings.at(bid);
|
auto * building = t->rewardableBuildings.at(bid);
|
||||||
|
|
||||||
if (hero && t->town->buildings.at(bid)->manualHeroVisit)
|
if (hero && t->town->buildings.at(bid)->manualHeroVisit)
|
||||||
|
|||||||
Reference in New Issue
Block a user