mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
Obstacles works fine without regression
This commit is contained in:
parent
9bb8f2a971
commit
c3276f2276
@ -88,5 +88,9 @@
|
|||||||
"battlefields":
|
"battlefields":
|
||||||
[
|
[
|
||||||
"config/battlefields.json"
|
"config/battlefields.json"
|
||||||
|
],
|
||||||
|
"obstacles":
|
||||||
|
[
|
||||||
|
"config/obstacles.json"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"type":"object",
|
"type":"object",
|
||||||
"$schema": "http://json-schema.org/draft-04/schema",
|
"$schema": "http://json-schema.org/draft-04/schema",
|
||||||
"title" : "VCMI battlefield format",
|
"title" : "VCMI battlefield format",
|
||||||
"description" : "Format used to define new artifacts in VCMI",
|
"description" : "Format used to define new battlefields in VCMI",
|
||||||
"required" : [ "graphics" ],
|
"required" : [ "graphics" ],
|
||||||
|
|
||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
|
46
config/schemas/obstacle.json
Normal file
46
config/schemas/obstacle.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"type":"object",
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema",
|
||||||
|
"title" : "VCMI obstacle format",
|
||||||
|
"description" : "Format used to define new obstacles in VCMI",
|
||||||
|
"required" : [ "defname" ],
|
||||||
|
|
||||||
|
"additionalProperties" : false,
|
||||||
|
"properties":{
|
||||||
|
"allowedTerrains": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Obstacles can be place on specified terrains only",
|
||||||
|
"items": { "type" : "string" }
|
||||||
|
},
|
||||||
|
"specialBattlefields": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Obstacles can be placed on specified specified battlefields",
|
||||||
|
"items": { "$ref" : "battlefield.json" }
|
||||||
|
},
|
||||||
|
"width": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Width ob obstacle"
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "height if obstacle"
|
||||||
|
},
|
||||||
|
"blockedTiles": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Blocked hexes - absolute or relative hex id",
|
||||||
|
"items": { "type" : "number" }
|
||||||
|
},
|
||||||
|
"defname": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Image resource"
|
||||||
|
},
|
||||||
|
"unknown": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Unknown field"
|
||||||
|
},
|
||||||
|
"absolute": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Should be used absulute or relative coordinates for obstacle. There is possible only one absolute obstacle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vcmi/EntityService.h>
|
#include <vcmi/EntityService.h>
|
||||||
|
#include <vcmi/Entity.h>
|
||||||
#include "HeroBonus.h"
|
#include "HeroBonus.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
#include "IHandlerBase.h"
|
#include "IHandlerBase.h"
|
||||||
|
@ -23,7 +23,7 @@ int32_t ObstacleInfo::getIconIndex() const
|
|||||||
|
|
||||||
const std::string & ObstacleInfo::getName() const
|
const std::string & ObstacleInfo::getName() const
|
||||||
{
|
{
|
||||||
return name;
|
return identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & ObstacleInfo::getJsonKey() const
|
const std::string & ObstacleInfo::getJsonKey() const
|
||||||
|
@ -22,13 +22,12 @@ struct DLL_LINKAGE ObstacleInfo : public EntityT<Obstacle>
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
ObstacleInfo(Obstacle obstacle, std::string identifier)
|
ObstacleInfo(Obstacle obstacle, std::string identifier)
|
||||||
: obstacle(obstacle), identifier(identifier), iconIndex(obstacle.getNum()), name(identifier), width(0), height(0), isAbsoluteObstacle(false)
|
: obstacle(obstacle), identifier(identifier), iconIndex(obstacle.getNum()), width(0), height(0), isAbsoluteObstacle(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Obstacle obstacle;
|
Obstacle obstacle;
|
||||||
si32 iconIndex;
|
si32 iconIndex;
|
||||||
std::string name;
|
|
||||||
std::string identifier;
|
std::string identifier;
|
||||||
std::string defName;
|
std::string defName;
|
||||||
std::vector<Terrain> allowedTerrains;
|
std::vector<Terrain> allowedTerrains;
|
||||||
@ -53,7 +52,6 @@ struct DLL_LINKAGE ObstacleInfo : public EntityT<Obstacle>
|
|||||||
{
|
{
|
||||||
h & obstacle;
|
h & obstacle;
|
||||||
h & iconIndex;
|
h & iconIndex;
|
||||||
h & name;
|
|
||||||
h & identifier;
|
h & identifier;
|
||||||
h & defName;
|
h & defName;
|
||||||
h & allowedTerrains;
|
h & allowedTerrains;
|
||||||
|
Loading…
Reference in New Issue
Block a user