mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix processing of VCMI_Tests map
This commit is contained in:
@@ -156,6 +156,7 @@ void ClientCommandManager::processCommand(const std::string &message, bool calle
|
|||||||
// }
|
// }
|
||||||
else if(message=="convert txt")
|
else if(message=="convert txt")
|
||||||
{
|
{
|
||||||
|
logGlobal->info("Searching for available maps");
|
||||||
std::unordered_set<ResourceID> mapList = CResourceHandler::get()->getFilteredFiles([&](const ResourceID & ident)
|
std::unordered_set<ResourceID> mapList = CResourceHandler::get()->getFilteredFiles([&](const ResourceID & ident)
|
||||||
{
|
{
|
||||||
return ident.getType() == EResType::MAP;
|
return ident.getType() == EResType::MAP;
|
||||||
@@ -168,9 +169,21 @@ void ClientCommandManager::processCommand(const std::string &message, bool calle
|
|||||||
|
|
||||||
CMapService mapService;
|
CMapService mapService;
|
||||||
|
|
||||||
|
logGlobal->info("Loading maps for export");
|
||||||
for (auto const & mapName : mapList)
|
for (auto const & mapName : mapList)
|
||||||
mapService.loadMap(mapName); // load and drop loaded map - we only need loader to run over all maps
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// load and drop loaded map - we only need loader to run over all maps
|
||||||
|
mapService.loadMap(mapName);
|
||||||
|
}
|
||||||
|
catch(std::exception & e)
|
||||||
|
{
|
||||||
|
logGlobal->error("Map %s is invalid. Message: %s", mapName.getName(), e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logGlobal->info("Loading campaigns for export");
|
||||||
for (auto const & campaignName : campaignList)
|
for (auto const & campaignName : campaignList)
|
||||||
{
|
{
|
||||||
CCampaignState state(CCampaignHandler::getCampaign(campaignName.getName()));
|
CCampaignState state(CCampaignHandler::getCampaign(campaignName.getName()));
|
||||||
|
|||||||
@@ -339,11 +339,14 @@ std::set<si32> CObjectClassesHandler::knownObjects() const
|
|||||||
|
|
||||||
std::set<si32> CObjectClassesHandler::knownSubObjects(si32 primaryID) const
|
std::set<si32> CObjectClassesHandler::knownSubObjects(si32 primaryID) const
|
||||||
{
|
{
|
||||||
assert(primaryID < objects.size());
|
|
||||||
assert(objects[primaryID]);
|
|
||||||
|
|
||||||
std::set<si32> ret;
|
std::set<si32> ret;
|
||||||
|
|
||||||
|
if (!objects.at(primaryID))
|
||||||
|
{
|
||||||
|
logGlobal->error("Failed to find object %d", primaryID);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
for(const auto & entry : objects.at(primaryID)->objects)
|
for(const auto & entry : objects.at(primaryID)->objects)
|
||||||
if (entry)
|
if (entry)
|
||||||
ret.insert(entry->subtype);
|
ret.insert(entry->subtype);
|
||||||
|
|||||||
Reference in New Issue
Block a user