mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Final stabilization changes
This commit is contained in:
parent
99745b5c3c
commit
4e4dae854f
@ -198,13 +198,12 @@ public:
|
|||||||
num += change;
|
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; }
|
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; }
|
BaseForID & operator++() { ++num; return *this; }
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,7 @@ TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const
|
|||||||
TerrainType * info = new TerrainType;
|
TerrainType * info = new TerrainType;
|
||||||
|
|
||||||
info->id = TerrainId(index);
|
info->id = TerrainId(index);
|
||||||
|
info->name = identifier;
|
||||||
|
|
||||||
info->moveCost = static_cast<int>(json["moveCost"].Integer());
|
info->moveCost = static_cast<int>(json["moveCost"].Integer());
|
||||||
info->musicFilename = json["music"].String();
|
info->musicFilename = json["music"].String();
|
||||||
@ -145,6 +146,11 @@ std::vector<bool> TerrainTypeHandler::getDefaultAllowed() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RiverTypeHandler::RiverTypeHandler()
|
||||||
|
{
|
||||||
|
objects.push_back(new RiverType);
|
||||||
|
}
|
||||||
|
|
||||||
RiverType * RiverTypeHandler::loadFromJson(
|
RiverType * RiverTypeHandler::loadFromJson(
|
||||||
const std::string & scope,
|
const std::string & scope,
|
||||||
const JsonNode & json,
|
const JsonNode & json,
|
||||||
@ -153,6 +159,7 @@ RiverType * RiverTypeHandler::loadFromJson(
|
|||||||
{
|
{
|
||||||
RiverType * info = new RiverType;
|
RiverType * info = new RiverType;
|
||||||
|
|
||||||
|
info->id = RiverId(index);
|
||||||
info->fileName = json["animation"].String();
|
info->fileName = json["animation"].String();
|
||||||
info->code = json["code"].String();
|
info->code = json["code"].String();
|
||||||
info->deltaName = json["delta"].String();
|
info->deltaName = json["delta"].String();
|
||||||
@ -177,6 +184,11 @@ std::vector<bool> RiverTypeHandler::getDefaultAllowed() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RoadTypeHandler::RoadTypeHandler()
|
||||||
|
{
|
||||||
|
objects.push_back(new RoadType);
|
||||||
|
}
|
||||||
|
|
||||||
RoadType * RoadTypeHandler::loadFromJson(
|
RoadType * RoadTypeHandler::loadFromJson(
|
||||||
const std::string & scope,
|
const std::string & scope,
|
||||||
const JsonNode & json,
|
const JsonNode & json,
|
||||||
@ -185,6 +197,7 @@ RoadType * RoadTypeHandler::loadFromJson(
|
|||||||
{
|
{
|
||||||
RoadType * info = new RoadType;
|
RoadType * info = new RoadType;
|
||||||
|
|
||||||
|
info->id = RoadId(index);
|
||||||
info->fileName = json["animation"].String();
|
info->fileName = json["animation"].String();
|
||||||
info->code = json["code"].String();
|
info->code = json["code"].String();
|
||||||
info->movementCost = json["moveCost"].Integer();
|
info->movementCost = json["moveCost"].Integer();
|
||||||
@ -209,26 +222,6 @@ std::vector<bool> RoadTypeHandler::getDefaultAllowed() const
|
|||||||
return {};
|
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
|
bool TerrainType::isLand() const
|
||||||
{
|
{
|
||||||
return !isWater();
|
return !isWater();
|
||||||
@ -272,9 +265,12 @@ bool TerrainType::isTransitionRequired() const
|
|||||||
TerrainType::TerrainType()
|
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
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
@ -59,10 +59,6 @@ public:
|
|||||||
|
|
||||||
TerrainType();
|
TerrainType();
|
||||||
|
|
||||||
bool operator==(const TerrainType & other);
|
|
||||||
bool operator!=(const TerrainType & other);
|
|
||||||
bool operator<(const TerrainType & other);
|
|
||||||
|
|
||||||
bool isLand() const;
|
bool isLand() const;
|
||||||
bool isWater() const;
|
bool isWater() const;
|
||||||
bool isPassable() const;
|
bool isPassable() const;
|
||||||
@ -72,8 +68,6 @@ public:
|
|||||||
bool isSurfaceCartographerCompatible() const;
|
bool isSurfaceCartographerCompatible() const;
|
||||||
bool isUndergroundCartographerCompatible() const;
|
bool isUndergroundCartographerCompatible() const;
|
||||||
|
|
||||||
operator std::string() const;
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & battleFields;
|
h & battleFields;
|
||||||
@ -177,8 +171,6 @@ public:
|
|||||||
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
||||||
virtual std::vector<bool> getDefaultAllowed() const override;
|
virtual std::vector<bool> getDefaultAllowed() const override;
|
||||||
|
|
||||||
// TerrainType * getInfoByCode(const std::string & identifier);
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
h & objects;
|
h & objects;
|
||||||
@ -194,12 +186,12 @@ public:
|
|||||||
const std::string & identifier,
|
const std::string & identifier,
|
||||||
size_t index) override;
|
size_t index) override;
|
||||||
|
|
||||||
|
RiverTypeHandler();
|
||||||
|
|
||||||
virtual const std::vector<std::string> & getTypeNames() const override;
|
virtual const std::vector<std::string> & getTypeNames() const override;
|
||||||
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
||||||
virtual std::vector<bool> getDefaultAllowed() const override;
|
virtual std::vector<bool> getDefaultAllowed() const override;
|
||||||
|
|
||||||
// RiverType * getInfoByCode(const std::string & identifier);
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
h & objects;
|
h & objects;
|
||||||
@ -215,12 +207,12 @@ public:
|
|||||||
const std::string & identifier,
|
const std::string & identifier,
|
||||||
size_t index) override;
|
size_t index) override;
|
||||||
|
|
||||||
|
RoadTypeHandler();
|
||||||
|
|
||||||
virtual const std::vector<std::string> & getTypeNames() const override;
|
virtual const std::vector<std::string> & getTypeNames() const override;
|
||||||
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
virtual std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
||||||
virtual std::vector<bool> getDefaultAllowed() const override;
|
virtual std::vector<bool> getDefaultAllowed() const override;
|
||||||
|
|
||||||
// RoadType * getInfoByCode(const std::string & identifier);
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
h & objects;
|
h & objects;
|
||||||
|
@ -285,9 +285,6 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
|
|||||||
anyTerrain = true;
|
anyTerrain = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(withTerrain && allowedTerrains.empty())
|
|
||||||
logGlobal->warn("Loaded template %s without allowed terrains!", animationFile);
|
|
||||||
|
|
||||||
auto charToTile = [&](const char & ch) -> ui8
|
auto charToTile = [&](const char & ch) -> ui8
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
|
Loading…
Reference in New Issue
Block a user