mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-28 03:57:02 +02:00
Cosmetic changes for json map reader
This commit is contained in:
parent
9098126684
commit
65f696b018
@ -346,6 +346,7 @@ const int CMapFormatJson::VERSION_MINOR = 3;
|
|||||||
|
|
||||||
const std::string CMapFormatJson::HEADER_FILE_NAME = "header.json";
|
const std::string CMapFormatJson::HEADER_FILE_NAME = "header.json";
|
||||||
const std::string CMapFormatJson::OBJECTS_FILE_NAME = "objects.json";
|
const std::string CMapFormatJson::OBJECTS_FILE_NAME = "objects.json";
|
||||||
|
const std::string CMapFormatJson::TERRAIN_FILE_NAMES[2] = {"surface_terrain.json", "underground_terrain.json"};
|
||||||
|
|
||||||
CMapFormatJson::CMapFormatJson():
|
CMapFormatJson::CMapFormatJson():
|
||||||
fileVersionMajor(0), fileVersionMinor(0),
|
fileVersionMajor(0), fileVersionMinor(0),
|
||||||
@ -424,10 +425,10 @@ void CMapFormatJson::serializeHeader(JsonSerializeFormat & handler)
|
|||||||
|
|
||||||
handler.serializeLIC("allowedHeroes", &HeroTypeID::decode, &HeroTypeID::encode, VLC->heroh->getDefaultAllowed(), mapHeader->allowedHeroes);
|
handler.serializeLIC("allowedHeroes", &HeroTypeID::decode, &HeroTypeID::encode, VLC->heroh->getDefaultAllowed(), mapHeader->allowedHeroes);
|
||||||
|
|
||||||
// handler.serializeString("victoryString", mapHeader->victoryMessage);
|
handler.serializeStruct("victoryMessage", mapHeader->victoryMessage);
|
||||||
handler.serializeInt("victoryIconIndex", mapHeader->victoryIconIndex);
|
handler.serializeInt("victoryIconIndex", mapHeader->victoryIconIndex);
|
||||||
|
|
||||||
// handler.serializeString("defeatString", mapHeader->defeatMessage);
|
handler.serializeStruct("defeatMessage", mapHeader->defeatMessage);
|
||||||
handler.serializeInt("defeatIconIndex", mapHeader->defeatIconIndex);
|
handler.serializeInt("defeatIconIndex", mapHeader->defeatIconIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1122,12 +1123,12 @@ void CMapLoaderJson::readTerrainLevel(const JsonNode & src, const int index)
|
|||||||
void CMapLoaderJson::readTerrain()
|
void CMapLoaderJson::readTerrain()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
const JsonNode surface = getFromArchive("surface_terrain.json");
|
const JsonNode surface = getFromArchive(TERRAIN_FILE_NAMES[0]);
|
||||||
readTerrainLevel(surface, 0);
|
readTerrainLevel(surface, 0);
|
||||||
}
|
}
|
||||||
if(map->twoLevel)
|
if(map->twoLevel)
|
||||||
{
|
{
|
||||||
const JsonNode underground = getFromArchive("underground_terrain.json");
|
const JsonNode underground = getFromArchive(TERRAIN_FILE_NAMES[1]);
|
||||||
readTerrainLevel(underground, 1);
|
readTerrainLevel(underground, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1388,12 +1389,12 @@ void CMapSaverJson::writeTerrain()
|
|||||||
//todo: multilevel map save support
|
//todo: multilevel map save support
|
||||||
|
|
||||||
JsonNode surface = writeTerrainLevel(0);
|
JsonNode surface = writeTerrainLevel(0);
|
||||||
addToArchive(surface, "surface_terrain.json");
|
addToArchive(surface, TERRAIN_FILE_NAMES[0]);
|
||||||
|
|
||||||
if(map->twoLevel)
|
if(map->twoLevel)
|
||||||
{
|
{
|
||||||
JsonNode underground = writeTerrainLevel(1);
|
JsonNode underground = writeTerrainLevel(1);
|
||||||
addToArchive(underground, "underground_terrain.json");
|
addToArchive(underground, TERRAIN_FILE_NAMES[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
static const std::string HEADER_FILE_NAME;
|
static const std::string HEADER_FILE_NAME;
|
||||||
static const std::string OBJECTS_FILE_NAME;
|
static const std::string OBJECTS_FILE_NAME;
|
||||||
|
static const std::string TERRAIN_FILE_NAMES[2];
|
||||||
|
|
||||||
int fileVersionMajor;
|
int fileVersionMajor;
|
||||||
int fileVersionMinor;
|
int fileVersionMinor;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user