mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix abandoned map crash
This commit is contained in:
parent
e2b5ff13f1
commit
8406e3e4cd
@ -196,6 +196,8 @@ public:
|
||||
GameResID producedResource;
|
||||
ui32 producedQuantity;
|
||||
std::set<GameResID> abandonedMineResources;
|
||||
|
||||
bool isAbandoned() const;
|
||||
|
||||
private:
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
@ -209,7 +211,6 @@ private:
|
||||
std::string getObjectName() const override;
|
||||
std::string getHoverText(PlayerColor player) const override;
|
||||
|
||||
bool isAbandoned() const;
|
||||
public:
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
@ -184,8 +184,16 @@ void Initializer::initialize(CGMine * o)
|
||||
if(!o) return;
|
||||
|
||||
o->tempOwner = defaultPlayer;
|
||||
o->producedResource = GameResID(o->subID);
|
||||
o->producedQuantity = o->defaultResProduction();
|
||||
if(o->isAbandoned())
|
||||
{
|
||||
for(auto r = GameResID(0); r < GameResID::COUNT; ++r)
|
||||
o->abandonedMineResources.insert(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
o->producedResource = GameResID(o->subID);
|
||||
o->producedQuantity = o->defaultResProduction();
|
||||
}
|
||||
}
|
||||
|
||||
void Initializer::initialize(CGResource * o)
|
||||
|
Loading…
Reference in New Issue
Block a user