1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00

Revert "Minor fixes"

This reverts commit 108470471e.
This commit is contained in:
nordsoft 2022-09-04 15:47:47 +04:00
parent f0db9f32c9
commit b68220d1c3
6 changed files with 138 additions and 145 deletions

View File

@ -362,7 +362,7 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet
{
if(elem->obstacleType == CObstacleInstance::USUAL)
{
std::string animationName = elem->getInfo().animation;
std::string animationName = elem->getInfo().defName;
auto cached = animationsCache.find(animationName);
@ -380,7 +380,7 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet
}
else if (elem->obstacleType == CObstacleInstance::ABSOLUTE_OBSTACLE)
{
std::string animationName = elem->getInfo().animation;
std::string animationName = elem->getInfo().defName;
auto cached = animationsCache.find(animationName);

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"$schema": "http://json-schema.org/draft-04/schema",
"title" : "VCMI obstacle format",
"description" : "Format used to define new obstacles in VCMI",
"required" : [ "animation" ],
"required" : [ "defname" ],
"additionalProperties" : false,
"properties":{
@ -30,7 +30,7 @@
"description": "Blocked hexes - absolute or relative hex id",
"items": { "type" : "number" }
},
"animation": {
"defname": {
"type": "string",
"description": "Image resource"
},

View File

@ -80,9 +80,9 @@ ObstacleInfo * ObstacleHandler::loadFromJson(const std::string & scope, const Js
{
auto * info = new ObstacleInfo(Obstacle(index), identifier);
info->animation = json["animation"].String();
info->width = json["width"].Integer();
info->height = json["height"].Integer();
info->defName = json["defname"].String();
info->width = static_cast<si32>(json["width"].Float());
info->height = static_cast<si32>(json["height"].Float());
for(auto & t : json["allowedTerrain"].Vector())
info->allowedTerrains.emplace_back(t.String());
for(auto & t : json["specialBattlefields"].Vector())

View File

@ -16,9 +16,8 @@
#include "Terrain.h"
#include "battle/BattleHex.h"
class DLL_LINKAGE ObstacleInfo : public EntityT<Obstacle>
struct DLL_LINKAGE ObstacleInfo : public EntityT<Obstacle>
{
public:
ObstacleInfo(): obstacle(-1), width(0), height(0), isAbsoluteObstacle(false), iconIndex(0)
{}
@ -30,13 +29,10 @@ public:
Obstacle obstacle;
si32 iconIndex;
std::string identifier;
std::string appearAnimation, animation, dissapearAnimation;
std::string defName;
std::vector<Terrain> allowedTerrains;
std::vector<std::string> allowedSpecialBfields;
//TODO: here is extra field to implement it's logic in the future but save backward compatibility
int obstacleType = -1;
ui8 isAbsoluteObstacle; //there may only one such obstacle in battle and its position is always the same
si32 width, height; //how much space to the right and up is needed to place obstacle (affects only placement algorithm)
std::vector<si16> blockedTiles; //offsets relative to obstacle position (that is its left bottom corner)
@ -55,12 +51,9 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & obstacle;
h & obstacleType;
h & iconIndex;
h & identifier;
h & animation;
h & appearAnimation;
h & dissapearAnimation;
h & defName;
h & allowedTerrains;
h & allowedSpecialBfields;
h & isAbsoluteObstacle;

View File

@ -12,8 +12,8 @@
#include "../ConstTransitivePtr.h"
#include "../GameConstants.h"
const ui32 SERIALIZATION_VERSION = 804;
const ui32 MINIMAL_SERIALIZATION_VERSION = 804;
const ui32 SERIALIZATION_VERSION = 803;
const ui32 MINIMAL_SERIALIZATION_VERSION = 803;
const std::string SAVEGAME_MAGIC = "VCMISVG";
class CHero;