1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

* upgrades in moveHero function

* new folder structure
This commit is contained in:
mateuszb 2007-08-30 10:11:53 +00:00
parent 2d7dbbefc3
commit 5222be8d94
56 changed files with 111 additions and 86 deletions

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "CAdvmapInterface.h"
#include "CLodHandler.h"
#include "CPreGameTextHandler.h"
#include "hch\CLodHandler.h"
#include "hch\CPreGameTextHandler.h"
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts

View File

@ -2,7 +2,7 @@
#define CADVENTUREMAPINTERFACE_H
#include "SDL.h"
#include "CDefHandler.h"
#include "hch\CDefHandler.h"
#include "SDL_Extensions.h"
#include "CGameInterface.h"
#include "CGameInfo.h"

View File

@ -1,10 +1,12 @@
#include "stdafx.h"
#include "CCallback.h"
#include "CPathfinder.h"
#include "CHeroHandler.h"
#include "hch\CHeroHandler.h"
#include "CGameInfo.h"
#include "CAmbarCendamo.h"
#include "hch\CAmbarCendamo.h"
#include "mapHandler.h"
#include "CGameState.h"
#include "CGameInterface.h"
bool CCallback::moveHero(int ID, int3 destPoint)
{
@ -19,5 +21,28 @@ bool CCallback::moveHero(int ID, int3 destPoint)
CPath * ourPath = CGI->pathf->getPath(CGI->heroh->heroInstances[ID]->pos, destPoint, CGI->heroh->heroInstances[ID]);
if(!ourPath)
return false;
return false;
for(int i=0; i<ourPath->nodes.size()-1; ++i)
{
int3 stpos, endpos;
stpos = int3(ourPath->nodes[i].x, ourPath->nodes[i].y, CGI->heroh->heroInstances[ID]->pos.z);
endpos = int3(ourPath->nodes[i+1].x, ourPath->nodes[i+1].y, CGI->heroh->heroInstances[ID]->pos.z);
HeroMoveDetails curd;
curd.src = stpos;
curd.dst = endpos;
curd.heroID = ID;
curd.owner = CGI->heroh->heroInstances[ID]->owner;
if(CGI->heroh->heroInstances[ID]->movement>=CGI->mh->getCost(stpos, endpos, CGI->heroh->heroInstances[ID]))
{ //performing move
for(int j=0; j<CGI->state->players.size(); ++j)
{
if(CGI->state->players[j].fogOfWarMap[stpos.x][stpos.y][stpos.z] || CGI->state->players[j].fogOfWarMap[endpos.x][endpos.y][endpos.z])
{ //player should be notified
CGI->playerint[j]->heroMoved(curd);
}
}
}
else
return true; //move ended - no more movement points
}
return true;
}

View File

@ -4,7 +4,7 @@
#include "SDL_thread.h"
#include "CGameInfo.h"
#include "SDL_framerate.h"
#include "CLodHandler.h"
#include "hch\CLodHandler.h"
extern SDL_Surface * screen;

View File

@ -2,7 +2,7 @@
#define CGAMEINTERFACE_H
#include "SDL.h"
#include "CDefHandler.h"
#include "hch\CDefHandler.h"
#include "SDL_Extensions.h"
#include <boost/logic/tribool.hpp>
BOOST_TRIBOOL_THIRD_STATE(outOfRange)

View File

@ -9,7 +9,7 @@ struct PlayerState
{
public:
int color;
std::vector<std::vector<std::vector<bool> > >fogOfWarMap;
std::vector<std::vector<std::vector<char> > >fogOfWarMap; //true - visible, false - hidden
std::vector<int> resources;
std::vector<CHeroInstance *> heroes;
std::vector<CTownInstance *> towns;

36
CMT.cpp
View File

@ -3,9 +3,9 @@
#include "stdafx.h"
#include "SDL.h"
#include "SDL_TTF.h"
#include "CVideoHandler.h"
#include "hch\CVideoHandler.h"
#include "SDL_mixer.h"
#include "CBuildingHandler.h"
#include "hch\CBuildingHandler.h"
#include "SDL_Extensions.h"
#include "SDL_framerate.h"
#include <cmath>
@ -17,26 +17,26 @@
#include "zlib.h"
#include <cmath>
#include <ctime>
#include "CArtHandler.h"
#include "CHeroHandler.h"
#include "CCreatureHandler.h"
#include "CAbilityHandler.h"
#include "CSpellHandler.h"
#include "CBuildingHandler.h"
#include "CObjectHandler.h"
#include "hch\CArtHandler.h"
#include "hch\CHeroHandler.h"
#include "hch\CCreatureHandler.h"
#include "hch\CAbilityHandler.h"
#include "hch\CSpellHandler.h"
#include "hch\CBuildingHandler.h"
#include "hch\CObjectHandler.h"
#include "CGameInfo.h"
#include "CMusicHandler.h"
#include "CSemiLodHandler.h"
#include "CLodHandler.h"
#include "CDefHandler.h"
#include "CSndHandler.h"
#include "CTownHandler.h"
#include "CDefObjInfoHandler.h"
#include "CAmbarCendamo.h"
#include "hch\CMusicHandler.h"
#include "hch\CSemiLodHandler.h"
#include "hch\CLodHandler.h"
#include "hch\CDefHandler.h"
#include "hch\CSndHandler.h"
#include "hch\CTownHandler.h"
#include "hch\CDefObjInfoHandler.h"
#include "hch\CAmbarCendamo.h"
#include "mapHandler.h"
#include "global.h"
#include "CPreGame.h"
#include "CGeneralTextHandler.h"
#include "hch\CGeneralTextHandler.h"
#include "CConsoleHandler.h"
#include "CCursorHandler.h"
#include "CScreenHandler.h"

View File

@ -1,11 +1,11 @@
#include "stdafx.h"
#include "CMessage.h"
#include "SDL_TTF.h"
#include "CSemiDefHandler.h"
#include "CDefHandler.h"
#include "hch\CSemiDefHandler.h"
#include "hch\CDefHandler.h"
#include "CGameInfo.h"
#include "SDL_Extensions.h"
#include "CLodHandler.h"
#include "hch\CLodHandler.h"
SDL_Color tytulowy, tlo, zwykly ;
SDL_Rect genRect(int hh, int ww, int xx, int yy);

View File

@ -4,8 +4,8 @@
#include "global.h"
#include "SDL_TTF.h"
#include "SDL.h"
#include "CSemiDefHandler.h"
#include "CDefHandler.h"
#include "hch\CSemiDefHandler.h"
#include "hch\CDefHandler.h"
#include "CGameInterface.h"
#include "CGameInfo.h"
#include "SDL_Extensions.h"

View File

@ -2,7 +2,7 @@
#include "global.h"
#include "CPathfinder.h"
#include "CGameInfo.h"
#include "CAmbarCendamo.h"
#include "hch\CAmbarCendamo.h"
#include "mapHandler.h"
CPath * CPathfinder::getPath(int3 &src, int3 &dest, CHeroInstance * hero) //TODO: test it (seems to be finished, but relies on unwritten functions :()
{

Binary file not shown.

View File

@ -2,12 +2,12 @@
#define CPREGAME_H
#include "SDL.h"
#include "StartInfo.h"
#include "CSemiDefHandler.h"
#include "CSemiLodHandler.h"
#include "CPreGameTextHandler.h"
#include "hch\CSemiDefHandler.h"
#include "hch\CSemiLodHandler.h"
#include "hch\CPreGameTextHandler.h"
#include "CMessage.h"
#include "map.h"
#include "CMusicHandler.h"
#include "hch\CMusicHandler.h"
class CPreGame;
extern CPreGame * CPG;

View File

@ -6,7 +6,7 @@
#include "SDL_Extensions.h"
#include "CCursorHandler.h"
#include "CGameInfo.h"
#include "CDefHandler.h"
#include "hch\CDefHandler.h"
extern SDL_Surface * screen, * screen2;

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CAbilityHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"
void CAbilityHandler::loadAbilities()

View File

@ -1,11 +1,11 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CAmbarCendamo.h"
#include "CSemiDefHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CObjectHandler.h"
#include "CCastleHandler.h"
#include "CDefObjInfoHandler.h"
#include "SDL_Extensions.h"
#include "../SDL_Extensions.h"
#include "boost\filesystem.hpp"
#include "CLodHandler.h"
#include <set>

View File

@ -4,9 +4,9 @@
#include <fstream>
#include <string>
#include <vector>
#include "global.h"
#include "../global.h"
#include "SDL.h"
#include "map.h"
#include "../map.h"
#include "CSemiDefHandler.h"
#include "CDefHandler.h"
#include "CCreatureHandler.h"

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CArtHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"

View File

@ -1,5 +1,5 @@
#include "stdafx.h"
#include "CGameInfo.h"
#include "../stdafx.h"
#include "../CGameInfo.h"
#include "CBuildingHandler.h"
#include "CLodHandler.h"

View File

@ -1,5 +1,5 @@
#include "stdafx.h"
#include "CGameInfo.h"
#include "../stdafx.h"
#include "../CGameInfo.h"
#include "CCreatureHandler.h"
#include "CLodHandler.h"

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CDefObjInfoHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CLodHandler.h"
#include <sstream>

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CGeneralTextHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CLodHandler.h"
#include <fstream>

View File

@ -1,8 +1,8 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CHeroHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include <sstream>
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"
#include "CAbilityHandler.h"

View File

@ -5,7 +5,7 @@
#include <vector>
#include "CCreatureHandler.h"
#include "SDL.h"
#include "int3.h"
#include "../int3.h"
class CHeroClass;

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CLodHandler.h"
#include "SDL_Extensions.h"
#include "../SDL_Extensions.h"
#include <sstream>
#include <algorithm>
#include <cctype>

View File

@ -7,7 +7,7 @@
#include <string>
#include "zlib.h"
#include "CDefHandler.h"
#include "nodrze.h"
#include "../nodrze.h"
enum Epcxformat {PCX8B, PCX24B};

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CMusicHandler.h"
void CMusicHandler::initMusics()

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CObjectHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"
#include "CAmbarCendamo.h"

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CPreGameTextHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CLodHandler.h"
std::string CPreGameTextHandler::getTitle(std::string text)
{

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CSemiDefHandler.h"
#include <fstream>
extern SDL_Surface * ekran;

View File

@ -1,6 +1,6 @@
#ifndef SEMIDEF_H
#define SEMIDEF_H
#include "global.h"
#include "../global.h"
#include <string>
#include "SDL.h"
#include "SDL_image.h"

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CSemiLodHandler.h"
void CSemiLodHandler::openLod(std::string path)
{

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CSndHandler.h"

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CSpellHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CLodHandler.h"
void CSpellHandler::loadSpells()

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "../stdafx.h"
#include "CTownHandler.h"
#include "CGameInfo.h"
#include "../CGameInfo.h"
#include "CLodHandler.h"
#include <sstream>

View File

@ -3,7 +3,7 @@
#include "CDefHandler.h"
#include "CCreatureHandler.h"
#include "SDL.h"
#include "int3.h"
#include "../int3.h"
#include <string>
#include <vector>
class CTown

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "../stdafx.h"
#include <iostream>
#include "CVideoHandler.h"
#include "SDL.h"

4
map.h
View File

@ -4,8 +4,8 @@
#include <string>
#include <vector>
#include "global.h"
#include "CSemiDefHandler.h"
#include "CDefHandler.h"
#include "hch\CSemiDefHandler.h"
#include "hch\CDefHandler.h"
enum ESortBy{name,playerAm,size,format, viccon,loscon};
struct Sresource

View File

@ -1,12 +1,12 @@
#include "stdafx.h"
#include "mapHandler.h"
#include "CSemiDefHandler.h"
#include "hch\CSemiDefHandler.h"
#include "SDL_rotozoom.h"
#include "SDL_Extensions.h"
#include "CGameInfo.h"
#include "stdlib.h"
#include "CLodHandler.h"
#include "CDefObjInfoHandler.h"
#include "hch\CLodHandler.h"
#include "hch\CDefObjInfoHandler.h"
#include <algorithm>
extern SDL_Surface * ekran;

View File

@ -1,12 +1,12 @@
#ifndef MAPHANDLER_H
#define MAPHANDLER_H
#include "CAmbarCendamo.h"
#include "CSemiDefHandler.h"
#include "hch\CAmbarCendamo.h"
#include "hch\CSemiDefHandler.h"
#include "CGameInfo.h"
#include "CDefHandler.h"
#include "hch\CDefHandler.h"
#include <boost/logic/tribool.hpp>
#include "CObjectHandler.h"
#include "hch\CObjectHandler.h"
const int Woff = 4; //width of map's frame
const int Hoff = 4;