1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +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

@@ -1176,6 +1176,31 @@ TerrainId CGTownInstance::getNativeTerrain() const
return town->faction->getNativeTerrain();
}
ArtifactID CGTownInstance::getWarMachineInBuilding(BuildingID building) const
{
if (builtBuildings.count(building) == 0)
return ArtifactID::NONE;
if (building == BuildingID::BLACKSMITH && town->warMachineDeprecated.hasValue())
return town->warMachineDeprecated.toCreature()->warMachine;
return town->buildings.at(building)->warMachine;
}
bool CGTownInstance::isWarMachineAvailable(ArtifactID warMachine) const
{
for (auto const & buildingID : builtBuildings)
if (town->buildings.at(buildingID)->warMachine == warMachine)
return true;
if (builtBuildings.count(BuildingID::BLACKSMITH) &&
town->warMachineDeprecated.hasValue() &&
town->warMachineDeprecated.toCreature()->warMachine == warMachine)
return true;
return false;
}
GrowthInfo::Entry::Entry(const std::string &format, int _count)
: count(_count)
{