mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
- minor optimizations
- fixed incorrect error reporting in launcher - set WoG version to "0.0.0" so full version will be installed from repo in future - updated debian required packages list - launcher will be enabled by default
This commit is contained in:
@@ -69,7 +69,10 @@ std::unique_ptr<CInputStream> CFilesystemList::load(const ResourceID & resourceN
|
||||
|
||||
bool CFilesystemList::existsResource(const ResourceID & resourceName) const
|
||||
{
|
||||
return !getResourcesWithName(resourceName).empty();
|
||||
for (auto & loader : *loaders)
|
||||
if (loader->existsResource(resourceName))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string CFilesystemList::getMountPoint() const
|
||||
|
||||
@@ -3,6 +3,30 @@
|
||||
|
||||
#include "CFileInfo.h"
|
||||
|
||||
// trivial to_upper that completely ignores localization and only work with ASCII
|
||||
// Technically not a problem since
|
||||
// 1) Right now VCMI does not supports unicode in filenames on Win
|
||||
// 2) Filesystem case-sensivity is only problem for H3 data which uses ASCII-only symbols
|
||||
// for me (Ivan) this define gives notable decrease in loading times
|
||||
// #define ENABLE_TRIVIAL_TOUPPER
|
||||
|
||||
#ifdef ENABLE_TRIVIAL_TOUPPER
|
||||
static inline void toUpper(char & symbol)
|
||||
{
|
||||
static const int diff = 'a' - 'A';
|
||||
if (symbol >= 'a' && symbol <= 'z')
|
||||
symbol -= diff;
|
||||
}
|
||||
|
||||
static inline void toUpper(std::string & string)
|
||||
{
|
||||
for (char & symbol : string)
|
||||
toUpper(symbol);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
ResourceID::ResourceID()
|
||||
:type(EResType::OTHER)
|
||||
{
|
||||
@@ -40,8 +64,12 @@ void ResourceID::setName(std::string name)
|
||||
if(dotPos != std::string::npos && this->name[dotPos] == '.')
|
||||
this->name.erase(dotPos);
|
||||
|
||||
#ifdef ENABLE_TRIVIAL_TOUPPER
|
||||
toUpper(this->name);
|
||||
#else
|
||||
// strangely enough but this line takes 40-50% of filesystem loading time
|
||||
boost::to_upper(this->name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ResourceID::setType(EResType::Type type)
|
||||
@@ -51,7 +79,11 @@ void ResourceID::setType(EResType::Type type)
|
||||
|
||||
EResType::Type EResTypeHelper::getTypeFromExtension(std::string extension)
|
||||
{
|
||||
#ifdef ENABLE_TRIVIAL_TOUPPER
|
||||
toUpper(extension);
|
||||
#else
|
||||
boost::to_upper(extension);
|
||||
#endif
|
||||
|
||||
static const std::map<std::string, EResType::Type> stringToRes =
|
||||
boost::assign::map_list_of
|
||||
|
||||
Reference in New Issue
Block a user