浏览代码

- Moved FunctionList from /client to /lib -> used in client and server
- Updated project files

beegee1 12 年之前
父节点
当前提交
41e274b4aa

+ 0 - 1
client/CMakeLists.txt

@@ -48,7 +48,6 @@ set(client_SRCS
 
 set(client_HEADERS
 		CSoundBase.h
-		FunctionList.h
 
 		gui/SDL_Pixels.h
 )

+ 1 - 1
client/CPlayerInterface.h

@@ -2,7 +2,7 @@
 
 
 #include "../lib/CondSh.h"
-#include "FunctionList.h"
+#include "../lib/FunctionList.h"
 #include "../lib/CGameInterface.h"
 #include "gui/CIntObject.h"
 #include "../lib/CGameState.h"

+ 1 - 1
client/CPreGame.h

@@ -4,7 +4,7 @@
 #include <SDL.h>
 #include "../lib/StartInfo.h"
 #include "GUIClasses.h"
-#include "FunctionList.h"
+#include "../lib/FunctionList.h"
 #include "../lib/mapping/CMapInfo.h"
 #include "../lib/rmg/CMapGenerator.h"
 

+ 1 - 1
client/GUIClasses.h

@@ -1,7 +1,7 @@
 #pragma once
 
 #include "CAnimation.h"
-#include "FunctionList.h"
+#include "../lib/FunctionList.h"
 #include "../lib/ResourceSet.h"
 #include "../lib/CConfigHandler.h"
 #include "../lib/GameConstants.h"

+ 1 - 2
client/VCMI_client.vcxproj

@@ -231,7 +231,6 @@
     <ClInclude Include="CSpellWindow.h" />
     <ClInclude Include="CVideoHandler.h" />
     <ClInclude Include="FontBase.h" />
-    <ClInclude Include="FunctionList.h" />
     <ClInclude Include="Graphics.h" />
     <ClInclude Include="GUIClasses.h" />
     <ClInclude Include="mapHandler.h" />
@@ -261,4 +260,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

+ 1 - 2
client/VCMI_client.vcxproj.filters

@@ -60,7 +60,6 @@
     <ClInclude Include="CSpellWindow.h" />
     <ClInclude Include="CVideoHandler.h" />
     <ClInclude Include="FontBase.h" />
-    <ClInclude Include="FunctionList.h" />
     <ClInclude Include="Graphics.h" />
     <ClInclude Include="GUIClasses.h" />
     <ClInclude Include="resource.h" />
@@ -93,4 +92,4 @@
     <None Include="..\ChangeLog" />
     <None Include="vcmi.ico" />
   </ItemGroup>
-</Project>
+</Project>

+ 1 - 1
client/battle/CCreatureAnimation.h

@@ -1,6 +1,6 @@
 #pragma once
 
-#include "../FunctionList.h"
+#include "../../lib/FunctionList.h"
 //#include "../CDefHandler.h"
 #include "../CAnimation.h"
 

+ 1 - 1
client/gui/CIntObjectClasses.h

@@ -2,7 +2,7 @@
 
 #include "CIntObject.h"
 #include "SDL_Extensions.h"
-#include "../FunctionList.h"
+#include "../../lib/FunctionList.h"
 
 struct SDL_Surface;
 struct Rect;

+ 3 - 0
lib/CMakeLists.txt

@@ -73,8 +73,10 @@ set(lib_SRCS
 
 set(lib_HEADERS
 		../Global.h
+
 		filesystem/CInputStream.h
 		filesystem/ISimpleResourceLoader.h
+
 		AI_Base.h
 		CondSh.h
 		ConstTransitivePtr.h
@@ -82,6 +84,7 @@ set(lib_HEADERS
 		CRandomGenerator.h
 		CScriptingModule.h
 		CStopWatch.h
+		FunctionList.h
 		GameConstants.h
 		StringConstants.h
 		IGameEventsReceiver.h

+ 85 - 85
client/FunctionList.h → lib/FunctionList.h

@@ -1,85 +1,85 @@
-#pragma once
-
-
-/*
- * FunctionList.h, part of VCMI engine
- *
- * Authors: listed in file AUTHORS in main folder
- *
- * License: GNU General Public License v2.0 or later
- * Full text of license available in license.txt file, in main folder
- *
- */
-
-/// List of functions that share the same signature - can be used to call all of them easily
-template<typename Signature>
-class CFunctionList
-{
-public:
-	std::vector<boost::function<Signature> > funcs;
-
-	CFunctionList(int){};
-	CFunctionList(){};
-	template <typename Functor> 
-	CFunctionList(const Functor &f)
-	{
-		funcs.push_back(boost::function<Signature>(f));
-	}
-	CFunctionList(const boost::function<Signature> &first)
-	{
-		if (first)
-			funcs.push_back(first);
-	}
-	CFunctionList(std::nullptr_t)
-	{}
-	CFunctionList & operator+=(const boost::function<Signature> &first)
-	{
-		funcs.push_back(first);
-		return *this;
-	}
-	void add(const CFunctionList<Signature> &first)
-	{
-		for (size_t i = 0; i < first.funcs.size(); i++)
-		{
-			funcs.push_back(first.funcs[i]);
-		}
-	}
-	void clear()
-	{
-		funcs.clear();
-	}
-	operator bool() const
-	{
-		return funcs.size();
-	}
-	void operator()() const
-	{
-		std::vector<boost::function<Signature> > funcs2 = funcs; //backup
-		for(size_t i=0;i<funcs2.size(); ++i) 
-		{
-			if (funcs2[i])
-				funcs2[i]();
-		}
-	}
-	template <typename Arg> 
-	void operator()(const Arg & a) const
-	{
-		std::vector<boost::function<Signature> > funcs2 = funcs; //backup
-		for(int i=0;i<funcs2.size(); i++) 
-		{
-			if (funcs2[i])
-				funcs2[i](a);
-		}
-	}
-	// Me wants variadic templates :(
-	template <typename Arg1, typename Arg2>
-	void operator()(Arg1 & a, Arg2 & b) const
-	{
-		std::vector<boost::function<Signature> > funcs2 = funcs; //backup
-		for(int i=0;i<funcs2.size(); i++)
-		{
-			if (funcs2[i])
-				funcs2[i](a, b);
-		}
-	}
-};
+#pragma once
+
+
+/*
+ * FunctionList.h, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+/// List of functions that share the same signature - can be used to call all of them easily
+template<typename Signature>
+class CFunctionList
+{
+public:
+	std::vector<boost::function<Signature> > funcs;
+
+	CFunctionList(int){};
+	CFunctionList(){};
+	template <typename Functor> 
+	CFunctionList(const Functor &f)
+	{
+		funcs.push_back(boost::function<Signature>(f));
+	}
+	CFunctionList(const boost::function<Signature> &first)
+	{
+		if (first)
+			funcs.push_back(first);
+	}
+	CFunctionList(std::nullptr_t)
+	{}
+	CFunctionList & operator+=(const boost::function<Signature> &first)
+	{
+		funcs.push_back(first);
+		return *this;
+	}
+	void add(const CFunctionList<Signature> &first)
+	{
+		for (size_t i = 0; i < first.funcs.size(); i++)
+		{
+			funcs.push_back(first.funcs[i]);
+		}
+	}
+	void clear()
+	{
+		funcs.clear();
+	}
+	operator bool() const
+	{
+		return funcs.size();
+	}
+	void operator()() const
+	{
+		std::vector<boost::function<Signature> > funcs2 = funcs; //backup
+		for(size_t i=0;i<funcs2.size(); ++i) 
+		{
+			if (funcs2[i])
+				funcs2[i]();
+		}
+	}
+	template <typename Arg> 
+	void operator()(const Arg & a) const
+	{
+		std::vector<boost::function<Signature> > funcs2 = funcs; //backup
+		for(int i=0;i<funcs2.size(); i++) 
+		{
+			if (funcs2[i])
+				funcs2[i](a);
+		}
+	}
+	// Me wants variadic templates :(
+	template <typename Arg1, typename Arg2>
+	void operator()(Arg1 & a, Arg2 & b) const
+	{
+		std::vector<boost::function<Signature> > funcs2 = funcs; //backup
+		for(int i=0;i<funcs2.size(); i++)
+		{
+			if (funcs2[i])
+				funcs2[i](a, b);
+		}
+	}
+};

+ 2 - 1
lib/VCMI_lib.vcxproj

@@ -272,6 +272,7 @@
     <ClInclude Include="filesystem\CZipLoader.h" />
     <ClInclude Include="filesystem\Filesystem.h" />
     <ClInclude Include="filesystem\ISimpleResourceLoader.h" />
+	<ClInclude Include="FunctionList.h" />
     <ClInclude Include="IBonusTypeHandler.h" />
     <ClInclude Include="mapping\CCampaignHandler.h" />
     <ClInclude Include="mapping\CMap.h" />
@@ -308,4 +309,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>

+ 4 - 1
lib/VCMI_lib.vcxproj.filters

@@ -231,6 +231,9 @@
     <ClInclude Include="Filesystem\CCompressedStream.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="FunctionList.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
     <ClInclude Include="CModHandler.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -316,4 +319,4 @@
       <Filter>RMG</Filter>
     </ClInclude>
   </ItemGroup>
-</Project>
+</Project>

+ 1 - 1
server/CGameHandler.h

@@ -1,7 +1,7 @@
 #pragma once
 
 
-#include "../client/FunctionList.h"
+#include "../lib/FunctionList.h"
 #include "../lib/CGameState.h"
 #include "../lib/Connection.h"
 #include "../lib/IGameCallback.h"