mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Use roads names instead of their filenames
This commit is contained in:
parent
42281f51e8
commit
d93e844609
@ -16,8 +16,8 @@
|
||||
"extraResourcesLimit" : 3
|
||||
},
|
||||
"minGuardStrength" : 2000,
|
||||
"defaultRoadType" : "pc", //pd - dirt, pg - gravel, pc - cobblestone
|
||||
"secondaryRoadType": "pd",
|
||||
"defaultRoadType" : "cobblestoneRoad",
|
||||
"secondaryRoadType": "dirtRoad",
|
||||
"treasureValueLimit" : 20000, //generate pandora with gold for treasure above this limit
|
||||
"prisons" :
|
||||
{
|
||||
|
@ -220,6 +220,7 @@ void TerrainTypeHandler::initRivers(const std::vector<std::string> & allConfigs)
|
||||
{
|
||||
RiverType info;
|
||||
|
||||
info.name = river.first;
|
||||
info.fileName = river.second["animation"].String();
|
||||
info.code = river.second["code"].String();
|
||||
info.deltaName = river.second["delta"].String();
|
||||
@ -255,6 +256,7 @@ void TerrainTypeHandler::initRoads(const std::vector<std::string> & allConfigs)
|
||||
{
|
||||
RoadType info;
|
||||
|
||||
info.name = road.first;
|
||||
info.fileName = road.second["animation"].String();
|
||||
info.code = road.second["code"].String();
|
||||
info.movementCost = static_cast<ui8>(road.second["moveCost"].Float());
|
||||
@ -295,7 +297,7 @@ void TerrainTypeHandler::recreateRiverMaps()
|
||||
{
|
||||
const auto * riverInfo = &riverTypes[i];
|
||||
|
||||
riverInfoByName[riverInfo->fileName] = riverInfo;
|
||||
riverInfoByName[riverInfo->name] = riverInfo;
|
||||
riverInfoByCode[riverInfo->code] = riverInfo;
|
||||
riverInfoById[riverInfo->id] = riverInfo;
|
||||
}
|
||||
@ -307,7 +309,7 @@ void TerrainTypeHandler::recreateRoadMaps()
|
||||
{
|
||||
const auto * roadInfo = &roadTypes[i];
|
||||
|
||||
roadInfoByName[roadInfo->fileName] = roadInfo;
|
||||
roadInfoByName[roadInfo->name] = roadInfo;
|
||||
roadInfoByCode[roadInfo->code] = roadInfo;
|
||||
roadInfoById[roadInfo->id] = roadInfo;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
class DLL_LINKAGE RiverType
|
||||
{
|
||||
public:
|
||||
|
||||
std::string name;
|
||||
std::string fileName;
|
||||
std::string code;
|
||||
std::string deltaName;
|
||||
@ -99,6 +99,10 @@ public:
|
||||
|
||||
template <typename Handler> void serialize(Handler& h, const int version)
|
||||
{
|
||||
if(version >= 806)
|
||||
{
|
||||
h & name;
|
||||
}
|
||||
h & fileName;
|
||||
h & code;
|
||||
h & deltaName;
|
||||
@ -109,6 +113,7 @@ public:
|
||||
class DLL_LINKAGE RoadType
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
std::string fileName;
|
||||
std::string code;
|
||||
RoadId id;
|
||||
@ -118,6 +123,10 @@ public:
|
||||
|
||||
template <typename Handler> void serialize(Handler& h, const int version)
|
||||
{
|
||||
if(version >= 806)
|
||||
{
|
||||
h & name;
|
||||
}
|
||||
h & fileName;
|
||||
h & code;
|
||||
h & id;
|
||||
|
@ -78,8 +78,8 @@ void RoadPlacer::drawRoads(bool secondary)
|
||||
zone.areaPossible().subtract(roads);
|
||||
zone.freePaths().unite(roads);
|
||||
map.getEditManager()->getTerrainSelection().setSelection(roads.getTilesVector());
|
||||
std::string roadCode = (secondary ? generator.getConfig().secondaryRoadType : generator.getConfig().defaultRoadType);
|
||||
RoadId roadType = VLC->terrainTypeHandler->getRoadByCode(roadCode)->id;
|
||||
std::string roadName = (secondary ? generator.getConfig().secondaryRoadType : generator.getConfig().defaultRoadType);
|
||||
RoadId roadType = VLC->terrainTypeHandler->getRoadByName(roadName)->id;
|
||||
map.getEditManager()->drawRoad(roadType, &generator.rand);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user