1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fix rivers & roads loading

This commit is contained in:
Ivan Savenko 2022-12-20 20:52:52 +02:00
parent 2de3178158
commit 99745b5c3c
4 changed files with 30 additions and 13 deletions

View File

@ -85,6 +85,14 @@
[
"config/terrains.json"
],
"roads":
[
"config/roads.json"
],
"rivers":
[
"config/rivers.json"
],
"battlefields":
[
"config/battlefields.json"

View File

@ -8,7 +8,7 @@
"music" : "Dirt.mp3",
"tiles" : "DIRTTL",
"code" : "dt",
"river" : "rm",
"river" : "mudRiver",
"battleFields" : ["dirt_birches", "dirt_hills", "dirt_pines"],
"terrainViewPatterns" : "dirt",
"horseSoundId" : 0
@ -22,7 +22,7 @@
"music" : "Sand.mp3",
"tiles" : "SANDTL",
"code" : "sa",
"river" : "rm",
"river" : "mudRiver",
"battleFields" : ["sand_mesas"],
"transitionRequired" : true,
"terrainViewPatterns" : "sand",
@ -37,7 +37,7 @@
"music" : "Grass.mp3",
"tiles" : "GRASTL",
"code" : "gr",
"river" : "rw",
"river" : "waterRiver",
"battleFields" : ["grass_hills", "grass_pines"],
"horseSoundId" : 2
},
@ -50,7 +50,7 @@
"music" : "Snow.mp3",
"tiles" : "SNOWTL",
"code" : "sn",
"river" : "ri",
"river" : "iceRiver",
"battleFields" : ["snow_mountains", "snow_trees"],
"horseSoundId" : 3
},
@ -63,7 +63,7 @@
"music" : "Swamp.mp3",
"tiles" : "SWMPTL",
"code" : "sw",
"river" : "rw",
"river" : "waterRiver",
"battleFields" : ["swamp_trees"],
"horseSoundId" : 4
},
@ -76,7 +76,7 @@
"music" : "Rough.mp3",
"tiles" : "ROUGTL",
"code" : "rg",
"river" : "rm",
"river" : "mudRiver",
"battleFields" : ["rough"],
"horseSoundId" : 5
},
@ -90,7 +90,7 @@
"tiles" : "SUBBTL",
"type" : [ "SUB" ],
"code" : "sb",
"river" : "rw",
"river" : "waterRiver",
"battleFields" : ["subterranean"],
"rockTerrain" : "rock",
"horseSoundId" : 6
@ -105,7 +105,7 @@
"tiles" : "LAVATL",
"type" : ["SUB", "SURFACE"],
"code" : "lv",
"river" : "rl",
"river" : "lavaRiver",
"battleFields" : ["lava"],
"rockTerrain" : "rock",
"horseSoundId" : 7

View File

@ -526,7 +526,7 @@ void CContentHandler::preloadData(CModInfo & mod)
void CContentHandler::load(CModInfo & mod)
{
bool validate = (mod.validation != CModInfo::PASSED);
bool validate = false;//(mod.validation != CModInfo::PASSED);
if (!loadMod(mod.identifier, validate))
mod.validation = CModInfo::FAILED;

View File

@ -63,6 +63,8 @@ TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const
ui8(blockedVec[2].Float())
};
info->passabilityType = 0;
for(const auto& node : json["type"].Vector())
{
//Set bits
@ -74,10 +76,15 @@ TerrainType * TerrainTypeHandler::loadFromJson( const std::string & scope, const
if (s == "SUB") info->passabilityType |= TerrainType::PassabilityType::SUBTERRANEAN;
}
// if(json["river"].isNull())
// info->river = River::NO_RIVER;
// else
// info->river = getRiverByCode(json["river"].String())->id;
info->river = River::NO_RIVER;
if(!json["river"].isNull())
{
VLC->modh->identifiers.requestIdentifier("river", json["river"], [info](int32_t identifier)
{
info->river = RiverId(identifier);
});
}
info->typeCode = json["code"].String();
assert(info->typeCode.length() == 2);
@ -161,6 +168,7 @@ const std::vector<std::string> & RiverTypeHandler::getTypeNames() const
std::vector<JsonNode> RiverTypeHandler::loadLegacyData(size_t dataSize)
{
objects.resize(dataSize);
return {};
}
@ -192,6 +200,7 @@ const std::vector<std::string> & RoadTypeHandler::getTypeNames() const
std::vector<JsonNode> RoadTypeHandler::loadLegacyData(size_t dataSize)
{
objects.resize(dataSize);
return {};
}