diff --git a/lib/mapObjects/CGDwelling.cpp b/lib/mapObjects/CGDwelling.cpp index 4c8e473fb..983194342 100644 --- a/lib/mapObjects/CGDwelling.cpp +++ b/lib/mapObjects/CGDwelling.cpp @@ -536,7 +536,14 @@ void CGDwelling::serializeJsonOptions(JsonSerializeFormat & handler) const IOwnableObject * CGDwelling::asOwnable() const { - return this; + switch (ID.toEnum()) + { + case Obj::WAR_MACHINE_FACTORY: + case Obj::REFUGEE_CAMP: + return nullptr; // can't be owned + default: + return this; + } } ResourceSet CGDwelling::dailyIncome() const diff --git a/lib/mapObjects/MiscObjects.cpp b/lib/mapObjects/MiscObjects.cpp index a9f18cb55..4a9b589d4 100644 --- a/lib/mapObjects/MiscObjects.cpp +++ b/lib/mapObjects/MiscObjects.cpp @@ -1227,6 +1227,21 @@ BoatId CGShipyard::getBoatType() const return createdBoat; } +const IOwnableObject * CGShipyard::asOwnable() const +{ + return this; +} + +ResourceSet CGShipyard::dailyIncome() const +{ + return {}; +} + +std::vector CGShipyard::providedCreatures() const +{ + return {}; +} + void CGDenOfthieves::onHeroVisit (const CGHeroInstance * h) const { cb->showObjectWindow(this, EOpenWindowMode::THIEVES_GUILD, h, false); diff --git a/lib/mapObjects/MiscObjects.h b/lib/mapObjects/MiscObjects.h index 58366c167..862d52596 100644 --- a/lib/mapObjects/MiscObjects.h +++ b/lib/mapObjects/MiscObjects.h @@ -346,7 +346,7 @@ public: } }; -class DLL_LINKAGE CGShipyard : public CGObjectInstance, public IShipyard +class DLL_LINKAGE CGShipyard : public CGObjectInstance, public IShipyard, public IOwnableObject { friend class ShipyardInstanceConstructor; @@ -358,6 +358,10 @@ protected: const IObjectInterface * getObject() const override; BoatId getBoatType() const override; + const IOwnableObject * asOwnable() const final; + ResourceSet dailyIncome() const override; + std::vector providedCreatures() const override; + public: using CGObjectInstance::CGObjectInstance; diff --git a/server/processors/NewTurnProcessor.cpp b/server/processors/NewTurnProcessor.cpp index be883645a..a81481987 100644 --- a/server/processors/NewTurnProcessor.cpp +++ b/server/processors/NewTurnProcessor.cpp @@ -280,7 +280,7 @@ SetAvailableCreatures NewTurnProcessor::generateTownGrowth(const CGTownInstance if (weekType == EWeekType::PLAGUE) resultingCreatures = creaturesBefore / 2; - else if (weekType == EWeekType::DOUBLE_GROWTH) + else if (weekType == EWeekType::DOUBLE_GROWTH && vstd::contains(t->creatures.at(k).second, creatureWeek)) resultingCreatures = (creaturesBefore + creatureGrowth) * 2; else resultingCreatures = creaturesBefore + creatureGrowth;