1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Empty function for hero movement

This commit is contained in:
Michał W. Urbańczyk
2007-08-29 10:05:50 +00:00
parent 210123ac33
commit 2030a6793f
5 changed files with 23 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

13
CMT.cpp
View File

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