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:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"basepath" : "mapFormatIcons/",
|
"basepath" : "mapFormatIcons/",
|
||||||
"images" :
|
"images" :
|
||||||
[
|
[
|
||||||
{ "group" : 1, "frame" : 0, "file" : "vcmi1.png"}
|
{ "frame" : 3, "file" : "vcmi1.png"}
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -137,7 +137,7 @@ void RandomMapTab::updateMapInfoByHost()
|
|||||||
mapInfo = std::make_shared<CMapInfo>();
|
mapInfo = std::make_shared<CMapInfo>();
|
||||||
mapInfo->isRandomMap = true;
|
mapInfo->isRandomMap = true;
|
||||||
mapInfo->mapHeader = std::make_unique<CMapHeader>();
|
mapInfo->mapHeader = std::make_unique<CMapHeader>();
|
||||||
mapInfo->mapHeader->version = EMapFormat::SOD;
|
mapInfo->mapHeader->version = EMapFormat::VCMI;
|
||||||
mapInfo->mapHeader->name = CGI->generaltexth->allTexts[740];
|
mapInfo->mapHeader->name = CGI->generaltexth->allTexts[740];
|
||||||
mapInfo->mapHeader->description = CGI->generaltexth->allTexts[741];
|
mapInfo->mapHeader->description = CGI->generaltexth->allTexts[741];
|
||||||
mapInfo->mapHeader->difficulty = 1; // Normal
|
mapInfo->mapHeader->difficulty = 1; // Normal
|
||||||
|
@@ -543,7 +543,7 @@ bool SelectionTab::isMapSupported(const CMapInfo & info)
|
|||||||
case EMapFormat::HOTA:
|
case EMapFormat::HOTA:
|
||||||
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS)["supported"].Bool();
|
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS)["supported"].Bool();
|
||||||
case EMapFormat::VCMI:
|
case EMapFormat::VCMI:
|
||||||
return true;
|
return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_JSON_VCMI)["supported"].Bool();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -694,7 +694,7 @@ void SelectionTab::ListItem::updateItem(std::shared_ptr<CMapInfo> info, bool sel
|
|||||||
labelMapSizeLetter->setText(info->getMapSizeName());
|
labelMapSizeLetter->setText(info->getMapSizeName());
|
||||||
labelMapSizeLetter->setColor(color);
|
labelMapSizeLetter->setColor(color);
|
||||||
iconFormat->enable();
|
iconFormat->enable();
|
||||||
iconFormat->setFrame(info->getMapSizeFormatIconId().first, info->getMapSizeFormatIconId().second);
|
iconFormat->setFrame(info->getMapSizeFormatIconId());
|
||||||
iconVictoryCondition->enable();
|
iconVictoryCondition->enable();
|
||||||
iconVictoryCondition->setFrame(info->mapHeader->victoryIconIndex, 0);
|
iconVictoryCondition->setFrame(info->mapHeader->victoryIconIndex, 0);
|
||||||
iconLossCondition->enable();
|
iconLossCondition->enable();
|
||||||
|
@@ -125,11 +125,28 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"mapFormat" : {
|
"mapFormat" : {
|
||||||
"restorationOfErathia" : { "supported" : true },
|
"restorationOfErathia" : {
|
||||||
"armageddonsBlade" : { "supported" : true },
|
"supported" : true,
|
||||||
"shadowOfDeath" : { "supported" : true },
|
"iconIndex" : 0
|
||||||
"hornOfTheAbyss" : { "supported" : false },
|
},
|
||||||
"inTheWakeOfGods" : { "supported" : false }
|
"armageddonsBlade" : {
|
||||||
|
"supported" : true,
|
||||||
|
"iconIndex" : 1
|
||||||
|
},
|
||||||
|
"shadowOfDeath" : {
|
||||||
|
"supported" : true,
|
||||||
|
"iconIndex" : 2
|
||||||
|
},
|
||||||
|
"jsonVCMI" : {
|
||||||
|
"supported" : true,
|
||||||
|
"iconIndex" : 3
|
||||||
|
},
|
||||||
|
"hornOfTheAbyss" : {
|
||||||
|
"supported" : false
|
||||||
|
},
|
||||||
|
"inTheWakeOfGods" : {
|
||||||
|
"supported" : false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"heroes" :
|
"heroes" :
|
||||||
|
@@ -76,6 +76,7 @@ void GameSettings::load(const JsonNode & input)
|
|||||||
{EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH, "mapFormat", "shadowOfDeath" },
|
{EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH, "mapFormat", "shadowOfDeath" },
|
||||||
{EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS, "mapFormat", "hornOfTheAbyss" },
|
{EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS, "mapFormat", "hornOfTheAbyss" },
|
||||||
{EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS, "mapFormat", "inTheWakeOfGods" },
|
{EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS, "mapFormat", "inTheWakeOfGods" },
|
||||||
|
{EGameSettings::MAP_FORMAT_JSON_VCMI, "mapFormat", "jsonVCMI" },
|
||||||
{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" },
|
||||||
|
@@ -55,6 +55,7 @@ enum class EGameSettings
|
|||||||
MAP_FORMAT_ARMAGEDDONS_BLADE,
|
MAP_FORMAT_ARMAGEDDONS_BLADE,
|
||||||
MAP_FORMAT_SHADOW_OF_DEATH,
|
MAP_FORMAT_SHADOW_OF_DEATH,
|
||||||
MAP_FORMAT_HORN_OF_THE_ABYSS,
|
MAP_FORMAT_HORN_OF_THE_ABYSS,
|
||||||
|
MAP_FORMAT_JSON_VCMI,
|
||||||
MAP_FORMAT_IN_THE_WAKE_OF_GODS,
|
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,
|
||||||
|
@@ -229,7 +229,7 @@ void CMapHeader::setupEvents()
|
|||||||
defeatMessage = VLC->generaltexth->lossCondtions[0];
|
defeatMessage = VLC->generaltexth->lossCondtions[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
CMapHeader::CMapHeader() : version(EMapFormat::SOD), height(72), width(72),
|
CMapHeader::CMapHeader() : version(EMapFormat::VCMI), height(72), width(72),
|
||||||
twoLevel(true), difficulty(1), levelLimit(0), howManyTeams(0), areAnyPlayers(false)
|
twoLevel(true), difficulty(1), levelLimit(0), howManyTeams(0), areAnyPlayers(false)
|
||||||
{
|
{
|
||||||
setupEvents();
|
setupEvents();
|
||||||
|
@@ -260,7 +260,7 @@ enum class EMapFormat: uint8_t
|
|||||||
SOD = 0x1c, // 28
|
SOD = 0x1c, // 28
|
||||||
HOTA = 0x20, // 32
|
HOTA = 0x20, // 32
|
||||||
WOG = 0x33, // 51
|
WOG = 0x33, // 51
|
||||||
VCMI = 0xF0
|
VCMI = 0x64
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inherit from container to enable forward declaration
|
// Inherit from container to enable forward declaration
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include "../CGeneralTextHandler.h"
|
#include "../CGeneralTextHandler.h"
|
||||||
#include "../rmg/CMapGenOptions.h"
|
#include "../rmg/CMapGenOptions.h"
|
||||||
#include "../CCreatureHandler.h"
|
#include "../CCreatureHandler.h"
|
||||||
|
#include "../GameSettings.h"
|
||||||
#include "../CHeroHandler.h"
|
#include "../CHeroHandler.h"
|
||||||
#include "../CModHandler.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)
|
switch(mapHeader->version)
|
||||||
{
|
{
|
||||||
case EMapFormat::ROE:
|
case EMapFormat::ROE:
|
||||||
frame = 0;
|
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_RESTORATION_OF_ERATHIA)["iconIndex"].Integer();
|
||||||
break;
|
case EMapFormat::AB:
|
||||||
case EMapFormat::AB:
|
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE)["iconIndex"].Integer();
|
||||||
frame = 1;
|
case EMapFormat::SOD:
|
||||||
break;
|
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH)["iconIndex"].Integer();
|
||||||
case EMapFormat::SOD:
|
case EMapFormat::WOG:
|
||||||
frame = 2;
|
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS)["iconIndex"].Integer();
|
||||||
break;
|
case EMapFormat::HOTA:
|
||||||
case EMapFormat::WOG:
|
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS)["iconIndex"].Integer();
|
||||||
frame = 3;
|
case EMapFormat::VCMI:
|
||||||
break;
|
return VLC->settings()->getValue(EGameSettings::MAP_FORMAT_JSON_VCMI)["iconIndex"].Integer();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
return std::make_pair(frame, group);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CMapInfo::getMapSizeName() const
|
std::string CMapInfo::getMapSizeName() const
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
std::string getNameForList() const;
|
std::string getNameForList() const;
|
||||||
std::string getDescription() const;
|
std::string getDescription() const;
|
||||||
int getMapSizeIconId() const;
|
int getMapSizeIconId() const;
|
||||||
std::pair<int, int> getMapSizeFormatIconId() const;
|
int getMapSizeFormatIconId() const;
|
||||||
std::string getMapSizeName() const;
|
std::string getMapSizeName() const;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int Version)
|
template <typename Handler> void serialize(Handler &h, const int Version)
|
||||||
|
Reference in New Issue
Block a user