1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Implemented configurable blacksmith. Deprecated ballistaYard type

This commit is contained in:
Ivan Savenko
2024-08-23 15:29:47 +00:00
parent 175f6716d2
commit 8ef8ffa5c4
26 changed files with 85 additions and 73 deletions

View File

@@ -686,6 +686,12 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
logGlobal->trace("You've clicked on %d", (int)building.toEnum());
const CBuilding *b = town->town->buildings.find(building)->second;
if (town->getWarMachineInBuilding(building).hasValue())
{
enterBlacksmith(building, town->getWarMachineInBuilding(building));
return;
}
if (building >= BuildingID::DWELL_FIRST)
{
enterDwelling((BuildingID::getLevelFromDwelling(building)));
@@ -734,10 +740,6 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
enterBuilding(building);
break;
case BuildingID::BLACKSMITH:
enterBlacksmith(town->town->warMachine);
break;
case BuildingID::SHIP:
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
break;
@@ -799,10 +801,6 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
enterDwelling(town->town->creatures.size());
break;
case BuildingSubID::BALLISTA_YARD:
enterBlacksmith(ArtifactID::BALLISTA);
break;
case BuildingSubID::THIEVES_GUILD:
enterAnyThievesGuild();
break;
@@ -827,12 +825,12 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
}
}
void CCastleBuildings::enterBlacksmith(ArtifactID artifactID)
void CCastleBuildings::enterBlacksmith(BuildingID building, ArtifactID artifactID)
{
const CGHeroInstance *hero = town->visitingHero;
if(!hero)
{
LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % town->town->buildings.find(BuildingID::BLACKSMITH)->second->getNameTranslated()));
LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % town->town->buildings.find(building)->second->getNameTranslated()));
return;
}
auto art = artifactID.toArtifact();
@@ -854,8 +852,9 @@ void CCastleBuildings::enterBlacksmith(ArtifactID artifactID)
}
}
}
CreatureID cre = art->getWarMachine();
GH.windows().createAndPushWindow<CBlacksmithDialog>(possible, cre, artifactID, hero->id);
CreatureID creatureID = artifactID.toArtifact()->getWarMachine();
GH.windows().createAndPushWindow<CBlacksmithDialog>(possible, creatureID, artifactID, hero->id);
}
void CCastleBuildings::enterBuilding(BuildingID building)