Explorar el Código

[c::b] Updated projects, applied fixes

AlexVinS hace 7 años
padre
commit
f17783cfb5

+ 3 - 3
AI/VCAI/Goals.cpp

@@ -14,7 +14,7 @@
 #include "ResourceManager.h"
 #include "../../lib/mapping/CMap.h" //for victory conditions
 #include "../../lib/CPathfinder.h"
-#include "StringConstants.h"
+#include "../../lib/StringConstants.h"
 
 #include "AIhelper.h"
 
@@ -133,7 +133,7 @@ bool Goals::AbstractGoal::operator==(AbstractGoal & g)
 		return g.hero.h == hero.h; //how comes HeroPtrs are equal for different heroes?
 		break;
 
-	case GATHER_ARMY: //actual value is indifferent 
+	case GATHER_ARMY: //actual value is indifferent
 		return (g.hero.h == hero.h || town == g.town); //TODO: gather army for town maybe?
 		break;
 
@@ -1001,7 +1001,7 @@ TGoalVec Goals::CollectRes::getAllPossibleSubgoals()
 }
 
 TSubgoal CollectRes::whatToDoToAchieve()
-{	
+{
 	auto goals = getAllPossibleSubgoals();
 	auto trade = whatToDoToTrade();
 	if (!trade->invalid())

+ 4 - 0
AI/VCAI/VCAI.cbp

@@ -83,10 +83,14 @@
 		</Linker>
 		<Unit filename="AIUtility.cpp" />
 		<Unit filename="AIUtility.h" />
+		<Unit filename="AIhelper.cpp" />
+		<Unit filename="AIhelper.h" />
 		<Unit filename="Fuzzy.cpp" />
 		<Unit filename="Fuzzy.h" />
 		<Unit filename="Goals.cpp" />
 		<Unit filename="Goals.h" />
+		<Unit filename="ResourceManager.cpp" />
+		<Unit filename="ResourceManager.h" />
 		<Unit filename="StdInc.h">
 			<Option compile="1" />
 			<Option weight="0" />

+ 11 - 0
test/Test.cbp

@@ -66,6 +66,8 @@
 			<Add option="-lVCMI_lib" />
 			<Add option="-lboost_filesystem$(#boost.libsuffix)" />
 			<Add option="-lboost_system$(#boost.libsuffix)" />
+			<Add option="-lboost_thread$(#boost.libsuffix)" />
+			<Add library="../AI/VCAI.dll" />
 			<Add directory="../" />
 		</Linker>
 		<Unit filename="CMakeLists.txt" />
@@ -99,6 +101,8 @@
 		<Unit filename="map/MapComparer.h" />
 		<Unit filename="mock/mock_BonusBearer.cpp" />
 		<Unit filename="mock/mock_BonusBearer.h" />
+		<Unit filename="mock/mock_CPSICallback.cpp" />
+		<Unit filename="mock/mock_CPSICallback.h" />
 		<Unit filename="mock/mock_IGameCallback.cpp" />
 		<Unit filename="mock/mock_IGameCallback.h" />
 		<Unit filename="mock/mock_MapService.cpp" />
@@ -139,6 +143,13 @@
 		<Unit filename="spells/targetConditions/TargetConditionItemFixture.cpp" />
 		<Unit filename="spells/targetConditions/TargetConditionItemFixture.h" />
 		<Unit filename="testdata/rmg/1.json" />
+		<Unit filename="vcai/ResourceManagerTest.h" />
+		<Unit filename="vcai/ResurceManagerTest.cpp" />
+		<Unit filename="vcai/mock_ResourceManager.cpp" />
+		<Unit filename="vcai/mock_ResourceManager.h" />
+		<Unit filename="vcai/mock_VCAI.cpp" />
+		<Unit filename="vcai/mock_VCAI.h" />
+		<Unit filename="vcai/mock_VCAI_CGoal.h" />
 		<Extensions>
 			<code_completion />
 			<envvars />

+ 1 - 1
test/mock/mock_CPSICallback.cpp

@@ -1,5 +1,5 @@
 /*
-* {file}.cpp, part of VCMI engine
+* mock_CPLayerSpecificInfoCallback.cpp, part of VCMI engine
 *
 * Authors: listed in file AUTHORS in main folder
 *

+ 2 - 2
test/mock/mock_CPSICallback.h

@@ -16,7 +16,7 @@
 
 class CCallback;
 
-class GameCallbackMock : public CPlayerSpecificInfoCallback
+class CPSICallbackMock : public CPlayerSpecificInfoCallback
 {
 public:
 	using CPlayerSpecificInfoCallback::CPlayerSpecificInfoCallback;
@@ -25,4 +25,4 @@ public:
 	//std::vector <const CGTownInstance *> getTownsInfo(bool onlyOur = true) const;
 	MOCK_CONST_METHOD0(getTownsInfo, std::vector <const CGTownInstance *>());
 	MOCK_CONST_METHOD1(getTownsInfo, std::vector <const CGTownInstance *>(bool));
-};
+};

+ 1 - 1
test/mock/mock_IGameCallback.h

@@ -1,5 +1,5 @@
 /*
- * {file}.h, part of VCMI engine
+ * mock_IGameCallback.h, part of VCMI engine
  *
  * Authors: listed in file AUTHORS in main folder
  *

+ 2 - 2
test/vcai/ResurceManagerTest.cpp

@@ -27,7 +27,7 @@ struct ResourceManagerTest : public Test//, public IResourceManager
 {
 	std::unique_ptr<ResourceManagerMock> rm;
 
-	NiceMock<GameCallbackMock> gcm;
+	NiceMock<CPSICallbackMock> gcm;
 	NiceMock<VCAIMock> aim;
 	TSubgoal invalidGoal, gatherArmy, buildThis, buildAny, recruitHero;
 
@@ -251,4 +251,4 @@ TEST_F(ResourceManagerTest, freeGold)
 		.WillByDefault(Return(TResources(0, 0, 0, 0, 0, 0, -3762363)));
 
 	ASSERT_GE(rm->freeGold(), 0) << "We should never see negative savings";
-}
+}