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

Final stabilization changes

This commit is contained in:
Ivan Savenko 2022-12-21 00:04:39 +02:00
parent 99745b5c3c
commit 4e4dae854f
4 changed files with 26 additions and 42 deletions

View File

@ -198,13 +198,12 @@ public:
num += change;
}
typedef BaseForID<Derived, NumericType> __SelfType;
bool operator == (const BaseForID & b) const { return num == b.num; }
bool operator <= (const BaseForID & b) const { return num >= b.num; }
bool operator >= (const BaseForID & b) const { return num <= b.num; }
bool operator <= (const BaseForID & b) const { return num <= b.num; }
bool operator >= (const BaseForID & b) const { return num >= b.num; }
bool operator != (const BaseForID & b) const { return num != b.num; }
bool operator < (const BaseForID & b) const { return num < b.num; }
bool operator > (const BaseForID & b) const { return num > b.num; }
bool operator > (const BaseForID & b) const { return num > b.num; }
BaseForID & operator++() { ++num; return *this; }
};

View File

@ -38,6 +38,7 @@ TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const
TerrainType * info = new TerrainType;
info->id = TerrainId(index);
info->name = identifier;
info->moveCost = static_cast<int>(json["moveCost"].Integer());
info->musicFilename = json["music"].String();
@ -145,6 +146,11 @@ std::vector<bool> TerrainTypeHandler::getDefaultAllowed() const
return {};
}
RiverTypeHandler::RiverTypeHandler()
{
objects.push_back(new RiverType);
}
RiverType * RiverTypeHandler::loadFromJson(
const std::string & scope,
const JsonNode & json,
@ -153,6 +159,7 @@ RiverType * RiverTypeHandler::loadFromJson(
{
RiverType * info = new RiverType;
info->id = RiverId(index);
info->fileName = json["animation"].String();
info->code = json["code"].String();
info->deltaName = json["delta"].String();
@ -177,6 +184,11 @@ std::vector<bool> RiverTypeHandler::getDefaultAllowed() const
return {};
}
RoadTypeHandler::RoadTypeHandler()
{
objects.push_back(new RoadType);
}
RoadType * RoadTypeHandler::loadFromJson(
const std::string & scope,
const JsonNode & json,
@ -185,6 +197,7 @@ RoadType * RoadTypeHandler::loadFromJson(
{
RoadType * info = new RoadType;
info->id = RoadId(index);
info->fileName = json["animation"].String();
info->code = json["code"].String();
info->movementCost = json["moveCost"].Integer();
@ -209,26 +222,6 @@ std::vector<bool> RoadTypeHandler::getDefaultAllowed() const
return {};
}
TerrainType::operator std::string() const
{
return name;
}
bool TerrainType::operator==(const TerrainType& other)
{
return id == other.id;
}
bool TerrainType::operator!=(const TerrainType& other)
{
return id != other.id;
}
bool TerrainType::operator<(const TerrainType& other)
{
return id < other.id;
}
bool TerrainType::isLand() const
{
return !isWater();
@ -272,9 +265,12 @@ bool TerrainType::isTransitionRequired() const
TerrainType::TerrainType()
{}
RiverType::RiverType()
RiverType::RiverType():
id(River::NO_RIVER)
{}
RoadType::RoadType()
RoadType::RoadType():
id(Road::NO_ROAD),
movementCost(GameConstants::BASE_MOVEMENT_COST)
{}
VCMI_LIB_NAMESPACE_END

View File

@ -59,10 +59,6 @@ public:
TerrainType();
bool operator==(const TerrainType & other);
bool operator!=(const TerrainType & other);
bool operator<(const TerrainType & other);
bool isLand() const;
bool isWater() const;
bool isPassable() const;
@ -71,9 +67,7 @@ public:
bool isTransitionRequired() const;
bool isSurfaceCartographerCompatible() const;
bool isUndergroundCartographerCompatible() const;
operator std::string() const;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & battleFields;
@ -177,8 +171,6 @@ public:
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
virtual std::vector<bool> getDefaultAllowed() const override;
// TerrainType * getInfoByCode(const std::string & identifier);
template <typename Handler> void serialize(Handler & h, const int version)
{
h & objects;
@ -194,12 +186,12 @@ public:
const std::string & identifier,
size_t index) override;
RiverTypeHandler();
virtual const std::vector<std::string> & getTypeNames() const override;
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
virtual std::vector<bool> getDefaultAllowed() const override;
// RiverType * getInfoByCode(const std::string & identifier);
template <typename Handler> void serialize(Handler & h, const int version)
{
h & objects;
@ -215,12 +207,12 @@ public:
const std::string & identifier,
size_t index) override;
RoadTypeHandler();
virtual const std::vector<std::string> & getTypeNames() const override;
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
virtual std::vector<bool> getDefaultAllowed() const override;
// RoadType * getInfoByCode(const std::string & identifier);
template <typename Handler> void serialize(Handler & h, const int version)
{
h & objects;

View File

@ -285,9 +285,6 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
anyTerrain = true;
}
if(withTerrain && allowedTerrains.empty())
logGlobal->warn("Loaded template %s without allowed terrains!", animationFile);
auto charToTile = [&](const char & ch) -> ui8
{
switch (ch)