1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Update maps sorting logic

This commit is contained in:
MichalZr6
2025-02-16 15:30:24 +01:00
parent ee5cddb52c
commit ea1c911e4d
2 changed files with 4 additions and 2 deletions

View File

@@ -114,13 +114,13 @@ bool mapSorter::operator()(const std::shared_ptr<ElementInfo> aaa, const std::sh
return (a->victoryIconIndex < b->victoryIconIndex);
break;
case _name: //by name
return boost::ilexicographical_compare(a->name.toString(), b->name.toString());
return aaa->name < bbb->name;
case _fileName: //by filename
return boost::ilexicographical_compare(aaa->fileURI, bbb->fileURI);
case _changeDate: //by changedate
return aaa->lastWrite < bbb->lastWrite;
default:
return boost::ilexicographical_compare(a->name.toString(), b->name.toString());
return aaa->name < bbb->name;
}
}
else //if we are sorting campaigns

View File

@@ -48,6 +48,8 @@ void CMapInfo::mapInit(const std::string & fname)
originalFileURI = resource.getOriginalName();
fullFileURI = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(resource)).string();
mapHeader = mapService.loadMapHeader(resource);
lastWrite = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(resource));
date = TextOperations::getFormattedDateTimeLocal(lastWrite);
countPlayers();
}