瀏覽代碼

Compile fix for #847

DjWarmonger 13 年之前
父節點
當前提交
ba646b1d41
共有 4 個文件被更改,包括 39 次插入39 次删除
  1. 36 36
      client/CConfigHandler.cpp
  2. 0 1
      client/CConfigHandler.h
  3. 3 1
      lib/JsonNode.h
  4. 0 1
      lib/NetPacksLib.cpp

+ 36 - 36
client/CConfigHandler.cpp

@@ -1,7 +1,7 @@
-#include "StdInc.h"
+#include "StdInc.h"
 #include "CConfigHandler.h"
 
-#include "../lib/GameConstants.h"
+#include "../lib/GameConstants.h"
 #include "../lib/VCMIDirs.h"
 
 using namespace config;
@@ -15,17 +15,17 @@ using namespace config;
  * Full text of license available in license.txt file, in main folder
  *
  */
-
+
 SettingsStorage settings;
 CConfigHandler conf;
-
+
 template<typename Accessor>
 SettingsStorage::NodeAccessor<Accessor>::NodeAccessor(SettingsStorage & _parent, std::vector<std::string> _path):
 	parent(_parent),
 	path(_path)
 {
 }
-
+
 template<typename Accessor>
 SettingsStorage::NodeAccessor<Accessor> SettingsStorage::NodeAccessor<Accessor>::operator [](std::string nextNode) const
 {
@@ -33,42 +33,42 @@ SettingsStorage::NodeAccessor<Accessor> SettingsStorage::NodeAccessor<Accessor>:
 	newPath.push_back(nextNode);
 	return NodeAccessor(parent, newPath);
 }
-
+
 template<typename Accessor>
 SettingsStorage::NodeAccessor<Accessor>::operator Accessor() const
 {
 	return Accessor(parent, path);
 }
-
-template<typename Accessor>
-SettingsStorage::NodeAccessor<Accessor> SettingsStorage::NodeAccessor<Accessor>::operator () (std::vector<std::string> _path)
-{
-	std::vector<std::string> newPath = path;
-	newPath.insert( newPath.end(), _path.begin(), _path.end());
-	return NodeAccessor(parent, newPath);
-}
+
+template<typename Accessor>
+SettingsStorage::NodeAccessor<Accessor> SettingsStorage::NodeAccessor<Accessor>::operator () (std::vector<std::string> _path)
+{
+	std::vector<std::string> newPath = path;
+	newPath.insert( newPath.end(), _path.begin(), _path.end());
+	return NodeAccessor(parent, newPath);
+}
 
 SettingsStorage::SettingsStorage():
-	write(NodeAccessor<Settings>(*this, std::vector<std::string>() )),
+	write(NodeAccessor<Settings>(*this, std::vector<std::string>() )),
 	listen(NodeAccessor<SettingsListener>(*this, std::vector<std::string>() ))
 {
 }
-
-void SettingsStorage::init()
-{
-	JsonNode(GVCMIDirs.UserPath + "/config/settings.json").swap(config);
-	JsonNode schema(GameConstants::DATA_DIR + "/config/defaultSettings.json");
-	config.validate(schema);
-}
+
+void SettingsStorage::init()
+{
+	JsonNode(GVCMIDirs.UserPath + "/config/settings.json").swap(config);
+	JsonNode schema(GameConstants::DATA_DIR + "/config/defaultSettings.json");
+	config.validate(schema);
+}
 
 void SettingsStorage::invalidateNode(const std::vector<std::string> &changedPath)
 {
 	BOOST_FOREACH(SettingsListener * listener, listeners)
-		listener->nodeInvalidated(changedPath);
+		listener->nodeInvalidated(changedPath);
 
 	JsonNode savedConf = config;
 	JsonNode schema(GameConstants::DATA_DIR + "/config/defaultSettings.json");
-
+
 	savedConf.Struct().erase("session");
 	savedConf.minimize(schema);
 	std::ofstream file((GVCMIDirs.UserPath + "/config/settings.json").c_str(), std::ofstream::trunc | std::ofstream::out);
@@ -107,20 +107,20 @@ SettingsListener::~SettingsListener()
 }
 
 void SettingsListener::nodeInvalidated(const std::vector<std::string> changedPath)
-{
-	if (!callback)
-		return;
+{
+	if (!callback)
+		return;
 
 	size_t min = std::min(path.size(), changedPath.size());
 	size_t mismatch = std::mismatch(path.begin(), path.begin()+min, changedPath.begin()).first - path.begin();
 
 	if (min == mismatch)
 		callback(parent.getNode(path));
-}
-
-void SettingsListener::operator() (boost::function<void(const JsonNode&)> _callback)
-{
-	callback = _callback;
+}
+
+void SettingsListener::operator() (boost::function<void(const JsonNode&)> _callback)
+{
+	callback = _callback;
 }
 
 Settings::Settings(SettingsStorage &_parent, const std::vector<std::string> &_path):
@@ -156,9 +156,9 @@ JsonNode& Settings::operator [](std::string value)
 {
 	return node[value];
 }
-
-template struct SettingsStorage::NodeAccessor<SettingsListener>;
-template struct SettingsStorage::NodeAccessor<Settings>;
+
+template struct SettingsStorage::NodeAccessor<SettingsListener>;
+template struct SettingsStorage::NodeAccessor<Settings>;
 
 static void setButton(ButtonInfo &button, const JsonNode &g)
 {
@@ -273,7 +273,7 @@ void config::CConfigHandler::init()
 	const JsonNode& gameRes = settings["video"]["gameRes"];
 
 	//fixing screenx / screeny
-	if (screenRes["width"].Float()  != gameRes["width"].Float()
+	if (screenRes["width"].Float()  != gameRes["width"].Float()
 	 || screenRes["height"].Float() != gameRes["height"].Float())
 	{
 		Settings screen = settings.write["video"]["screenRes"];

+ 0 - 1
client/CConfigHandler.h

@@ -11,7 +11,6 @@
  * Full text of license available in license.txt file, in main folder
  *
  */
-
 class Settings;
 class SettingsListener;
 

+ 3 - 1
lib/JsonNode.h

@@ -98,7 +98,7 @@ public:
 	JsonWriter(std::ostream &output, const JsonNode &node);
 };
 
-std::ostream & operator<<(std::ostream &out, const JsonNode &node);
+DLL_LINKAGE std::ostream & operator<<(std::ostream &out, const JsonNode &node);
 
 //Tiny string class that uses const char* as data for speed, members are private
 //for ease of debugging and some compatibility with std::string
@@ -184,3 +184,5 @@ public:
 	// validate with external schema
 	JsonValidator(JsonNode &root, const JsonNode &schema, bool minimize=false);
 };
+
+

+ 0 - 1
lib/NetPacksLib.cpp

@@ -550,7 +550,6 @@ DLL_LINKAGE const CArtifactInstance *ArtifactLocation::getArt() const
 		}
 	}
 	return NULL;
-	return NULL;
 }
 
 DLL_LINKAGE CArtifactInstance *ArtifactLocation::getArt()