mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Remove unused code, reduce includes
This commit is contained in:
parent
f1e63792f0
commit
01a9509ccb
@ -27,6 +27,7 @@
|
||||
#include "mapObjectConstructors/AObjectTypeHandler.h"
|
||||
#include "mapObjectConstructors/CObjectClassesHandler.h"
|
||||
#include "mapObjects/CGMarket.h"
|
||||
#include "mapObjects/CGTownBuilding.h"
|
||||
#include "mapObjects/CGTownInstance.h"
|
||||
#include "mapObjects/CObjectHandler.h"
|
||||
#include "mapObjects/CQuest.h"
|
||||
|
@ -242,28 +242,6 @@ void CTownHandler::loadBuildingRequirements(CBuilding * building, const JsonNode
|
||||
bidsToLoad.push_back(hlp);
|
||||
}
|
||||
|
||||
std::shared_ptr<Bonus> CTownHandler::createBonus(CBuilding * build, BonusType type, int val) const
|
||||
{
|
||||
return createBonus(build, type, val, BonusSubtypeID(), emptyPropagator());
|
||||
}
|
||||
|
||||
std::shared_ptr<Bonus> CTownHandler::createBonus(CBuilding * build, BonusType type, int val, BonusSubtypeID subtype) const
|
||||
{
|
||||
return createBonus(build, type, val, subtype, emptyPropagator());
|
||||
}
|
||||
|
||||
std::shared_ptr<Bonus> CTownHandler::createBonus(CBuilding * build, BonusType type, int val, BonusSubtypeID subtype, const TPropagatorPtr & prop) const
|
||||
{
|
||||
auto b = std::make_shared<Bonus>(BonusDuration::PERMANENT, type, BonusSource::TOWN_STRUCTURE, val, build->getUniqueTypeID(), subtype);
|
||||
|
||||
b->description.appendTextID(build->getNameTextID());
|
||||
|
||||
if(prop)
|
||||
b->addPropagator(prop);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
void CTownHandler::loadSpecialBuildingBonuses(const JsonNode & source, BonusList & bonusList, CBuilding * building)
|
||||
{
|
||||
for(const auto & b : source.Vector())
|
||||
|
@ -49,10 +49,6 @@ class DLL_LINKAGE CTownHandler : public CHandlerBase<FactionID, Faction, CFactio
|
||||
void loadBuilding(CTown * town, const std::string & stringID, const JsonNode & source);
|
||||
void loadBuildings(CTown * town, const JsonNode & source);
|
||||
|
||||
std::shared_ptr<Bonus> createBonus(CBuilding * build, BonusType type, int val) const;
|
||||
std::shared_ptr<Bonus> createBonus(CBuilding * build, BonusType type, int val, BonusSubtypeID subtype) const;
|
||||
std::shared_ptr<Bonus> createBonus(CBuilding * build, BonusType type, int val, BonusSubtypeID subtype, const TPropagatorPtr & prop) const;
|
||||
|
||||
/// loads CStructure's into town
|
||||
void loadStructure(CTown & town, const std::string & stringID, const JsonNode & source) const;
|
||||
void loadStructures(CTown & town, const JsonNode & source) const;
|
||||
|
@ -1253,4 +1253,11 @@ void CGTownInstance::fillUpgradeInfo(UpgradeInfo & info, const CStackInstance &s
|
||||
}
|
||||
}
|
||||
|
||||
void CGTownInstance::postDeserialize()
|
||||
{
|
||||
setNodeType(CBonusSystemNode::TOWN);
|
||||
for(auto * bonusingBuilding : bonusingBuildings)
|
||||
bonusingBuilding->town = this;
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -11,16 +11,18 @@
|
||||
|
||||
#include "IMarket.h"
|
||||
#include "CGDwelling.h"
|
||||
#include "CGTownBuilding.h"
|
||||
#include "../LogicalExpression.h"
|
||||
#include "../entities/faction/CFaction.h" // TODO: remove
|
||||
#include "../entities/faction/CTown.h" // TODO: remove
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
class CCastleEvent;
|
||||
class CTown;
|
||||
class CGTownBuilding;
|
||||
struct DamageRange;
|
||||
|
||||
template<typename ContainedClass>
|
||||
class LogicalExpression;
|
||||
|
||||
class DLL_LINKAGE CTownAndVisitingHero : public CBonusSystemNode
|
||||
{
|
||||
@ -87,10 +89,7 @@ public:
|
||||
h & spells;
|
||||
h & events;
|
||||
h & bonusingBuildings;
|
||||
|
||||
for(auto * bonusingBuilding : bonusingBuildings)
|
||||
bonusingBuilding->town = this;
|
||||
|
||||
|
||||
if (h.saving)
|
||||
{
|
||||
CFaction * faction = town ? town->faction : nullptr;
|
||||
@ -106,23 +105,10 @@ public:
|
||||
h & townAndVis;
|
||||
BONUS_TREE_DESERIALIZATION_FIX
|
||||
|
||||
if(town)
|
||||
{
|
||||
vstd::erase_if(builtBuildings, [this](BuildingID building) -> bool
|
||||
{
|
||||
if(!town->buildings.count(building) || !town->buildings.at(building))
|
||||
{
|
||||
logGlobal->error("#1444-like issue in CGTownInstance::serialize. From town %s at %s removing the bogus builtBuildings item %s", nameTextId, pos.toString(), building);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
h & overriddenBuildings;
|
||||
|
||||
if(!h.saving)
|
||||
this->setNodeType(CBonusSystemNode::TOWN);
|
||||
postDeserialize();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -130,6 +116,7 @@ public:
|
||||
std::string nodeName() const override;
|
||||
void updateMoraleBonusFromArmy() override;
|
||||
void deserializationFix();
|
||||
void postDeserialize();
|
||||
void recreateBuildingsBonuses();
|
||||
void setVisitingHero(CGHeroInstance *h);
|
||||
void setGarrisonedHero(CGHeroInstance *h);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "mapObjects/CBank.h"
|
||||
#include "mapObjects/CGCreature.h"
|
||||
#include "mapObjects/CGMarket.h"
|
||||
#include "mapObjects/CGTownBuilding.h"
|
||||
#include "mapObjects/CGTownInstance.h"
|
||||
#include "mapObjects/CQuest.h"
|
||||
#include "mapObjects/MiscObjects.h"
|
||||
|
@ -57,6 +57,7 @@
|
||||
|
||||
#include "../lib/mapObjects/CGCreature.h"
|
||||
#include "../lib/mapObjects/CGMarket.h"
|
||||
#include "../lib/mapObjects/CGTownBuilding.h"
|
||||
#include "../lib/mapObjects/CGTownInstance.h"
|
||||
#include "../lib/mapObjects/MiscObjects.h"
|
||||
#include "../lib/mapObjectConstructors/AObjectTypeHandler.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
#include "../../../lib/mapObjects/CGTownInstance.h"
|
||||
#include "../../../lib/json/JsonNode.h"
|
||||
|
||||
|
||||
namespace test
|
||||
|
Loading…
Reference in New Issue
Block a user