1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #4564 from IvanSavenko/stream_regressions_fix

Fixes for regressions found on stream
This commit is contained in:
Ivan Savenko 2024-09-04 23:37:15 +03:00 committed by GitHub
commit 6565b1d249
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 3 deletions

View File

@ -536,8 +536,15 @@ void CGDwelling::serializeJsonOptions(JsonSerializeFormat & handler)
const IOwnableObject * CGDwelling::asOwnable() const
{
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
{

View File

@ -1227,6 +1227,21 @@ BoatId CGShipyard::getBoatType() const
return createdBoat;
}
const IOwnableObject * CGShipyard::asOwnable() const
{
return this;
}
ResourceSet CGShipyard::dailyIncome() const
{
return {};
}
std::vector<CreatureID> CGShipyard::providedCreatures() const
{
return {};
}
void CGDenOfthieves::onHeroVisit (const CGHeroInstance * h) const
{
cb->showObjectWindow(this, EOpenWindowMode::THIEVES_GUILD, h, false);

View File

@ -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<CreatureID> providedCreatures() const override;
public:
using CGObjectInstance::CGObjectInstance;

View File

@ -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;