mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Map format support status can now be loaded from gameSettings
This commit is contained in:
parent
402823e3d5
commit
fb55719671
@ -528,6 +528,26 @@ void SelectionTab::restoreLastSelection()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SelectionTab::isMapSupported(const CMapInfo & info)
|
||||||
|
{
|
||||||
|
switch (info.mapHeader->version)
|
||||||
|
{
|
||||||
|
case EMapFormat::ROE:
|
||||||
|
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_RESTORATION_OF_ERATHIA)["supported"].Bool();
|
||||||
|
case EMapFormat::AB:
|
||||||
|
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE)["supported"].Bool();
|
||||||
|
case EMapFormat::SOD:
|
||||||
|
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH)["supported"].Bool();
|
||||||
|
case EMapFormat::WOG:
|
||||||
|
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS)["supported"].Bool();
|
||||||
|
case EMapFormat::HOTA:
|
||||||
|
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS)["supported"].Bool();
|
||||||
|
case EMapFormat::VCMI:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SelectionTab::parseMaps(const std::unordered_set<ResourceID> & files)
|
void SelectionTab::parseMaps(const std::unordered_set<ResourceID> & files)
|
||||||
{
|
{
|
||||||
logGlobal->debug("Parsing %d maps", files.size());
|
logGlobal->debug("Parsing %d maps", files.size());
|
||||||
@ -539,9 +559,7 @@ void SelectionTab::parseMaps(const std::unordered_set<ResourceID> & files)
|
|||||||
auto mapInfo = std::make_shared<CMapInfo>();
|
auto mapInfo = std::make_shared<CMapInfo>();
|
||||||
mapInfo->mapInit(file.getName());
|
mapInfo->mapInit(file.getName());
|
||||||
|
|
||||||
EMapFormat maxSupported = static_cast<EMapFormat>(CGI->settings()->getInteger(EGameSettings::TEXTS_MAP_VERSION));
|
if (isMapSupported(*mapInfo))
|
||||||
|
|
||||||
if(mapInfo->mapHeader->version == EMapFormat::VCMI || mapInfo->mapHeader->version <= maxSupported)
|
|
||||||
allItems.push_back(mapInfo);
|
allItems.push_back(mapInfo);
|
||||||
}
|
}
|
||||||
catch(std::exception & e)
|
catch(std::exception & e)
|
||||||
|
@ -93,6 +93,7 @@ private:
|
|||||||
ESelectionScreen tabType;
|
ESelectionScreen tabType;
|
||||||
Rect inputNameRect;
|
Rect inputNameRect;
|
||||||
|
|
||||||
|
bool isMapSupported(const CMapInfo & info);
|
||||||
void parseMaps(const std::unordered_set<ResourceID> & files);
|
void parseMaps(const std::unordered_set<ResourceID> & files);
|
||||||
void parseSaves(const std::unordered_set<ResourceID> & files);
|
void parseSaves(const std::unordered_set<ResourceID> & files);
|
||||||
void parseCampaigns(const std::unordered_set<ResourceID> & files);
|
void parseCampaigns(const std::unordered_set<ResourceID> & files);
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
],
|
],
|
||||||
"skills" :
|
"skills" :
|
||||||
[
|
[
|
||||||
"config/skills.json"
|
"config/skills.json"
|
||||||
],
|
],
|
||||||
"terrains":
|
"terrains":
|
||||||
[
|
[
|
||||||
@ -122,7 +122,14 @@
|
|||||||
"terrain" : 10,
|
"terrain" : 10,
|
||||||
"river" : 5,
|
"river" : 5,
|
||||||
"road" : 4,
|
"road" : 4,
|
||||||
"mapVersion" : 28 // max supported version, SoD
|
},
|
||||||
|
|
||||||
|
"mapFormat" : {
|
||||||
|
"restorationOfErathia" : { "supported" : true },
|
||||||
|
"armageddonsBlade" : { "supported" : true },
|
||||||
|
"shadowOfDeath" : { "supported" : true },
|
||||||
|
"hornOfTheAbyss" : { "supported" : false },
|
||||||
|
"inTheWakeOfGods" : { "supported" : false }
|
||||||
},
|
},
|
||||||
|
|
||||||
"heroes" :
|
"heroes" :
|
||||||
|
@ -58,7 +58,7 @@ void GameSettings::load(const JsonNode & input)
|
|||||||
{EGameSettings::COMBAT_DEFENSE_POINT_DAMAGE_FACTOR_CAP, "combat", "defensePointDamageFactorCap"},
|
{EGameSettings::COMBAT_DEFENSE_POINT_DAMAGE_FACTOR_CAP, "combat", "defensePointDamageFactorCap"},
|
||||||
{EGameSettings::COMBAT_GOOD_LUCK_DICE, "combat", "goodLuckDice" },
|
{EGameSettings::COMBAT_GOOD_LUCK_DICE, "combat", "goodLuckDice" },
|
||||||
{EGameSettings::COMBAT_GOOD_MORALE_DICE, "combat", "goodMoraleDice" },
|
{EGameSettings::COMBAT_GOOD_MORALE_DICE, "combat", "goodMoraleDice" },
|
||||||
{EGameSettings::COMBAT_ONE_HEX_TRIGGERS_OBSTACLES, "combat", "oneHexTriggersObstacles" },
|
{EGameSettings::COMBAT_ONE_HEX_TRIGGERS_OBSTACLES, "combat", "oneHexTriggersObstacles" },
|
||||||
{EGameSettings::CREATURES_ALLOW_ALL_FOR_DOUBLE_MONTH, "creatures", "allowAllForDoubleMonth" },
|
{EGameSettings::CREATURES_ALLOW_ALL_FOR_DOUBLE_MONTH, "creatures", "allowAllForDoubleMonth" },
|
||||||
{EGameSettings::CREATURES_ALLOW_RANDOM_SPECIAL_WEEKS, "creatures", "allowRandomSpecialWeeks" },
|
{EGameSettings::CREATURES_ALLOW_RANDOM_SPECIAL_WEEKS, "creatures", "allowRandomSpecialWeeks" },
|
||||||
{EGameSettings::CREATURES_DAILY_STACK_EXPERIENCE, "creatures", "dailyStackExperience" },
|
{EGameSettings::CREATURES_DAILY_STACK_EXPERIENCE, "creatures", "dailyStackExperience" },
|
||||||
@ -71,6 +71,11 @@ void GameSettings::load(const JsonNode & input)
|
|||||||
{EGameSettings::HEROES_RETREAT_ON_WIN_WITHOUT_TROOPS, "heroes", "retreatOnWinWithoutTroops" },
|
{EGameSettings::HEROES_RETREAT_ON_WIN_WITHOUT_TROOPS, "heroes", "retreatOnWinWithoutTroops" },
|
||||||
{EGameSettings::HEROES_STARTING_STACKS_CHANCES, "heroes", "startingStackChances" },
|
{EGameSettings::HEROES_STARTING_STACKS_CHANCES, "heroes", "startingStackChances" },
|
||||||
{EGameSettings::HEROES_BACKPACK_CAP, "heroes", "backpackSize" },
|
{EGameSettings::HEROES_BACKPACK_CAP, "heroes", "backpackSize" },
|
||||||
|
{EGameSettings::MAP_FORMAT_RESTORATION_OF_ERATHIA, "mapFormat", "restorationOfErathia" },
|
||||||
|
{EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE, "mapFormat", "armageddonsBlade" },
|
||||||
|
{EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH, "mapFormat", "shadowOfDeath" },
|
||||||
|
{EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS, "mapFormat", "hornOfTheAbyss" },
|
||||||
|
{EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS, "mapFormat", "inTheWakeOfGods" },
|
||||||
{EGameSettings::MARKETS_BLACK_MARKET_RESTOCK_PERIOD, "markets", "blackMarketRestockPeriod" },
|
{EGameSettings::MARKETS_BLACK_MARKET_RESTOCK_PERIOD, "markets", "blackMarketRestockPeriod" },
|
||||||
{EGameSettings::MODULE_COMMANDERS, "modules", "commanders" },
|
{EGameSettings::MODULE_COMMANDERS, "modules", "commanders" },
|
||||||
{EGameSettings::MODULE_STACK_ARTIFACT, "modules", "stackArtifact" },
|
{EGameSettings::MODULE_STACK_ARTIFACT, "modules", "stackArtifact" },
|
||||||
@ -80,7 +85,6 @@ void GameSettings::load(const JsonNode & input)
|
|||||||
{EGameSettings::TEXTS_FACTION, "textData", "faction" },
|
{EGameSettings::TEXTS_FACTION, "textData", "faction" },
|
||||||
{EGameSettings::TEXTS_HERO, "textData", "hero" },
|
{EGameSettings::TEXTS_HERO, "textData", "hero" },
|
||||||
{EGameSettings::TEXTS_HERO_CLASS, "textData", "heroClass" },
|
{EGameSettings::TEXTS_HERO_CLASS, "textData", "heroClass" },
|
||||||
{EGameSettings::TEXTS_MAP_VERSION, "textData", "mapVersion" },
|
|
||||||
{EGameSettings::TEXTS_OBJECT, "textData", "object" },
|
{EGameSettings::TEXTS_OBJECT, "textData", "object" },
|
||||||
{EGameSettings::TEXTS_RIVER, "textData", "river" },
|
{EGameSettings::TEXTS_RIVER, "textData", "river" },
|
||||||
{EGameSettings::TEXTS_ROAD, "textData", "road" },
|
{EGameSettings::TEXTS_ROAD, "textData", "road" },
|
||||||
|
@ -46,12 +46,16 @@ enum class EGameSettings
|
|||||||
TEXTS_FACTION,
|
TEXTS_FACTION,
|
||||||
TEXTS_HERO,
|
TEXTS_HERO,
|
||||||
TEXTS_HERO_CLASS,
|
TEXTS_HERO_CLASS,
|
||||||
TEXTS_MAP_VERSION,
|
|
||||||
TEXTS_OBJECT,
|
TEXTS_OBJECT,
|
||||||
TEXTS_RIVER,
|
TEXTS_RIVER,
|
||||||
TEXTS_ROAD,
|
TEXTS_ROAD,
|
||||||
TEXTS_SPELL,
|
TEXTS_SPELL,
|
||||||
TEXTS_TERRAIN,
|
TEXTS_TERRAIN,
|
||||||
|
MAP_FORMAT_RESTORATION_OF_ERATHIA,
|
||||||
|
MAP_FORMAT_ARMAGEDDONS_BLADE,
|
||||||
|
MAP_FORMAT_SHADOW_OF_DEATH,
|
||||||
|
MAP_FORMAT_HORN_OF_THE_ABYSS,
|
||||||
|
MAP_FORMAT_IN_THE_WAKE_OF_GODS,
|
||||||
TOWNS_BUILDINGS_PER_TURN_CAP,
|
TOWNS_BUILDINGS_PER_TURN_CAP,
|
||||||
TOWNS_STARTING_DWELLING_CHANCES,
|
TOWNS_STARTING_DWELLING_CHANCES,
|
||||||
COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,
|
COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,
|
||||||
|
Loading…
Reference in New Issue
Block a user