Browse Source

Empty function for hero movement

Michał W. Urbańczyk 18 years ago
parent
commit
2030a6793f
5 changed files with 23 additions and 9 deletions
  1. 1 0
      CCallback.cpp
  2. 7 0
      CCallback.h
  3. 4 3
      CGameInterface.cpp
  4. 4 0
      CGameInterface.h
  5. 7 6
      CMT.cpp

+ 1 - 0
CCallback.cpp

@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "CCallback.h"
+#include "CPathfinder.h"
 
 bool CCallback::moveHero(int ID, int3 destPoint)
 {

+ 7 - 0
CCallback.h

@@ -1,10 +1,17 @@
 #ifndef CCALLBACK_H
 #define CCALLBACK_H
 class CGameState;
+struct HeroMoveDetails
+{
+	int3 src, dst; //source and destination points
+	int heroID; //which hero
+	int owner;
+};
 class CCallback 
 {
 protected:
 	CGameState * gs;
+
 public:
 	bool moveHero(int ID, int3 destPoint);
 };

+ 4 - 3
CGameInterface.cpp

@@ -172,10 +172,11 @@ void CPlayerInterface::yourTurn()
 		SDL_Delay(5); //give time for other apps
 		SDL_framerateDelay(mainLoopFramerateKeeper);
 	}
+}
 
-
-
-
+void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
+{
+	
 }
 
 void CPlayerInterface::handleEvent(SDL_Event *sEvent)

+ 4 - 0
CGameInterface.h

@@ -9,6 +9,7 @@ BOOST_TRIBOOL_THIRD_STATE(outOfRange)
 using namespace boost::logic;
 class CAdvMapInt;
 
+struct HeroMoveDetails;
 class CIntObject //interface object
 {
 public:
@@ -78,6 +79,8 @@ public:
 	int playerID, serialID;
 
 	virtual void yourTurn()=0{};
+
+	virtual void heroMoved(const HeroMoveDetails & details)=0;
 };
 class CGlobalAI : public CGameInterface // AI class (to derivate)
 {
@@ -98,6 +101,7 @@ public:
 	std::vector<MotionInterested*> motioninterested;
 
 	void yourTurn();
+	void heroMoved(const HeroMoveDetails & details);
 	void handleEvent(SDL_Event * sEvent);
 	void init();
 

+ 7 - 6
CMT.cpp

@@ -63,10 +63,8 @@ TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
 
 int _tmain(int argc, _TCHAR* argv[])
 { 
-
 		//CBIKHandler cb;
 		//cb.open("CSECRET.BIK");
-
 	THC timeHandler tmh;
 	THC tmh.getDif();
 	int xx=0, yy=0, zz=0;
@@ -235,10 +233,13 @@ int _tmain(int argc, _TCHAR* argv[])
 
 
 		for (int i=0; i<cgi->scenarioOps.playerInfos.size();i++) //initializing interfaces
-		{
-			if(cgi->scenarioOps.playerInfos[i].name=="AI")
-				cgi->playerint.push_back(new CGlobalAI());
-			else 
+		{ 
+
+			//TODO: uncomment when AI will be done
+
+			//if(cgi->scenarioOps.playerInfos[i].name=="AI")
+			//	cgi->playerint.push_back(new CGlobalAI());
+			//else 
 			{
 				cgi->playerint.push_back(new CPlayerInterface(cgi->scenarioOps.playerInfos[i].color,i));
 				((CPlayerInterface*)(cgi->playerint[i]))->init();