1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Icon index for map format is now defined in config

This commit is contained in:
Ivan Savenko
2023-05-20 17:34:39 +03:00
parent fb55719671
commit daaaf84392
10 changed files with 47 additions and 37 deletions

View File

@@ -22,6 +22,7 @@
#include "../CGeneralTextHandler.h"
#include "../rmg/CMapGenOptions.h"
#include "../CCreatureHandler.h"
#include "../GameSettings.h"
#include "../CHeroHandler.h"
#include "../CModHandler.h"
@@ -149,34 +150,24 @@ int CMapInfo::getMapSizeIconId() const
}
}
std::pair<int, int> CMapInfo::getMapSizeFormatIconId() const
int CMapInfo::getMapSizeFormatIconId() const
{
int frame = -1;
int group = 0;
switch(mapHeader->version)
{
case EMapFormat::ROE:
frame = 0;
break;
case EMapFormat::AB:
frame = 1;
break;
case EMapFormat::SOD:
frame = 2;
break;
case EMapFormat::WOG:
frame = 3;
break;
case EMapFormat::VCMI:
frame = 0;
group = 1;
break;
default:
// Unknown version. Be safe and ignore that map
//logGlobal->warn("Warning: %s has wrong version!", currentItem->fileURI);
break;
case EMapFormat::ROE:
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_RESTORATION_OF_ERATHIA)["iconIndex"].Integer();
case EMapFormat::AB:
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE)["iconIndex"].Integer();
case EMapFormat::SOD:
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH)["iconIndex"].Integer();
case EMapFormat::WOG:
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS)["iconIndex"].Integer();
case EMapFormat::HOTA:
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS)["iconIndex"].Integer();
case EMapFormat::VCMI:
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_JSON_VCMI)["iconIndex"].Integer();
}
return std::make_pair(frame, group);
return 0;
}
std::string CMapInfo::getMapSizeName() const