From 1a78df69f2450f406b9eef27e82430f519359e7d Mon Sep 17 00:00:00 2001 From: nordsoft Date: Sun, 4 Sep 2022 15:47:53 +0400 Subject: [PATCH] Revert "Obstacles works fine without regression" This reverts commit c3276f22762c03d6ad753f7cc177f48d0e65fbac. --- config/gameConfig.json | 4 --- config/schemas/battlefield.json | 2 +- config/schemas/obstacle.json | 46 --------------------------------- lib/BattleFieldHandler.h | 1 - lib/ObstacleHandler.cpp | 2 +- lib/ObstacleHandler.h | 4 ++- 6 files changed, 5 insertions(+), 54 deletions(-) delete mode 100644 config/schemas/obstacle.json diff --git a/config/gameConfig.json b/config/gameConfig.json index a8e5bc71b..186029a94 100644 --- a/config/gameConfig.json +++ b/config/gameConfig.json @@ -88,9 +88,5 @@ "battlefields": [ "config/battlefields.json" - ], - "obstacles": - [ - "config/obstacles.json" ] } diff --git a/config/schemas/battlefield.json b/config/schemas/battlefield.json index 4abd729d2..02aa0dcfd 100644 --- a/config/schemas/battlefield.json +++ b/config/schemas/battlefield.json @@ -2,7 +2,7 @@ "type":"object", "$schema": "http://json-schema.org/draft-04/schema", "title" : "VCMI battlefield format", - "description" : "Format used to define new battlefields in VCMI", + "description" : "Format used to define new artifacts in VCMI", "required" : [ "graphics" ], "additionalProperties" : false, diff --git a/config/schemas/obstacle.json b/config/schemas/obstacle.json deleted file mode 100644 index f6a76f40b..000000000 --- a/config/schemas/obstacle.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "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" - } - } -} diff --git a/lib/BattleFieldHandler.h b/lib/BattleFieldHandler.h index b9023f3d0..ab5ab2742 100644 --- a/lib/BattleFieldHandler.h +++ b/lib/BattleFieldHandler.h @@ -10,7 +10,6 @@ #pragma once #include -#include #include "HeroBonus.h" #include "GameConstants.h" #include "IHandlerBase.h" diff --git a/lib/ObstacleHandler.cpp b/lib/ObstacleHandler.cpp index 58052d730..38b2b283b 100644 --- a/lib/ObstacleHandler.cpp +++ b/lib/ObstacleHandler.cpp @@ -23,7 +23,7 @@ int32_t ObstacleInfo::getIconIndex() const const std::string & ObstacleInfo::getName() const { - return identifier; + return name; } const std::string & ObstacleInfo::getJsonKey() const diff --git a/lib/ObstacleHandler.h b/lib/ObstacleHandler.h index 8752c8bd0..e4b6fc5f4 100644 --- a/lib/ObstacleHandler.h +++ b/lib/ObstacleHandler.h @@ -22,12 +22,13 @@ struct DLL_LINKAGE ObstacleInfo : public EntityT {} ObstacleInfo(Obstacle obstacle, std::string identifier) - : obstacle(obstacle), identifier(identifier), iconIndex(obstacle.getNum()), width(0), height(0), isAbsoluteObstacle(false) + : obstacle(obstacle), identifier(identifier), iconIndex(obstacle.getNum()), name(identifier), width(0), height(0), isAbsoluteObstacle(false) { } Obstacle obstacle; si32 iconIndex; + std::string name; std::string identifier; std::string defName; std::vector allowedTerrains; @@ -52,6 +53,7 @@ struct DLL_LINKAGE ObstacleInfo : public EntityT { h & obstacle; h & iconIndex; + h & name; h & identifier; h & defName; h & allowedTerrains;