1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Removed remaining cases of serialization of VLC entities

This commit is contained in:
Ivan Savenko
2024-10-12 18:19:58 +00:00
parent c1e125b186
commit 01d787fb5a
12 changed files with 33 additions and 43 deletions

View File

@ -359,8 +359,11 @@ public:
h & boat;
if (h.version < Handler::Version::REMOVE_TOWN_PTR)
{
CHero * type = nullptr;
h & type;
HeroTypeID type;
bool isNull = false;
h & isNull;
if(!isNull)
h & type;
}
h & commander;
h & visitedObjects;

View File

@ -68,11 +68,8 @@ std::vector<TradeItemBuy> CGBlackMarket::availableItemsIds(EMarketMode mode) con
case EMarketMode::RESOURCE_ARTIFACT:
{
std::vector<TradeItemBuy> ret;
for(const CArtifact *a : artifacts)
if(a)
ret.push_back(a->getId());
else
ret.push_back(ArtifactID{});
for(const auto & a : artifacts)
ret.push_back(a);
return ret;
}
default:

View File

@ -63,7 +63,7 @@ class DLL_LINKAGE CGBlackMarket : public CGMarket
public:
using CGMarket::CGMarket;
std::vector<const CArtifact *> artifacts; //available artifacts
std::vector<ArtifactID> artifacts; //available artifacts
void newTurn(vstd::RNG & rand) const override; //reset artifacts for black market every month
std::vector<TradeItemBuy> availableItemsIds(EMarketMode mode) const override;

View File

@ -670,11 +670,9 @@ std::vector<TradeItemBuy> CGTownInstance::availableItemsIds(EMarketMode mode) co
if(mode == EMarketMode::RESOURCE_ARTIFACT)
{
std::vector<TradeItemBuy> ret;
for(const CArtifact *a : cb->gameState()->map->townMerchantArtifacts)
if(a)
ret.push_back(a->getId());
else
ret.push_back(ArtifactID{});
for(const ArtifactID a : cb->gameState()->map->townMerchantArtifacts)
ret.push_back(a);
return ret;
}
else if ( mode == EMarketMode::RESOURCE_SKILL )

View File

@ -114,19 +114,11 @@ public:
if (h.version < Handler::Version::REMOVE_TOWN_PTR)
{
CTown * town = nullptr;
if (h.saving)
{
CFaction * faction = town ? town->faction : nullptr;
FactionID faction;
bool isNull = false;
h & isNull;
if (!isNull)
h & faction;
}
else
{
CFaction * faction = nullptr;
h & faction;
town = faction ? faction->town : nullptr;
}
}
h & townAndVis;