1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

* partially written hero moving

* improvements in include system
This commit is contained in:
mateuszb 2007-08-29 12:18:31 +00:00
parent 2030a6793f
commit 2d7dbbefc3
29 changed files with 104 additions and 45 deletions

View File

@ -2,6 +2,7 @@
#include "CAbilityHandler.h"
#include "CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"
void CAbilityHandler::loadAbilities()
{
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("SSTRAITS.TXT");

View File

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

View File

@ -9,6 +9,8 @@
#include "SDL_Extensions.h"
#include <boost/logic/tribool.hpp>
#include "global.h"
#include "CPathfinder.h"
#include "mapHandler.h"
class AdventureMapButton
: public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public CButtonBase

View File

@ -4,8 +4,10 @@
#include "CGameInfo.h"
#include "CObjectHandler.h"
#include "CCastleHandler.h"
#include "CDefObjInfoHandler.h"
#include "SDL_Extensions.h"
#include "boost\filesystem.hpp"
#include "CLodHandler.h"
#include <set>
#include <iomanip>
#include <sstream>

View File

@ -2,6 +2,7 @@
#include "CArtHandler.h"
#include "CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"
void CArtHandler::loadArtifacts()
{

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "CGameInfo.h"
#include "CBuildingHandler.h"
#include "CLodHandler.h"
void CBuildingHandler::loadBuildings()
{

View File

@ -1,8 +1,23 @@
#include "stdafx.h"
#include "CCallback.h"
#include "CPathfinder.h"
#include "CHeroHandler.h"
#include "CGameInfo.h"
#include "CAmbarCendamo.h"
#include "mapHandler.h"
bool CCallback::moveHero(int ID, int3 destPoint)
{
if(ID<0 || ID>CGI->heroh->heroInstances.size())
return false;
if(destPoint.x<0 || destPoint.x>CGI->ac->map.width)
return false;
if(destPoint.y<0 || destPoint.y>CGI->ac->map.height)
return false;
if(destPoint.z<0 || destPoint.z>CGI->mh->ttiles[0][0].size()-1)
return false;
CPath * ourPath = CGI->pathf->getPath(CGI->heroh->heroInstances[ID]->pos, destPoint, CGI->heroh->heroInstances[ID]);
if(!ourPath)
return false;
return false;
}
}

View File

@ -5,6 +5,8 @@
#include "SDL_thread.h"
#include "CGameInfo.h"
#include "global.h"
#include "CGameState.h"
#include "CCallback.h"
#include <sstream>
int internalFunc(void * nothingUsed)
@ -19,14 +21,29 @@ int internalFunc(void * nothingUsed)
readed.str(pom);
std::string cn; //command name
readed >> cn;
int3 src, dst;
int heronum;
int3 dest;
switch (*cn.c_str())
{
case 'P':
std::cout<<"Policzyc sciezke."<<std::endl;
int3 src, dst;
std::cout<<"Policzyc sciezke."<<std::endl;
readed>>src>>dst;
LOCPLINT->adventureInt->terrain.currentPath = CGI->pathf->getPath(src,dst,CGI->heroh->heroInstances[0]);
break;
case 'm': //number of heroes
std::cout<<"Number of heroes: "<<CGI->heroh->heroInstances.size()<<std::endl;
break;
case 'H': //position of hero
readed>>heronum;
std::cout<<"Position of hero "<<heronum<<": "<<CGI->heroh->heroInstances[heronum]->pos<<std::endl;
break;
case 'M': //move hero
readed>>heronum>>dest;
CGI->state->cb->moveHero(heronum, dest);
break;
}
//SDL_Delay(100);
}

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "CGameInfo.h"
#include "CCreatureHandler.h"
#include "CLodHandler.h"
void CCreatureHandler::loadCreatures()
{

View File

@ -4,6 +4,7 @@
#include "SDL_thread.h"
#include "CGameInfo.h"
#include "SDL_framerate.h"
#include "CLodHandler.h"
extern SDL_Surface * screen;
@ -194,7 +195,6 @@ void CCursorHandler::initCursor()
xpos = ypos = 0;
behindCur = SDL_CreateRGBSurface(SDL_SWSURFACE, 32, 32, 32, rmask, gmask, bmask, amask);
xbef = ybef = 0;
std::vector<Entry> pom = CGI->spriteh->entries.vectorize();
adventure = CGI->spriteh->giveDef("CRADVNTR.DEF");
combat = CGI->spriteh->giveDef("CRCOMBAT.DEF");
deflt = CGI->spriteh->giveDef("CRDEFLT.DEF");

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "CDefObjInfoHandler.h"
#include "CGameInfo.h"
#include "CLodHandler.h"
#include <sstream>
bool DefObjInfo::operator==(const std::string & por) const

View File

@ -1,38 +1,40 @@
#ifndef CGAMEINFO_H
#define CGAMEINFO_H
#include "CPreGame.h"
#include "StartInfo.h"
#include "CSpellHandler.h"
#include "CAbilityHandler.h"
#include "CCreaturehandler.h"
#include "CArtHandler.h"
#include "CHeroHandler.h"
#include "CAmbarCendamo.h"
#include "CBuildingHandler.h"
#include "CObjectHandler.h"
#include "CMusicHandler.h"
#include "CSemiLodHandler.h"
#include "CDefObjInfoHandler.h"
#include "CLodHandler.h"
#include "CTownHandler.h"
#include "CGeneralTextHandler.h"
#include "CGameInterface.h"
#include "CGameState.h"
#include "mapHandler.h"
#include "CConsoleHandler.h"
#include "CPathfinder.h"
#include "CCursorHandler.h"
#include "CScreenHandler.h"
#include "SDL.h"
#include <vector>
class CMapHandler;
class CArtHandler;
class CHeroHandler;
class CCreatureHandler;
class CAbilityHandler;
class CSpellHandler;
class CAmbarCendamo;
class CPreGameTextHandler;
class CBuildingHandler;
class CObjectHandler;
class CMusicHandler;
class CSemiLodHandler;
class CDefObjInfoHandler;
class CTownHandler;
class CLodHandler;
class CGeneralTextHandler;
class CConsoleHandler;
class CPathfinder;
class CCursorHandler;
class CScreenHandler;
class CGameState;
class CMapHandler;
class CGameInterface;
class CPreGame;
/*
CGameInfo class
for allowing different functions for modifying game informations
*/
class CMapHandler;
class CGameInfo
{
public:
@ -45,7 +47,7 @@ public:
CSpellHandler * spellh;
CMapHandler * mh;
CAmbarCendamo * ac;
CPreGameTextHandler * preth ;
CPreGameTextHandler * preth;
CBuildingHandler * buildh;
CObjectHandler * objh;
CMusicHandler * mush;

View File

@ -4,6 +4,8 @@
#include "CMessage.h"
#include "SDL_Extensions.h"
#include "SDL_framerate.h"
#include "CScreenHandler.h"
#include "CCursorHandler.h"
using namespace CSDL_Ext;
CButtonBase::CButtonBase()
{

View File

@ -1,28 +1,18 @@
#ifndef CGAMESTATE_H
#define CGAMESTATE_H
#include "CSpellHandler.h"
#include "CAbilityHandler.h"
#include "CCreaturehandler.h"
#include "CArtHandler.h"
#include "CHeroHandler.h"
#include "CAmbarCendamo.h"
#include "CBuildingHandler.h"
#include "CObjectHandler.h"
#include "CMusicHandler.h"
#include "CSemiLodHandler.h"
#include "CDefObjInfoHandler.h"
#include "CLodHandler.h"
#include "CTownHandler.h"
class CHeroInstance;
class CTownInstance;
class CCallback;
struct PlayerState
{
public:
int color;
std::vector<std::vector<std::vector<bool> > >fogOfWarMap;
std::vector<int> resources;
std::vector<CHeroInstance> heroes;
std::vector<CTownInstance> towns;
std::vector<CHeroInstance *> heroes;
std::vector<CTownInstance *> towns;
};
class CGameState

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "CGeneralTextHandler.h"
#include "CGameInfo.h"
#include "CLodHandler.h"
#include <fstream>
void CGeneralTextHandler::load()

View File

@ -4,6 +4,8 @@
#include <sstream>
#include "CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"
#include "CAbilityHandler.h"
CHeroHandler::~CHeroHandler()
{

View File

@ -40,6 +40,8 @@
#include "CConsoleHandler.h"
#include "CCursorHandler.h"
#include "CScreenHandler.h"
#include "CPathfinder.h"
#include "CGameState.h"
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
# include <fcntl.h>

View File

@ -5,6 +5,7 @@
#include "CDefHandler.h"
#include "CGameInfo.h"
#include "SDL_Extensions.h"
#include "CLodHandler.h"
SDL_Color tytulowy, tlo, zwykly ;
SDL_Rect genRect(int hh, int ww, int xx, int yy);

View File

@ -2,6 +2,8 @@
#include "CObjectHandler.h"
#include "CGameInfo.h"
#include "CGeneralTextHandler.h"
#include "CLodHandler.h"
#include "CAmbarCendamo.h"
void CObjectHandler::loadObjects()
{

View File

@ -2,6 +2,8 @@
#include "global.h"
#include "CPathfinder.h"
#include "CGameInfo.h"
#include "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 :()
{
if(src.z!=dest.z) //first check

Binary file not shown.

View File

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

View File

@ -4,7 +4,9 @@
#include "SDL_thread.h"
#include "SDL_framerate.h"
#include "SDL_Extensions.h"
#include "CCursorHandler.h"
#include "CGameInfo.h"
#include "CDefHandler.h"
extern SDL_Surface * screen, * screen2;

View File

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

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "CTownHandler.h"
#include "CGameInfo.h"
#include "CLodHandler.h"
#include <sstream>
CTownHandler::CTownHandler()

View File

@ -5,7 +5,7 @@
#include <iostream>
#include <utility>
#include <algorithm>
#include "CMessage.h"
bool isItIn(const SDL_Rect * rect, int x, int y)
{

4
int3.h
View File

@ -68,4 +68,8 @@ inline std::istream & operator>>(std::istream & str, int3 & dest)
str>>dest.x>>dest.y>>dest.z;
return str;
}
inline std::ostream & operator<<(std::ostream & str, int3 & sth)
{
return str<<sth.x<<' '<<sth.y<<' '<<sth.z;
}
#endif //INT3_H

View File

@ -5,6 +5,8 @@
#include "SDL_Extensions.h"
#include "CGameInfo.h"
#include "stdlib.h"
#include "CLodHandler.h"
#include "CDefObjInfoHandler.h"
#include <algorithm>
extern SDL_Surface * ekran;

View File

@ -6,6 +6,7 @@
#include "CGameInfo.h"
#include "CDefHandler.h"
#include <boost/logic/tribool.hpp>
#include "CObjectHandler.h"
const int Woff = 4; //width of map's frame
const int Hoff = 4;