Pārlūkot izejas kodu

Compile fix - template specialization is defined before generic template.

DjWarmonger 12 gadi atpakaļ
vecāks
revīzija
2f698acf98
2 mainītis faili ar 18 papildinājumiem un 18 dzēšanām
  1. 1 1
      AI/VCAI/Fuzzy.cpp
  2. 17 17
      AI/VCAI/Goals.cpp

+ 1 - 1
AI/VCAI/Fuzzy.cpp

@@ -5,7 +5,7 @@
 #include "../../lib/CObjectHandler.h"
 #include "../../lib/CCreatureHandler.h"
 #include "../../lib/VCMI_Lib.h"
-//#include "Goals.h"
+//#include "Goals.cpp"
 //#include "VCAI.h"
 
 /*

+ 17 - 17
AI/VCAI/Goals.cpp

@@ -74,6 +74,23 @@ std::string Goals::AbstractGoal::name() const //TODO: virtualize
 	}
 }
 
+//TODO: find out why the following are not generated automatically on MVS?
+
+namespace Goals 
+{ 
+	template <>
+	void CGoal<Win>::accept (VCAI * ai)
+	{
+		ai->tryRealize(static_cast<Win&>(*this));
+	}
+
+	template <>
+	void CGoal<Build>::accept (VCAI * ai)
+	{
+		ai->tryRealize(static_cast<Build&>(*this));
+	}
+}
+
 //TSubgoal AbstractGoal::whatToDoToAchieve()
 //{
 //    logAi->debugStream() << boost::format("Decomposing goal of type %s") % name();
@@ -868,20 +885,3 @@ void CGoal<T>::accept (VCAI * ai)
 	ai->tryRealize(static_cast<T&>(*this)); //casting enforces template instantiation
 }
 
-//TODO: find out why the following are not generated automatically on MVS?
-
-namespace Goals 
-{ 
-	template <>
-	void CGoal<Win>::accept (VCAI * ai)
-	{
-		ai->tryRealize(static_cast<Win&>(*this));
-	}
-
-	template <>
-	void CGoal<Build>::accept (VCAI * ai)
-	{
-		ai->tryRealize(static_cast<Build&>(*this));
-	}
-}
-