|
@@ -686,6 +686,12 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
|
|
logGlobal->trace("You've clicked on %d", (int)building.toEnum());
|
|
logGlobal->trace("You've clicked on %d", (int)building.toEnum());
|
|
const CBuilding *b = town->town->buildings.find(building)->second;
|
|
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)
|
|
if (building >= BuildingID::DWELL_FIRST)
|
|
{
|
|
{
|
|
enterDwelling((BuildingID::getLevelFromDwelling(building)));
|
|
enterDwelling((BuildingID::getLevelFromDwelling(building)));
|
|
@@ -734,10 +740,6 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
|
|
enterBuilding(building);
|
|
enterBuilding(building);
|
|
break;
|
|
break;
|
|
|
|
|
|
- case BuildingID::BLACKSMITH:
|
|
|
|
- enterBlacksmith(town->town->warMachine);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
case BuildingID::SHIP:
|
|
case BuildingID::SHIP:
|
|
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
|
|
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
|
|
break;
|
|
break;
|
|
@@ -799,10 +801,6 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
|
|
enterDwelling(town->town->creatures.size());
|
|
enterDwelling(town->town->creatures.size());
|
|
break;
|
|
break;
|
|
|
|
|
|
- case BuildingSubID::BALLISTA_YARD:
|
|
|
|
- enterBlacksmith(ArtifactID::BALLISTA);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
case BuildingSubID::THIEVES_GUILD:
|
|
case BuildingSubID::THIEVES_GUILD:
|
|
enterAnyThievesGuild();
|
|
enterAnyThievesGuild();
|
|
break;
|
|
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;
|
|
const CGHeroInstance *hero = town->visitingHero;
|
|
if(!hero)
|
|
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;
|
|
return;
|
|
}
|
|
}
|
|
auto art = artifactID.toArtifact();
|
|
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)
|
|
void CCastleBuildings::enterBuilding(BuildingID building)
|