Browse Source

- 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

Ivan Savenko 12 years ago
parent
commit
2b3405fa50

+ 1 - 1
CMakeLists.txt

@@ -19,7 +19,7 @@ set(VCMI_VERSION_PATCH 0)
 
 option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
 option(ENABLE_EDITOR "Enable compilation of map editor" OFF)
-option(ENABLE_LAUNCHER "Enable compilation of launcher" OFF)
+option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
 option(ENABLE_TEST "Enable compilation of unit tests" OFF)
 
 ############################################

+ 1 - 1
Mods/WoG/mod.json

@@ -2,7 +2,7 @@
 	"name" : "In The Wake of Gods",
 	"description" : "Unnofficial addon for Heroes of Might and Magic III",
 
-	"version" : "3.58.0",
+	"version" : "0.0.0",
 	"author" : "WoG Team",
 	"contact" : "http://forum.vcmi.eu/index.php",
 	"modType" : "Expansion",

+ 1 - 1
debian/control

@@ -2,7 +2,7 @@ Source: vcmi
 Section: games
 Priority: optional
 Maintainer: Ivan Savenko <[email protected]>
-Build-Depends: debhelper (>= 8), cmake, libsdl-image1.2-dev, libsdl-ttf2.0-dev, libsdl-mixer1.2-dev (>= 1.2.8), zlib1g-dev, libavformat-dev, libswscale-dev, libboost-dev (>=1.48), libboost-program-options-dev (>=1.48), libboost-filesystem-dev (>=1.48), libboost-system-dev (>=1.48), libboost-locale-dev (>=1.48), libboost-thread-dev (>=1.48)
+Build-Depends: debhelper (>= 8), cmake, libsdl-image1.2-dev, libsdl-ttf2.0-dev, libsdl-mixer1.2-dev (>= 1.2.8), zlib1g-dev, libavformat-dev, libswscale-dev, libboost-dev (>=1.48), libboost-program-options-dev (>=1.48), libboost-filesystem-dev (>=1.48), libboost-system-dev (>=1.48), libboost-locale-dev (>=1.48), libboost-thread-dev (>=1.48), qtbase5-dev
 Standards-Version: 3.9.1
 Homepage: http://vcmi.eu
 

+ 2 - 1
launcher/modManager/cmodlistview_moc.cpp

@@ -381,7 +381,8 @@ void CModListView::on_uninstallButton_clicked()
 	if (modModel->hasMod(modName) &&
 	    modModel->getMod(modName).isInstalled())
 	{
-		manager->disableMod(modName);
+		if (modModel->getMod(modName).isEnabled())
+			manager->disableMod(modName);
 		manager->uninstallMod(modName);
 	}
 	checkManagerErrors();

+ 1 - 1
lib/CCreatureHandler.cpp

@@ -385,7 +385,7 @@ void CCreatureHandler::loadObject(std::string scope, std::string name, const Jso
 	creatures[index] = object;
 
 	VLC->modh->identifiers.registerObject(scope, "creature", name, object->idNumber);
-	for(auto node : data["extraNames"].Vector())
+	for(auto & node : data["extraNames"].Vector())
 	{
 		VLC->modh->identifiers.registerObject(scope, "creature", node.String(), object->idNumber);
 	}

+ 1 - 1
lib/CModHandler.cpp

@@ -247,7 +247,7 @@ bool CContentHandler::ContentTypeHandler::loadMod(std::string modName, bool vali
 	if (!modInfo.patches.isNull())
 		JsonUtils::merge(modInfo.modData, modInfo.patches);
 
-	for(auto entry : modInfo.modData.Struct())
+	for(auto & entry : modInfo.modData.Struct())
 	{
 		const std::string & name = entry.first;
 		JsonNode & data = entry.second;

+ 4 - 1
lib/filesystem/AdapterLoaders.cpp

@@ -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

+ 32 - 0
lib/filesystem/ResourceID.cpp

@@ -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