1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* further changes towards support for ranged spells

* added info about author & license in files
This commit is contained in:
mateuszb 2009-04-15 14:03:31 +00:00
parent aa87e1ff16
commit f9ae91d88c
101 changed files with 1116 additions and 47 deletions

View File

@ -5,6 +5,16 @@
#include <iostream> #include <iostream>
#include "CGameInterface.h" #include "CGameInterface.h"
/*
* AI_Base.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#define AI_INTERFACE_VER 1 #define AI_INTERFACE_VER 1
#endif // __AI_BASE_H__ #endif // __AI_BASE_H__

View File

@ -9,6 +9,17 @@
#include "client/CConfigHandler.h" #include "client/CConfigHandler.h"
#include "client/Graphics.h" #include "client/Graphics.h"
#include "CBattleInterface.h" #include "CBattleInterface.h"
/*
* AdevntureMapButton.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
AdventureMapButton::AdventureMapButton () AdventureMapButton::AdventureMapButton ()
{ {
type=2; type=2;

View File

@ -7,6 +7,16 @@
#include "client/FunctionList.h" #include "client/FunctionList.h"
#include <boost/bind.hpp> #include <boost/bind.hpp>
/*
* AdventureMapButton.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
namespace config{struct ButtonInfo;} namespace config{struct ButtonInfo;}
class AdventureMapButton class AdventureMapButton

View File

@ -31,6 +31,16 @@
#pragma warning (disable : 4355) #pragma warning (disable : 4355)
#endif #endif
/*
* CAdvMapInterface.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts
#define ADVOPT (conf.go()->ac) #define ADVOPT (conf.go()->ac)

View File

@ -14,6 +14,17 @@ class CGHeroInstance;
class CGTownInstance; class CGTownInstance;
class CHeroWindow; class CHeroWindow;
/*****************************/ /*****************************/
/*
* CAdcmapInterface.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CMinimap class CMinimap
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested, public virtual CIntObject : public ClickableL, public ClickableR, public Hoverable, public MotionInterested, public virtual CIntObject
{ {

View File

@ -29,6 +29,16 @@ const double M_PI = 3.14159265358979323846;
#include <cmath> #include <cmath>
#endif #endif
/*
* CBattleInterface.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern SDL_Surface * screen; extern SDL_Surface * screen;
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM, *GEOR16; extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM, *GEOR16;
extern SDL_Color zwykly; extern SDL_Color zwykly;
@ -418,7 +428,34 @@ void CBattleInterface::show(SDL_Surface * to)
currentlyHoveredHex = b; currentlyHoveredHex = b;
} }
//print shade //print shade
if(settings.printMouseShadow) if(spellToCast) //when casting spell
{
//calculating spell schoold level
const CSpell & spToCast = CGI->spellh->spells[spellToCast->additionalInfo];
ui8 schoolLevel = 0;
if( LOCPLINT->cb->battleGetStackByID(activeStack)->attackerOwned )
{
if(attackingHeroInstance)
schoolLevel = attackingHeroInstance->getSpellSchoolLevel(&spToCast);
}
else
{
if(defendingHeroInstance)
schoolLevel = defendingHeroInstance->getSpellSchoolLevel(&spToCast);
}
//obtaining range and printing it
std::set<ui16> shaded = spToCast.rangeInHexes(b, schoolLevel);
for(std::set<ui16>::iterator it = shaded.begin(); it != shaded.end(); ++it) //for spells with range greater then one hex
{
if(settings.printMouseShadow && (*it % BFIELD_WIDTH != 0) && (*it % BFIELD_WIDTH != 16))
{
int x = 14 + ((*it/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(*it%BFIELD_WIDTH) + pos.x;
int y = 86 + 42 * (*it/BFIELD_WIDTH) + pos.y;
CSDL_Ext::blit8bppAlphaTo24bpp(cellShade, NULL, to, &genRect(cellShade->h, cellShade->w, x, y));
}
}
}
else if(settings.printMouseShadow) //when not casting spell
{ {
int x = 14 + ((b/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(b%BFIELD_WIDTH) + pos.x; int x = 14 + ((b/BFIELD_WIDTH)%2==0 ? 22 : 0) + 44*(b%BFIELD_WIDTH) + pos.x;
int y = 86 + 42 * (b/BFIELD_WIDTH) + pos.y; int y = 86 + 42 * (b/BFIELD_WIDTH) + pos.y;
@ -985,7 +1022,6 @@ void CBattleInterface::bAutofightf()
void CBattleInterface::bSpellf() void CBattleInterface::bSpellf()
{ {
CGI->curh->changeGraphic(0,0); CGI->curh->changeGraphic(0,0);
deactivate();
const CGHeroInstance * chi = NULL; const CGHeroInstance * chi = NULL;
if(attackingHeroInstance->tempOwner == LOCPLINT->playerID) if(attackingHeroInstance->tempOwner == LOCPLINT->playerID)
@ -993,8 +1029,7 @@ void CBattleInterface::bSpellf()
else else
chi = defendingHeroInstance; chi = defendingHeroInstance;
CSpellWindow * spellWindow = new CSpellWindow(genRect(595, 620, (conf.cc.resx - 620)/2, (conf.cc.resy - 595)/2), chi); CSpellWindow * spellWindow = new CSpellWindow(genRect(595, 620, (conf.cc.resx - 620)/2, (conf.cc.resy - 595)/2), chi);
spellWindow->activate(); LOCPLINT->pushInt(spellWindow);
LOCPLINT->objsToBlit.push_back(spellWindow);
} }
void CBattleInterface::bWaitf() void CBattleInterface::bWaitf()

View File

@ -5,6 +5,16 @@
#include "CPlayerInterface.h" #include "CPlayerInterface.h"
#include <list> #include <list>
/*
* CBattleInterface.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CCreatureSet; class CCreatureSet;
class CGHeroInstance; class CGHeroInstance;
class CDefHandler; class CDefHandler;

View File

@ -27,6 +27,16 @@
#endif #endif
extern CSharedCond<std::set<CPack*> > mess; extern CSharedCond<std::set<CPack*> > mess;
/*
* CCallback.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
int gcd(int x, int y) int gcd(int x, int y)
{ {
int temp; int temp;

View File

@ -11,6 +11,16 @@
#endif #endif
#include "CGameState.h" #include "CGameState.h"
/*
* CCallback.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CGHeroInstance; class CGHeroInstance;
class CGameState; class CGameState;
struct CPath; struct CPath;

View File

@ -26,6 +26,16 @@
using namespace boost::assign; using namespace boost::assign;
using namespace CSDL_Ext; using namespace CSDL_Ext;
/*
* CCastleInterface.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern TTF_Font * GEOR16; extern TTF_Font * GEOR16;
CBuildingRect::CBuildingRect(Structure *Str) CBuildingRect::CBuildingRect(Structure *Str)
:moi(false), offset(0), str(Str) :moi(false), offset(0), str(Str)

View File

@ -14,6 +14,17 @@ struct Structure;
class CSpell; class CSpell;
class AdventureMapButton; class AdventureMapButton;
class CResDataBar; class CResDataBar;
/*
* CCastleInterface.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CBuildingRect : public Hoverable, public MotionInterested, public ClickableL, public ClickableR//, public TimeInterested class CBuildingRect : public Hoverable, public MotionInterested, public ClickableL, public ClickableR//, public TimeInterested
{ {
public: public:

View File

@ -10,6 +10,16 @@ HANDLE handleOut;
#endif #endif
WORD defColor; WORD defColor;
/*
* CConsoleHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
void CConsoleHandler::setColor(int level) void CConsoleHandler::setColor(int level)
{ {
WORD color; WORD color;

View File

@ -11,6 +11,16 @@
#define _kill_thread(a,b) TerminateThread(a,b); #define _kill_thread(a,b) TerminateThread(a,b);
#endif #endif
/*
* CConsoleHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
namespace boost namespace boost
{ {
template<typename signature> template<typename signature>

View File

@ -5,6 +5,16 @@
#include "CGameInfo.h" #include "CGameInfo.h"
#include "hch/CDefHandler.h" #include "hch/CDefHandler.h"
/*
* CCursorHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern SDL_Surface * screen; extern SDL_Surface * screen;
void CCursorHandler::initCursor() void CCursorHandler::initCursor()

View File

@ -6,6 +6,16 @@ struct SDL_Thread;
class CDefHandler; class CDefHandler;
struct SDL_Surface; struct SDL_Surface;
/*
* CCursorhandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CCursorHandler //handles cursor class CCursorHandler //handles cursor
{ {
public: public:

View File

@ -2,6 +2,16 @@
#include "CGameInfo.h" #include "CGameInfo.h"
#include "lib/VCMI_Lib.h" #include "lib/VCMI_Lib.h"
/*
* CGameInfo.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CGameInfo * CGI; CGameInfo * CGI;
CGameInfo::CGameInfo() CGameInfo::CGameInfo()

View File

@ -2,13 +2,19 @@
#define __CGAMEINFO_H__ #define __CGAMEINFO_H__
#include "global.h" #include "global.h"
#include <vector> #include <vector>
/*
* CGameInfo.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CMapHandler; class CMapHandler;
class CArtHandler; class CArtHandler;
class CHeroHandler; class CHeroHandler;

View File

@ -7,6 +7,16 @@
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
/*
* CGameInterface.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname) CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
{ {
char temp[50]; char temp[50];

View File

@ -6,6 +6,16 @@
#include "lib/BattleAction.h" #include "lib/BattleAction.h"
#include "client/FunctionList.h" #include "client/FunctionList.h"
/*
* CGameInterface.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
using namespace boost::logic; using namespace boost::logic;
class CCallback; class CCallback;
class ICallback; class ICallback;

View File

@ -25,7 +25,6 @@
#include "lib/RegisterTypes.cpp" #include "lib/RegisterTypes.cpp"
boost::rand48 ran; boost::rand48 ran;
#ifdef min #ifdef min
#undef min #undef min
#endif #endif
@ -33,6 +32,16 @@ boost::rand48 ran;
#undef max #undef max
#endif #endif
/*
* CGameState.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
void foofoofoo() void foofoofoo()
{ {
//never called function to force instantation of templates //never called function to force instantation of templates

View File

@ -14,6 +14,16 @@
#include "tchar_amigaos4.h" #include "tchar_amigaos4.h"
#endif #endif
/*
* CGameState.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CTown; class CTown;
class CScriptCallback; class CScriptCallback;
class CCallback; class CCallback;

View File

@ -25,6 +25,16 @@
#include <cstdlib> #include <cstdlib>
#include <sstream> #include <sstream>
/*
* CHeroWindow.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern SDL_Surface * screen; extern SDL_Surface * screen;
extern TTF_Font * GEOR16; extern TTF_Font * GEOR16;
using namespace boost::assign; using namespace boost::assign;

View File

@ -4,6 +4,16 @@
#include "CPlayerInterface.h" #include "CPlayerInterface.h"
/*
* CHeroWindow.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class AdventureMapButton; class AdventureMapButton;
struct SDL_Surface; struct SDL_Surface;
class CGHeroInstance; class CGHeroInstance;

11
CMT.cpp
View File

@ -45,6 +45,17 @@
#if __MINGW32__ #if __MINGW32__
#undef main #undef main
#endif #endif
/*
* CMT.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
std::string NAME = NAME_VER + std::string(" (client)"); //application name std::string NAME = NAME_VER + std::string(" (client)"); //application name
SDL_Surface *screen = NULL, *screen2 = NULL; //main screen surface and hlp surface (used to store not-active interfaces layer) SDL_Surface *screen = NULL, *screen2 = NULL; //main screen surface and hlp surface (used to store not-active interfaces layer)

View File

@ -15,6 +15,17 @@
#include "hch/CGeneralTextHandler.h" #include "hch/CGeneralTextHandler.h"
#include "client/Graphics.h" #include "client/Graphics.h"
#include "CAdvmapInterface.h" #include "CAdvmapInterface.h"
/*
* CMessage.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
SDL_Color tytulowy, tlo, zwykly ; SDL_Color tytulowy, tlo, zwykly ;
extern SDL_Surface * screen; extern SDL_Surface * screen;

View File

@ -6,6 +6,16 @@
#include <SDL.h> #include <SDL.h>
#include "CPreGame.h" #include "CPreGame.h"
/*
* CMessage.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
enum EWindowType {infoOnly, infoOK, yesOrNO}; enum EWindowType {infoOnly, infoOK, yesOrNO};
class CPreGame; class CPreGame;
class MapSel; class MapSel;

View File

@ -45,6 +45,17 @@
#ifdef max #ifdef max
#undef max #undef max
#endif #endif
/*
* CPlayerInterface.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
using namespace boost::assign; using namespace boost::assign;
using namespace CSDL_Ext; using namespace CSDL_Ext;

View File

@ -18,6 +18,16 @@
#undef min #undef min
#endif #endif
/*
* CPlayerInterface.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CDefEssential; class CDefEssential;
class AdventureMapButton; class AdventureMapButton;
class CHighlightableButtonsGroup; class CHighlightableButtonsGroup;

View File

@ -23,6 +23,16 @@
#include <cstdlib> #include <cstdlib>
#include "lib/Connection.h" #include "lib/Connection.h"
/*
* CPreGame.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern SDL_Surface * screen; extern SDL_Surface * screen;
extern SDL_Color tytulowy, tlo, zwykly ; extern SDL_Color tytulowy, tlo, zwykly ;
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM; extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;

View File

@ -11,6 +11,16 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <cstdlib> #include <cstdlib>
/*
* CPreGame.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CPreGame; class CPreGame;
class CDefHandler; class CDefHandler;
extern CPreGame * CPG; extern CPreGame * CPG;

View File

@ -1,6 +1,17 @@
#include "CThreadHelper.h" #include "CThreadHelper.h"
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
/*
* CThreadHelper.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CThreadHelper::CThreadHelper(std::vector<boost::function<void()> > *Tasks, int Threads) CThreadHelper::CThreadHelper(std::vector<boost::function<void()> > *Tasks, int Threads)
{ {
currentTask = 0; amount = Tasks->size(); currentTask = 0; amount = Tasks->size();

View File

@ -4,6 +4,18 @@
#include "global.h" #include "global.h"
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
/*
* CThreadHelper.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
typedef boost::function<void()> Task; typedef boost::function<void()> Task;
class CThreadHelper class CThreadHelper

View File

@ -11,6 +11,16 @@
#include <map> #include <map>
#include "client/Graphics.h" #include "client/Graphics.h"
/*
* SDL_Extensions.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
SDL_Surface * CSDL_Ext::newSurface(int w, int h, SDL_Surface * mod) //creates new surface, with flags/format same as in surface given SDL_Surface * CSDL_Ext::newSurface(int w, int h, SDL_Surface * mod) //creates new surface, with flags/format same as in surface given
{ {
return SDL_CreateRGBSurface(mod->flags,w,h,mod->format->BitsPerPixel,mod->format->Rmask,mod->format->Gmask,mod->format->Bmask,mod->format->Amask); return SDL_CreateRGBSurface(mod->flags,w,h,mod->format->BitsPerPixel,mod->format->Rmask,mod->format->Gmask,mod->format->Bmask,mod->format->Amask);

View File

@ -3,6 +3,16 @@
#include "SDL.h" #include "SDL.h"
#include "SDL_ttf.h" #include "SDL_ttf.h"
/*
* SDL_Extensions.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern SDL_Surface * screen, *screen2; extern SDL_Surface * screen, *screen2;
extern SDL_Color tytulowy, tlo, zwykly ; extern SDL_Color tytulowy, tlo, zwykly ;
extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM; extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;

View File

@ -4,6 +4,16 @@
#include "global.h" #include "global.h"
#include <vector> #include <vector>
/*
* StartInfo.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
enum Ebonus {brandom=-1,bartifact, bgold, bresource}; enum Ebonus {brandom=-1,bartifact, bgold, bresource};
struct PlayerSettings struct PlayerSettings

View File

@ -6,6 +6,17 @@
#include "../hch/CLodHandler.h" #include "../hch/CLodHandler.h"
#include <sstream> #include <sstream>
#include <boost/thread.hpp> #include <boost/thread.hpp>
/*
* CBitmapHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
boost::mutex bitmap_handler_mx; boost::mutex bitmap_handler_mx;
int readNormalNr (int pos, int bytCon, unsigned char * str); int readNormalNr (int pos, int bytCon, unsigned char * str);
CLodHandler * BitmapHandler::bitmaph = NULL; CLodHandler * BitmapHandler::bitmaph = NULL;

View File

@ -7,6 +7,16 @@
struct SDL_Surface; struct SDL_Surface;
class CLodHandler; class CLodHandler;
/*
* CBitmapHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
enum Epcxformat {PCX8B, PCX24B}; enum Epcxformat {PCX8B, PCX24B};
struct BMPPalette struct BMPPalette

View File

@ -8,6 +8,16 @@ using namespace config;
using namespace boost::spirit; using namespace boost::spirit;
using namespace phoenix; using namespace phoenix;
/*
* CConfigHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CConfigHandler conf; CConfigHandler conf;
GUIOptions *current = NULL; GUIOptions *current = NULL;
std::pair<int,int> curRes; std::pair<int,int> curRes;

View File

@ -2,6 +2,17 @@
#define __CCONFIGHANDLER_H__ #define __CCONFIGHANDLER_H__
#include "../global.h" #include "../global.h"
class CAdvMapInt; class CAdvMapInt;
/*
* CConfighandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
namespace config namespace config
{ {
struct ClientConfig struct ClientConfig

View File

@ -1,5 +1,16 @@
#include "CCreatureAnimation.h" #include "CCreatureAnimation.h"
#include "../hch/CLodHandler.h" #include "../hch/CLodHandler.h"
/*
* CCreatureAnimation.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
int CCreatureAnimation::getType() const int CCreatureAnimation::getType() const
{ {
return type; return type;

View File

@ -6,6 +6,16 @@
#include "../CPlayerInterface.h" #include "../CPlayerInterface.h"
#include "../hch/CDefHandler.h" #include "../hch/CDefHandler.h"
/*
* CCreatureAnimation.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CCreatureAnimation : public CIntObject class CCreatureAnimation : public CIntObject
{ {
private: private:

View File

@ -12,6 +12,16 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <sstream> #include <sstream>
/*
* CSpellWindow.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern SDL_Surface * screen; extern SDL_Surface * screen;
extern SDL_Color tytulowy, zwykly ; extern SDL_Color tytulowy, zwykly ;
extern TTF_Font *GEOR16; extern TTF_Font *GEOR16;

View File

@ -5,6 +5,16 @@
#include "../global.h" #include "../global.h"
#include "../CPlayerInterface.h" #include "../CPlayerInterface.h"
/*
* CSpellWindow.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct SDL_Surface; struct SDL_Surface;
class CDefHandler; class CDefHandler;
struct SDL_Rect; struct SDL_Rect;

View File

@ -32,6 +32,16 @@
extern std::string NAME; extern std::string NAME;
namespace intpr = boost::interprocess; namespace intpr = boost::interprocess;
/*
* Client.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CBaseForCLApply class CBaseForCLApply
{ {
public: public:

View File

@ -6,6 +6,16 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include "../lib/IGameCallback.h" #include "../lib/IGameCallback.h"
/*
* Client.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct StartInfo; struct StartInfo;
class CGameState; class CGameState;
class CGameInterface; class CGameInterface;

View File

@ -1,12 +1,18 @@
#ifndef FUNCTIONLIST_H #ifndef FUNCTIONLIST_H
#define FUNCTIONLIST_H #define FUNCTIONLIST_H
#ifdef _MSC_VER
#pragma once
#endif
#include <boost/function.hpp> #include <boost/function.hpp>
/*
* FunctionList.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
template<typename Signature> template<typename Signature>
class CFunctionList class CFunctionList
{ {

View File

@ -21,7 +21,19 @@ using namespace CSDL_Ext;
#ifdef max #ifdef max
#undef max #undef max
#endif #endif
/*
* Graphics.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
Graphics * graphics = NULL; Graphics * graphics = NULL;
SDL_Surface * Graphics::drawPrimarySkill(const CGHeroInstance *curh, SDL_Surface *ret, int from, int to) SDL_Surface * Graphics::drawPrimarySkill(const CGHeroInstance *curh, SDL_Surface *ret, int from, int to)
{ {
char buf[10]; char buf[10];

View File

@ -4,6 +4,15 @@
#include "../global.h" #include "../global.h"
/*
* Graphics.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CDefEssential; class CDefEssential;
struct SDL_Surface; struct SDL_Surface;

View File

@ -22,6 +22,15 @@
if(vstd::contains(cl->playerint,player)) \ if(vstd::contains(cl->playerint,player)) \
cl->playerint[player]->function(__VA_ARGS__); cl->playerint[player]->function(__VA_ARGS__);
/*
* NetPacksClient.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CSharedCond<std::set<CPack*> > mess(new std::set<CPack*>); CSharedCond<std::set<CPack*> > mess(new std::set<CPack*>);

View File

@ -33,6 +33,16 @@ typedef boost::int8_t si8; //signed int 8 bits (1 byte)
#define SERVER_NAME "./vcmiserver" #define SERVER_NAME "./vcmiserver"
#endif #endif
/*
* global.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
enum Ecolor {RED, BLUE, TAN, GREEN, ORANGE, PURPLE, TEAL, PINK}; //player's colors enum Ecolor {RED, BLUE, TAN, GREEN, ORANGE, PURPLE, TEAL, PINK}; //player's colors
enum EterrainType {border=-1, dirt, sand, grass, snow, swamp, rough, subterranean, lava, water, rock}; enum EterrainType {border=-1, dirt, sand, grass, snow, swamp, rough, subterranean, lava, water, rock};
enum Eriver {noRiver=0, clearRiver, icyRiver, muddyRiver, lavaRiver}; enum Eriver {noRiver=0, clearRiver, icyRiver, muddyRiver, lavaRiver};

View File

@ -9,6 +9,16 @@
extern CLodHandler *bitmaph; extern CLodHandler *bitmaph;
using namespace boost::assign; using namespace boost::assign;
/*
* CArtHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
const std::string & CArtifact::Name() const const std::string & CArtifact::Name() const
{ {
if(name.size()) if(name.size())

View File

@ -6,6 +6,16 @@
#include <string> #include <string>
#include <vector> #include <vector>
/*
* CArtHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
enum EartClass {SartClass=0, TartClass, NartClass, JartClass, RartClass}; //artifact class (relict, treasure, strong, weak etc.) enum EartClass {SartClass=0, TartClass, NartClass, JartClass, RartClass}; //artifact class (relict, treasure, strong, weak etc.)
class CDefHandler; class CDefHandler;

View File

@ -7,6 +7,17 @@
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
extern CLodHandler * bitmaph; extern CLodHandler * bitmaph;
/*
* CBuildingHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
unsigned int readNr(std::string &in, int &it) unsigned int readNr(std::string &in, int &it)
{ {
int last=it; int last=it;

View File

@ -3,6 +3,17 @@
#include "../global.h" #include "../global.h"
#include <map> #include <map>
#include <vector> #include <vector>
/*
* CBuildingHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
//enum EbuildingType {NEUTRAL=-1, CASTLE, RAMPART, TOWER, INFERNO, NECROPOLIS, DUNGEON, STRONGHOLD, FORTRESS, CONFLUX}; //enum EbuildingType {NEUTRAL=-1, CASTLE, RAMPART, TOWER, INFERNO, NECROPOLIS, DUNGEON, STRONGHOLD, FORTRESS, CONFLUX};
class DLL_EXPORT CBuilding //a typical building encountered in every castle ;] class DLL_EXPORT CBuilding //a typical building encountered in every castle ;]
{ {

View File

@ -9,8 +9,20 @@
#include <boost/algorithm/string/find.hpp> #include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include "../lib/VCMI_Lib.h" #include "../lib/VCMI_Lib.h"
using namespace boost::assign; using namespace boost::assign;
extern CLodHandler * bitmaph; extern CLodHandler * bitmaph;
/*
* CCreatureHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CCreatureHandler::CCreatureHandler() CCreatureHandler::CCreatureHandler()
{ {
VLC->creh = this; VLC->creh = this;

View File

@ -6,6 +6,16 @@
#include <map> #include <map>
#include <set> #include <set>
/*
* CCreatureHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CLodHandler; class CLodHandler;
class DLL_EXPORT CCreature class DLL_EXPORT CCreature

View File

@ -3,7 +3,19 @@
#include "CDefHandler.h" #include "CDefHandler.h"
#include <sstream> #include <sstream>
#include "CLodHandler.h" #include "CLodHandler.h"
/*
* CDefHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CLodHandler* CDefHandler::Spriteh = NULL; CLodHandler* CDefHandler::Spriteh = NULL;
long long pow(long long a, int b) long long pow(long long a, int b)
{ {
if (!b) return 1; if (!b) return 1;

View File

@ -5,6 +5,16 @@ struct SDL_Surface;
class CDefEssential; class CDefEssential;
class CLodHandler; class CLodHandler;
/*
* CDefHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct Cimage struct Cimage
{ {
int groupNumber; int groupNumber;

View File

@ -6,7 +6,19 @@
#include <sstream> #include <sstream>
#include "../lib/VCMI_Lib.h" #include "../lib/VCMI_Lib.h"
#include <set> #include <set>
extern CLodHandler * bitmaph; extern CLodHandler * bitmaph;
/*
* CDefObjInfoHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
bool CGDefInfo::isVisitable() bool CGDefInfo::isVisitable()
{ {
for (int i=0; i<6; i++) for (int i=0; i<6; i++)

View File

@ -3,6 +3,17 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include "../global.h" #include "../global.h"
/*
* CDefObjInfoHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CDefHandler; class CDefHandler;
class CLodHandler; class CLodHandler;
class DLL_EXPORT CGDefInfo class DLL_EXPORT CGDefInfo

View File

@ -8,6 +8,16 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
/*
* CGeneralTextHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
std::string readTo(std::string &in, int &it, char end) std::string readTo(std::string &in, int &it, char end)
{ {
int pom = it; int pom = it;

View File

@ -3,6 +3,17 @@
#include "../global.h" #include "../global.h"
#include <string> #include <string>
#include <vector> #include <vector>
/*
* CGeneralTextHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode); DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
std::string readTo(std::string &in, int &it, char end); std::string readTo(std::string &in, int &it, char end);
class DLL_EXPORT CGeneralTextHandler //Handles general texts class DLL_EXPORT CGeneralTextHandler //Handles general texts

View File

@ -7,6 +7,16 @@
extern CLodHandler * bitmaph; extern CLodHandler * bitmaph;
void loadToIt(std::string &dest, std::string &src, int &iter, int mode); void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
/*
* CHeroHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CHeroClass::CHeroClass() CHeroClass::CHeroClass()
{ {
skillLimit = 8; skillLimit = 8;

View File

@ -4,6 +4,17 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <set> #include <set>
/*
* CHeroHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CHeroClass; class CHeroClass;
class CDefHandler; class CDefHandler;
class CGameInfo; class CGameInfo;

View File

@ -13,6 +13,17 @@
#ifdef max #ifdef max
#undef max #undef max
#endif #endif
/*
* CLodHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
DLL_EXPORT int readNormalNr (int pos, int bytCon, unsigned char * str) DLL_EXPORT int readNormalNr (int pos, int bytCon, unsigned char * str)
{ {
int ret=0; int ret=0;

View File

@ -6,6 +6,16 @@
#include <string> #include <string>
#include "../nodrze.h" #include "../nodrze.h"
/*
* CLodhandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct SDL_Surface; struct SDL_Surface;
class CDefHandler; class CDefHandler;
class CDefEssential; class CDefEssential;

View File

@ -1,6 +1,16 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "CMusicHandler.h" #include "CMusicHandler.h"
/*
* CMusicHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
void CMusicHandler::initMusics() void CMusicHandler::initMusics()
{ {
if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096)==-1) if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096)==-1)

View File

@ -4,6 +4,16 @@
#include <SDL_mixer.h> #include <SDL_mixer.h>
#include "CSndHandler.h" #include "CSndHandler.h"
/*
* CMusicHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CMusicHandler class CMusicHandler
{ {
protected: protected:

View File

@ -20,6 +20,16 @@
#include "../StartInfo.h" #include "../StartInfo.h"
#include "../map.h" #include "../map.h"
/*
* CObjectHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
std::map<int,std::map<int, std::vector<int> > > CGTeleport::objs; std::map<int,std::map<int, std::vector<int> > > CGTeleport::objs;
IGameCallback * IObjectInterface::cb = NULL; IGameCallback * IObjectInterface::cb = NULL;
DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode); DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
@ -771,6 +781,23 @@ int CGHeroInstance::getTotalStrength() const
return getHeroStrength() * getArmyStrength(); return getHeroStrength() * getArmyStrength();
} }
ui8 CGHeroInstance::getSpellSchoolLevel(const CSpell * spell) const
{
//TODO: skill level may be different on special terrain
ui8 skill = 0; //skill level
if(spell->fire)
skill = std::max(skill,getSecSkillLevel(14));
if(spell->air)
skill = std::max(skill,getSecSkillLevel(15));
if(spell->water)
skill = std::max(skill,getSecSkillLevel(16));
if(spell->earth)
skill = std::max(skill,getSecSkillLevel(17));
return skill;
}
int3 CGHeroInstance::getSightCenter() const int3 CGHeroInstance::getSightCenter() const
{ {
return getPosition(false); return getPosition(false);

View File

@ -14,6 +14,16 @@
#include "../lib/VCMI_Lib.h" #include "../lib/VCMI_Lib.h"
#endif #endif
/*
* CObjectHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
using boost::logic::tribool; using boost::logic::tribool;
class IGameCallback; class IGameCallback;
struct BattleResult; struct BattleResult;
@ -252,6 +262,7 @@ public:
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
double getHeroStrength() const; double getHeroStrength() const;
int getTotalStrength() const; int getTotalStrength() const;
ui8 getSpellSchoolLevel(const CSpell * spell) const; //returns level on which given spell would be casted by this hero
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View File

@ -1,6 +1,15 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "CSndHandler.h" #include "CSndHandler.h"
/*
* CSndHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CSndHandler::~CSndHandler() CSndHandler::~CSndHandler()
{ {

View File

@ -4,6 +4,17 @@
#include <vector> #include <vector>
#include <fstream> #include <fstream>
#include <map> #include <map>
/*
* CSndHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct MemberFile struct MemberFile
{ {
std::ifstream * ifs; std::ifstream * ifs;

View File

@ -9,6 +9,16 @@
extern CLodHandler *bitmaph; extern CLodHandler *bitmaph;
/*
* CSpellHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
namespace SRSLPraserHelpers namespace SRSLPraserHelpers
{ {
int XYToHex(int x, int y) int XYToHex(int x, int y)

View File

@ -5,7 +5,17 @@
#include <vector> #include <vector>
#include <set> #include <set>
class CSpell /*
* CSpellHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class DLL_EXPORT CSpell
{ {
public: public:
ui32 id; ui32 id;

View File

@ -5,8 +5,20 @@
#include <sstream> #include <sstream>
#include "../lib/VCMI_Lib.h" #include "../lib/VCMI_Lib.h"
#include "CGeneralTextHandler.h" #include "CGeneralTextHandler.h"
extern CLodHandler * bitmaph; extern CLodHandler * bitmaph;
void loadToIt(std::string &dest, std::string &src, int &iter, int mode); void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
/*
* CTownHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CTownHandler::CTownHandler() CTownHandler::CTownHandler()
{ {
VLC->townh = this; VLC->townh = this;

View File

@ -2,6 +2,17 @@
#define __CTOWNHANDLER_H__ #define __CTOWNHANDLER_H__
#include "../global.h" #include "../global.h"
#include <set> #include <set>
/*
* CTownHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CBuilding; class CBuilding;
class CSpell; class CSpell;
class CHero; class CHero;

9
int3.h
View File

@ -4,6 +4,15 @@
#include <vector> #include <vector>
#include <cmath> #include <cmath>
/*
* int3.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CCreature; class CCreature;
class CCreatureSet //seven combined creatures class CCreatureSet //seven combined creatures

View File

@ -1,5 +1,16 @@
#ifndef __BATTLEACTION_H__ #ifndef __BATTLEACTION_H__
#define __BATTLEACTION_H__ #define __BATTLEACTION_H__
/*
* BattleAction.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct BattleAction struct BattleAction
{ {
ui8 side; //who made this action: false - left, true - right player ui8 side; //who made this action: false - left, true - right player

View File

@ -1,6 +1,17 @@
#ifndef __CONDSH_H__ #ifndef __CONDSH_H__
#define __CONDSH_H__ #define __CONDSH_H__
#include <boost/thread.hpp> #include <boost/thread.hpp>
/*
* CondSh.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
template <typename T> struct CondSh template <typename T> struct CondSh
{ {
T data; T data;

View File

@ -8,6 +8,16 @@
#include "../lib/RegisterTypes.cpp" #include "../lib/RegisterTypes.cpp"
#endif #endif
/*
* Connection.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
using namespace boost; using namespace boost;
using namespace boost::asio::ip; using namespace boost::asio::ip;
template<typename Serializer> DLL_EXPORT void registerTypes(Serializer &s); //defined elsewhere and explicitly instantiated for used serializers template<typename Serializer> DLL_EXPORT void registerTypes(Serializer &s); //defined elsewhere and explicitly instantiated for used serializers

View File

@ -23,6 +23,16 @@ const ui32 version = 704;
class CConnection; class CConnection;
namespace mpl = boost::mpl; namespace mpl = boost::mpl;
/*
* Connection.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
namespace boost namespace boost
{ {
namespace asio namespace asio

View File

@ -2,6 +2,16 @@
#include "../global.h" #include "../global.h"
#include <string> #include <string>
/*
* HeroBonus.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct DLL_EXPORT HeroBonus struct DLL_EXPORT HeroBonus
{ {
enum BonusType enum BonusType

View File

@ -5,6 +5,16 @@
#include "../hch/CObjectHandler.h" #include "../hch/CObjectHandler.h"
#include "../StartInfo.h" #include "../StartInfo.h"
/*
* IGameCallback.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
const CGObjectInstance* IGameCallback::getObj(int objid) const CGObjectInstance* IGameCallback::getObj(int objid)
{ {
if(objid < 0 || objid >= gs->map->objects.size()) if(objid < 0 || objid >= gs->map->objects.size())

View File

@ -6,6 +6,16 @@
#include <set> #include <set>
#include "../client/FunctionList.h" #include "../client/FunctionList.h"
/*
* IGameCallback.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct SetMovePoints; struct SetMovePoints;
struct GiveBonus; struct GiveBonus;
class CGObjectInstance; class CGObjectInstance;

View File

@ -3,6 +3,16 @@
#include <boost/interprocess/mapped_region.hpp> #include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/shared_memory_object.hpp> #include <boost/interprocess/shared_memory_object.hpp>
/*
* Interprocess.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct ServerReady struct ServerReady
{ {
bool ready; bool ready;

View File

@ -6,6 +6,16 @@
#include "HeroBonus.h" #include "HeroBonus.h"
#include <set> #include <set>
/*
* NetPacks.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CClient; class CClient;
class CGameState; class CGameState;
class CGameHandler; class CGameHandler;

View File

@ -13,6 +13,16 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/thread/shared_mutex.hpp> #include <boost/thread/shared_mutex.hpp>
/*
* NetPacksLib.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
DLL_EXPORT void SetResource::applyGs( CGameState *gs ) DLL_EXPORT void SetResource::applyGs( CGameState *gs )
{ {
gs->getPlayer(player)->resources[resid] = val; gs->getPlayer(player)->resources[resid] = val;

View File

@ -7,6 +7,15 @@
#include "../hch/CTownHandler.h" #include "../hch/CTownHandler.h"
#include "RegisterTypes.h" #include "RegisterTypes.h"
/*
* RegisterTypes.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
template<typename Serializer> DLL_EXPORT template<typename Serializer> DLL_EXPORT
void registerTypes1(Serializer &s) void registerTypes1(Serializer &s)

View File

@ -15,4 +15,14 @@ void registerTypes3(Serializer &s);
//register all //register all
template<typename Serializer> DLL_EXPORT template<typename Serializer> DLL_EXPORT
void registerTypes(Serializer &s); void registerTypes(Serializer &s);
/*
* RegisterTypes.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/

View File

@ -10,6 +10,17 @@
#include "../hch/CBuildingHandler.h" #include "../hch/CBuildingHandler.h"
#include "../hch/CSpellHandler.h" #include "../hch/CSpellHandler.h"
#include "../hch/CGeneralTextHandler.h" #include "../hch/CGeneralTextHandler.h"
/*
* VCMI_Lib.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CLodHandler; class CLodHandler;
LibClasses * VLC = NULL; LibClasses * VLC = NULL;
CLodHandler * bitmaph=NULL; CLodHandler * bitmaph=NULL;

View File

@ -6,6 +6,16 @@
#include "../hch/CGeneralTextHandler.h" #include "../hch/CGeneralTextHandler.h"
#endif #endif
/*
* VCMI_Lib.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CLodHandler; class CLodHandler;
class CArtHandler; class CArtHandler;
class CHeroHandler; class CHeroHandler;

11
map.cpp
View File

@ -6,6 +6,17 @@
#include "lib/VCMI_Lib.h" #include "lib/VCMI_Lib.h"
#include <zlib.h> #include <zlib.h>
#include <boost/crc.hpp> #include <boost/crc.hpp>
/*
* map.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID) std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID)
{ {
std::map<int,int> mapa; std::map<int,int> mapa;

11
map.h
View File

@ -13,6 +13,17 @@
#include "hch/CObjectHandler.h" #include "hch/CObjectHandler.h"
#include "hch/CDefObjInfoHandler.h" #include "hch/CDefObjInfoHandler.h"
#endif #endif
/*
* map.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CGDefInfo; class CGDefInfo;
class CGObjectInstance; class CGObjectInstance;
class CGHeroInstance; class CGHeroInstance;

View File

@ -15,7 +15,19 @@
#include "hch/CObjectHandler.h" #include "hch/CObjectHandler.h"
#include "map.h" #include "map.h"
#include "hch/CDefHandler.h" #include "hch/CDefHandler.h"
/*
* mapHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
extern SDL_Surface * screen; extern SDL_Surface * screen;
std::string nameFromType (int typ) std::string nameFromType (int typ)
{ {
switch((EterrainType)typ) switch((EterrainType)typ)

View File

@ -3,9 +3,20 @@
#include "global.h" #include "global.h"
#include <list> #include <list>
#include <set> #include <set>
const int Woff = 13; //width of map's frame const int Woff = 13; //width of map's frame
const int Hoff = 10; const int Hoff = 10;
/*
* mapHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CGObjectInstance; class CGObjectInstance;
class CGHeroInstance; class CGHeroInstance;
struct Mapa; struct Mapa;

View File

@ -21,6 +21,16 @@
#include <boost/thread/shared_mutex.hpp> #include <boost/thread/shared_mutex.hpp>
#include <fstream> #include <fstream>
/*
* CGameHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#undef DLL_EXPORT #undef DLL_EXPORT
#define DLL_EXPORT #define DLL_EXPORT
#include "../lib/RegisterTypes.cpp" #include "../lib/RegisterTypes.cpp"
@ -88,19 +98,6 @@ double distance(int3 a, int3 b)
{ {
return std::sqrt( (double)(a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); return std::sqrt( (double)(a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) );
} }
int getSchoolLevel(const CGHeroInstance *h, const CSpell *s)
{
ui8 ret = 0;
if(s->fire)
ret = std::max(ret,h->getSecSkillLevel(14));
if(s->air)
ret = std::max(ret,h->getSecSkillLevel(15));
if(s->water)
ret = std::max(ret,h->getSecSkillLevel(16));
if(s->earth)
ret = std::max(ret,h->getSecSkillLevel(17));
return ret;
}
void giveExp(BattleResult &r) void giveExp(BattleResult &r)
{ {
r.exp[0] = 0; r.exp[0] = 0;
@ -2204,18 +2201,7 @@ void CGameHandler::makeCustomAction( BattleAction &ba )
} }
CSpell *s = &VLC->spellh->spells[ba.additionalInfo]; CSpell *s = &VLC->spellh->spells[ba.additionalInfo];
ui8 skill = 0; //skill level ui8 skill = h->getSpellSchoolLevel(s); //skill level
if(s->fire)
skill = std::max(skill,h->getSecSkillLevel(14));
if(s->air)
skill = std::max(skill,h->getSecSkillLevel(15));
if(s->water)
skill = std::max(skill,h->getSecSkillLevel(16));
if(s->earth)
skill = std::max(skill,h->getSecSkillLevel(17));
//TODO: skill level may be different on special terrain
if( !(vstd::contains(h->spells,ba.additionalInfo)) //hero doesn't know this spell if( !(vstd::contains(h->spells,ba.additionalInfo)) //hero doesn't know this spell
|| (h->mana < s->costs[skill]) //not enough mana || (h->mana < s->costs[skill]) //not enough mana
@ -2232,11 +2218,11 @@ void CGameHandler::makeCustomAction( BattleAction &ba )
//TODO: check resistances //TODO: check resistances
#define SPELL_CAST_TEMPLATE_1(NUMBER, DURATION) SetStackEffect sse; \ #define SPELL_CAST_TEMPLATE_1(NUMBER, DURATION) SetStackEffect sse; \
if(getSchoolLevel(h,s) < 3) /*not expert */ \ if(h->getSpellSchoolLevel(s) < 3) /*not expert */ \
{ \ { \
sse.stacks.insert(gs->curB->getStackT(ba.destinationTile)->ID); \ sse.stacks.insert(gs->curB->getStackT(ba.destinationTile)->ID); \
sse.effect.id = (NUMBER); \ sse.effect.id = (NUMBER); \
sse.effect.level = getSchoolLevel(h,s); \ sse.effect.level = h->getSpellSchoolLevel(s); \
sse.effect.turnsRemain = (DURATION); /*! - any duration */ \ sse.effect.turnsRemain = (DURATION); /*! - any duration */ \
sendAndApply(&sse); \ sendAndApply(&sse); \
} \ } \
@ -2253,7 +2239,7 @@ void CGameHandler::makeCustomAction( BattleAction &ba )
} \ } \
} \ } \
sse.effect.id = (NUMBER); \ sse.effect.id = (NUMBER); \
sse.effect.level = getSchoolLevel(h,s); \ sse.effect.level = h->getSpellSchoolLevel(s); \
sse.effect.turnsRemain = (DURATION); \ sse.effect.turnsRemain = (DURATION); \
sendAndApply(&sse); \ sendAndApply(&sse); \
} }
@ -2273,7 +2259,7 @@ void CGameHandler::makeCustomAction( BattleAction &ba )
BattleStackAttacked bsa; BattleStackAttacked bsa;
bsa.flags |= 2; bsa.flags |= 2;
bsa.effect = 64; bsa.effect = 64;
bsa.damageAmount = h->getPrimSkillLevel(2) * 10 + s->powers[getSchoolLevel(h,s)]; bsa.damageAmount = h->getPrimSkillLevel(2) * 10 + s->powers[h->getSpellSchoolLevel(s)];
bsa.stackAttacked = attacked->ID; bsa.stackAttacked = attacked->ID;
prepareAttacked(bsa,attacked); prepareAttacked(bsa,attacked);
sendAndApply(&bsa); sendAndApply(&bsa);
@ -2286,7 +2272,7 @@ void CGameHandler::makeCustomAction( BattleAction &ba )
BattleStackAttacked bsa; BattleStackAttacked bsa;
bsa.flags |= 2; bsa.flags |= 2;
bsa.effect = 46; bsa.effect = 46;
bsa.damageAmount = h->getPrimSkillLevel(2) * 20 + s->powers[getSchoolLevel(h,s)]; bsa.damageAmount = h->getPrimSkillLevel(2) * 20 + s->powers[h->getSpellSchoolLevel(s)];
bsa.stackAttacked = attacked->ID; bsa.stackAttacked = attacked->ID;
prepareAttacked(bsa,attacked); prepareAttacked(bsa,attacked);
sendAndApply(&bsa); sendAndApply(&bsa);
@ -2299,7 +2285,7 @@ void CGameHandler::makeCustomAction( BattleAction &ba )
BattleStackAttacked bsa; BattleStackAttacked bsa;
bsa.flags |= 2; bsa.flags |= 2;
bsa.effect = 38; bsa.effect = 38;
bsa.damageAmount = h->getPrimSkillLevel(2) * 25 + s->powers[getSchoolLevel(h,s)]; bsa.damageAmount = h->getPrimSkillLevel(2) * 25 + s->powers[h->getSpellSchoolLevel(s)];
bsa.stackAttacked = attacked->ID; bsa.stackAttacked = attacked->ID;
prepareAttacked(bsa,attacked); prepareAttacked(bsa,attacked);
sendAndApply(&bsa); sendAndApply(&bsa);
@ -2312,12 +2298,25 @@ void CGameHandler::makeCustomAction( BattleAction &ba )
BattleStackAttacked bsa; BattleStackAttacked bsa;
bsa.flags |= 2; bsa.flags |= 2;
bsa.effect = 10; bsa.effect = 10;
bsa.damageAmount = h->getPrimSkillLevel(2) * 75 + s->powers[getSchoolLevel(h,s)]; bsa.damageAmount = h->getPrimSkillLevel(2) * 75 + s->powers[h->getSpellSchoolLevel(s)];
bsa.stackAttacked = attacked->ID; bsa.stackAttacked = attacked->ID;
prepareAttacked(bsa,attacked); prepareAttacked(bsa,attacked);
sendAndApply(&bsa); sendAndApply(&bsa);
break; break;
} }
case 21: //fireball
{
std::set<ui16> attackedHexes = s->rangeInHexes(ba.destinationTile, h->getSpellSchoolLevel(s));
std::set<CStack*> attackedCres; //set to exclude multiple occurences of two hex creatures
for(std::set<ui16>::iterator it = attackedHexes.begin(); it != attackedHexes.end(); ++it)
{
attackedCres.insert(gs->curB->getStackT(*it));
}
if(attackedCres.size()) break;
//TODO: the rest of it
break;
}
case 27: //shield case 27: //shield
case 28: //air shield case 28: //air shield
case 41: //bless case 41: //bless

View File

@ -10,6 +10,17 @@
#include "../lib/BattleAction.h" #include "../lib/BattleAction.h"
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
/*
* CGameHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CVCMIServer; class CVCMIServer;
class CGameState; class CGameState;
struct StartInfo; struct StartInfo;

View File

@ -33,6 +33,16 @@ namespace intpr = boost::interprocess;
bool end2 = false; bool end2 = false;
int port = 3030; int port = 3030;
/*
* CVCMIServer.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
void vaccept(tcp::acceptor *ac, tcp::socket *s, boost::system::error_code *error) void vaccept(tcp::acceptor *ac, tcp::socket *s, boost::system::error_code *error)
{ {
ac->accept(*s,*error); ac->accept(*s,*error);

View File

@ -2,6 +2,17 @@
#define __CVCMISERVER_H__ #define __CVCMISERVER_H__
#include "../global.h" #include "../global.h"
#include <set> #include <set>
/*
* CVCMIServer.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
class CConnection; class CConnection;
namespace boost namespace boost
{ {

View File

@ -8,6 +8,16 @@
return;} return;}
#define ERROR_IF_NOT_OWNS(id) if(!PLAYER_OWNS(id)) ERROR_AND_RETURN #define ERROR_IF_NOT_OWNS(id) if(!PLAYER_OWNS(id)) ERROR_AND_RETURN
/*
* NetPacksServer.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CGameState* CPackForServer::GS(CGameHandler *gh) CGameState* CPackForServer::GS(CGameHandler *gh)
{ {
return gh->gs; return gh->gs;

Some files were not shown because too many files have changed in this diff Show More