mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
parent
f0db9f32c9
commit
b68220d1c3
@ -362,7 +362,7 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet
|
|||||||
{
|
{
|
||||||
if(elem->obstacleType == CObstacleInstance::USUAL)
|
if(elem->obstacleType == CObstacleInstance::USUAL)
|
||||||
{
|
{
|
||||||
std::string animationName = elem->getInfo().animation;
|
std::string animationName = elem->getInfo().defName;
|
||||||
|
|
||||||
auto cached = animationsCache.find(animationName);
|
auto cached = animationsCache.find(animationName);
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ CBattleInterface::CBattleInterface(const CCreatureSet *army1, const CCreatureSet
|
|||||||
}
|
}
|
||||||
else if (elem->obstacleType == CObstacleInstance::ABSOLUTE_OBSTACLE)
|
else if (elem->obstacleType == CObstacleInstance::ABSOLUTE_OBSTACLE)
|
||||||
{
|
{
|
||||||
std::string animationName = elem->getInfo().animation;
|
std::string animationName = elem->getInfo().defName;
|
||||||
|
|
||||||
auto cached = animationsCache.find(animationName);
|
auto cached = animationsCache.find(animationName);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
|||||||
"$schema": "http://json-schema.org/draft-04/schema",
|
"$schema": "http://json-schema.org/draft-04/schema",
|
||||||
"title" : "VCMI obstacle format",
|
"title" : "VCMI obstacle format",
|
||||||
"description" : "Format used to define new obstacles in VCMI",
|
"description" : "Format used to define new obstacles in VCMI",
|
||||||
"required" : [ "animation" ],
|
"required" : [ "defname" ],
|
||||||
|
|
||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
"properties":{
|
"properties":{
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"description": "Blocked hexes - absolute or relative hex id",
|
"description": "Blocked hexes - absolute or relative hex id",
|
||||||
"items": { "type" : "number" }
|
"items": { "type" : "number" }
|
||||||
},
|
},
|
||||||
"animation": {
|
"defname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Image resource"
|
"description": "Image resource"
|
||||||
},
|
},
|
||||||
|
@ -80,9 +80,9 @@ ObstacleInfo * ObstacleHandler::loadFromJson(const std::string & scope, const Js
|
|||||||
{
|
{
|
||||||
auto * info = new ObstacleInfo(Obstacle(index), identifier);
|
auto * info = new ObstacleInfo(Obstacle(index), identifier);
|
||||||
|
|
||||||
info->animation = json["animation"].String();
|
info->defName = json["defname"].String();
|
||||||
info->width = json["width"].Integer();
|
info->width = static_cast<si32>(json["width"].Float());
|
||||||
info->height = json["height"].Integer();
|
info->height = static_cast<si32>(json["height"].Float());
|
||||||
for(auto & t : json["allowedTerrain"].Vector())
|
for(auto & t : json["allowedTerrain"].Vector())
|
||||||
info->allowedTerrains.emplace_back(t.String());
|
info->allowedTerrains.emplace_back(t.String());
|
||||||
for(auto & t : json["specialBattlefields"].Vector())
|
for(auto & t : json["specialBattlefields"].Vector())
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
#include "Terrain.h"
|
#include "Terrain.h"
|
||||||
#include "battle/BattleHex.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)
|
ObstacleInfo(): obstacle(-1), width(0), height(0), isAbsoluteObstacle(false), iconIndex(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -30,13 +29,10 @@ public:
|
|||||||
Obstacle obstacle;
|
Obstacle obstacle;
|
||||||
si32 iconIndex;
|
si32 iconIndex;
|
||||||
std::string identifier;
|
std::string identifier;
|
||||||
std::string appearAnimation, animation, dissapearAnimation;
|
std::string defName;
|
||||||
std::vector<Terrain> allowedTerrains;
|
std::vector<Terrain> allowedTerrains;
|
||||||
std::vector<std::string> allowedSpecialBfields;
|
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
|
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)
|
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)
|
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)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & obstacle;
|
h & obstacle;
|
||||||
h & obstacleType;
|
|
||||||
h & iconIndex;
|
h & iconIndex;
|
||||||
h & identifier;
|
h & identifier;
|
||||||
h & animation;
|
h & defName;
|
||||||
h & appearAnimation;
|
|
||||||
h & dissapearAnimation;
|
|
||||||
h & allowedTerrains;
|
h & allowedTerrains;
|
||||||
h & allowedSpecialBfields;
|
h & allowedSpecialBfields;
|
||||||
h & isAbsoluteObstacle;
|
h & isAbsoluteObstacle;
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
#include "../ConstTransitivePtr.h"
|
#include "../ConstTransitivePtr.h"
|
||||||
#include "../GameConstants.h"
|
#include "../GameConstants.h"
|
||||||
|
|
||||||
const ui32 SERIALIZATION_VERSION = 804;
|
const ui32 SERIALIZATION_VERSION = 803;
|
||||||
const ui32 MINIMAL_SERIALIZATION_VERSION = 804;
|
const ui32 MINIMAL_SERIALIZATION_VERSION = 803;
|
||||||
const std::string SAVEGAME_MAGIC = "VCMISVG";
|
const std::string SAVEGAME_MAGIC = "VCMISVG";
|
||||||
|
|
||||||
class CHero;
|
class CHero;
|
||||||
|
Loading…
Reference in New Issue
Block a user