1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-31 22:59:54 +02:00

corrected that missclick! hope so

This commit is contained in:
Łukasz Wychrystenko 2008-12-26 01:15:47 +00:00
parent fa38b6ef79
commit b356524aee
44 changed files with 6029 additions and 3728 deletions

View File

@ -1,181 +1,181 @@
#ifndef __GENIUS_AI__
#define __GENIUS_AI__
#define VCMI_DLL
#pragma warning (disable: 4100 4251 4245 4018 4081)
#include "../../global.h"
#include "../../AI_Base.h"
#include "../../CCallback.h"
#include "../../hch/CCreatureHandler.h"
#include "../../hch/CObjectHandler.h"
#pragma warning (default: 4100 4251 4245 4018 4081)
#pragma warning (disable: 4100)
namespace GeniusAI {
class CBattleHelper
{
public:
CBattleHelper();
~CBattleHelper();
int GetBattleFieldPosition(int x, int y);
int DecodeXPosition(int battleFieldPosition);
int DecodeYPosition(int battleFieldPosition);
int GetShortestDistance(int pointA, int pointB);
int GetDistanceWithObstacles(int pointA, int pointB);
int GetVoteForMaxDamage() const { return m_voteForMaxDamage; }
int GetVoteForMinDamage() const { return m_voteForMinDamage; }
int GetVoteForMaxSpeed() const { return m_voteForMaxSpeed; }
int GetVoteForDistance() const { return m_voteForDistance; }
int GetVoteForDistanceFromShooters() const { return m_voteForDistanceFromShooters; }
int GetVoteForHitPoints() const { return m_voteForHitPoints; }
const int InfiniteDistance;
const int BattlefieldWidth;
const int BattlefieldHeight;
private:
int m_voteForMaxDamage;
int m_voteForMinDamage;
int m_voteForMaxSpeed;
int m_voteForDistance;
int m_voteForDistanceFromShooters;
int m_voteForHitPoints;
CBattleHelper(const CBattleHelper &);
CBattleHelper &operator=(const CBattleHelper &);
};
/**
* Maybe it is a additional proxy, but i've separated the game IA for transparent.
*/
class CBattleLogic
{
private:
enum EMainStrategyType
{
strategy_super_aggresive,
strategy_aggresive,
strategy_neutral,
strategy_defensive,
strategy_super_defensive,
strategy_berserk_attack /** cause max damage, usually when creatures fight against overwhelming army*/
};
enum ECreatureRoleInBattle
{
creature_role_shooter,
creature_role_defenser,
creature_role_fast_attacker,
creature_role_attacker
};
enum EActionType
{
action_cancel = 0, // Cancel BattleAction
action_cast_spell = 1, // Hero cast a spell
action_walk = 2, // Walk
action_defend = 3, // Defend
action_retreat = 4, // Retreat from the battle
action_surrender = 5, // Surrender
action_walk_and_attack = 6, // Walk and Attack
action_shoot = 7, // Shoot
action_wait = 8, // Wait
action_catapult = 9, // Catapult
action_monster_casts_spell = 10 // Monster casts a spell (i.e. Faerie Dragons)
};
struct SCreatureCasualties
{
int amount_max; // amount of creatures that will be dead
int amount_min;
int damage_max; // number of hit points that creature will lost
int damage_min;
int leftHitPoints_for_max; // number of hit points that will remain (for last unity)
int leftHitPoint_for_min; // scenario
};
public:
CBattleLogic(ICallback *cb, CCreatureSet *army1, CCreatureSet *army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, bool side);
~CBattleLogic();
void SetCurrentTurn(int turn);
BattleAction MakeDecision(int stackID);
private:
CBattleHelper m_battleHelper;
//BattleInfo m_battleInfo;
int m_iCurrentTurn;
bool m_bIsAttacker;
ICallback *m_cb;
CCreatureSet *m_army1;
CCreatureSet *m_army2;
int3 m_tile;
CGHeroInstance *m_hero1;
CGHeroInstance *m_hero2;
bool m_side;
void MakeStatistics(int currentCreatureId); // before decision we have to make some calculation and simulation
// statistics
typedef std::vector<std::pair<int, int> > creature_stat; // first - creature id, second - value
creature_stat m_statMaxDamage;
creature_stat m_statMinDamage;
//
creature_stat m_statMaxSpeed;
creature_stat m_statDistance;
creature_stat m_statDistanceFromShooters;
creature_stat m_statHitPoints;
typedef std::vector<std::pair<int, SCreatureCasualties> > creature_stat_casualties;
creature_stat_casualties m_statCasualties;
bool m_bEnemyDominates;
std::vector<int> GetAvailableHexesForAttacker(CStack *defender, CStack *attacker = NULL);
BattleAction MakeDefend(int stackID);
int PerformBerserkAttack(int stackID); // return ID of creature to attack, -2 means wait, -1 - defend
int PerformDefaultAction(int stackID);
void CBattleLogic::PrintBattleAction(const BattleAction &action);
};
class CGeniusAI : public CGlobalAI
{
private:
ICallback *m_cb;
CBattleLogic *m_battleLogic;
public:
virtual void init(ICallback * CB);
virtual void yourTurn();
virtual void heroKilled(const CGHeroInstance *);
virtual void heroCreated(const CGHeroInstance *);
virtual void heroMoved(const HeroMoveDetails &);
virtual void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val) {};
virtual void showSelDialog(std::string text, std::vector<CSelectableComponent*> & components, int askID){};
virtual void tileRevealed(int3 pos){};
virtual void tileHidden(int3 pos){};
virtual void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
// battle
virtual void actionFinished(const BattleAction *action);//occurs AFTER every action taken by any stack or by the hero
virtual void actionStarted(const BattleAction *action);//occurs BEFORE every action taken by any stack or by the hero
virtual void battleAttack(BattleAttack *ba); //called when stack is performing attack
virtual void battleStackAttacked(BattleStackAttacked * bsa); //called when stack receives damage (after battleAttack())
virtual void battleEnd(BattleResult *br);
virtual void battleNewRound(int round); //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
virtual void battleStackMoved(int ID, int dest);
virtual void battleSpellCasted(SpellCasted *sc);
virtual void battleStart(CCreatureSet *army1, CCreatureSet *army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, bool side); //called by engine when battle starts; side=0 - left, side=1 - right
virtual void battlefieldPrepared(int battlefieldType, std::vector<CObstacle*> obstacles); //called when battlefield is prepared, prior the battle beginning
//
virtual void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving);
virtual void battleStackAttacking(int ID, int dest);
virtual void battleStackIsAttacked(int ID, int dmg, int killed, int IDby, bool byShooting);
virtual BattleAction activeStack(int stackID);
};
}
#endif/*__GENIUS_AI__*/
#ifndef __CGENIUSAI_H__
#define __CGENIUSAI_H__
#define VCMI_DLL
#pragma warning (disable: 4100 4251 4245 4018 4081)
#include "../../global.h"
#include "../../AI_Base.h"
#include "../../CCallback.h"
#include "../../hch/CCreatureHandler.h"
#include "../../hch/CObjectHandler.h"
#pragma warning (default: 4100 4251 4245 4018 4081)
#pragma warning (disable: 4100)
namespace GeniusAI {
class CBattleHelper
{
public:
CBattleHelper();
~CBattleHelper();
int GetBattleFieldPosition(int x, int y);
int DecodeXPosition(int battleFieldPosition);
int DecodeYPosition(int battleFieldPosition);
int GetShortestDistance(int pointA, int pointB);
int GetDistanceWithObstacles(int pointA, int pointB);
int GetVoteForMaxDamage() const { return m_voteForMaxDamage; }
int GetVoteForMinDamage() const { return m_voteForMinDamage; }
int GetVoteForMaxSpeed() const { return m_voteForMaxSpeed; }
int GetVoteForDistance() const { return m_voteForDistance; }
int GetVoteForDistanceFromShooters() const { return m_voteForDistanceFromShooters; }
int GetVoteForHitPoints() const { return m_voteForHitPoints; }
const int InfiniteDistance;
const int BattlefieldWidth;
const int BattlefieldHeight;
private:
int m_voteForMaxDamage;
int m_voteForMinDamage;
int m_voteForMaxSpeed;
int m_voteForDistance;
int m_voteForDistanceFromShooters;
int m_voteForHitPoints;
CBattleHelper(const CBattleHelper &);
CBattleHelper &operator=(const CBattleHelper &);
};
/**
* Maybe it is a additional proxy, but i've separated the game IA for transparent.
*/
class CBattleLogic
{
private:
enum EMainStrategyType
{
strategy_super_aggresive,
strategy_aggresive,
strategy_neutral,
strategy_defensive,
strategy_super_defensive,
strategy_berserk_attack /** cause max damage, usually when creatures fight against overwhelming army*/
};
enum ECreatureRoleInBattle
{
creature_role_shooter,
creature_role_defenser,
creature_role_fast_attacker,
creature_role_attacker
};
enum EActionType
{
action_cancel = 0, // Cancel BattleAction
action_cast_spell = 1, // Hero cast a spell
action_walk = 2, // Walk
action_defend = 3, // Defend
action_retreat = 4, // Retreat from the battle
action_surrender = 5, // Surrender
action_walk_and_attack = 6, // Walk and Attack
action_shoot = 7, // Shoot
action_wait = 8, // Wait
action_catapult = 9, // Catapult
action_monster_casts_spell = 10 // Monster casts a spell (i.e. Faerie Dragons)
};
struct SCreatureCasualties
{
int amount_max; // amount of creatures that will be dead
int amount_min;
int damage_max; // number of hit points that creature will lost
int damage_min;
int leftHitPoints_for_max; // number of hit points that will remain (for last unity)
int leftHitPoint_for_min; // scenario
};
public:
CBattleLogic(ICallback *cb, CCreatureSet *army1, CCreatureSet *army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, bool side);
~CBattleLogic();
void SetCurrentTurn(int turn);
BattleAction MakeDecision(int stackID);
private:
CBattleHelper m_battleHelper;
//BattleInfo m_battleInfo;
int m_iCurrentTurn;
bool m_bIsAttacker;
ICallback *m_cb;
CCreatureSet *m_army1;
CCreatureSet *m_army2;
int3 m_tile;
CGHeroInstance *m_hero1;
CGHeroInstance *m_hero2;
bool m_side;
void MakeStatistics(int currentCreatureId); // before decision we have to make some calculation and simulation
// statistics
typedef std::vector<std::pair<int, int> > creature_stat; // first - creature id, second - value
creature_stat m_statMaxDamage;
creature_stat m_statMinDamage;
//
creature_stat m_statMaxSpeed;
creature_stat m_statDistance;
creature_stat m_statDistanceFromShooters;
creature_stat m_statHitPoints;
typedef std::vector<std::pair<int, SCreatureCasualties> > creature_stat_casualties;
creature_stat_casualties m_statCasualties;
bool m_bEnemyDominates;
std::vector<int> GetAvailableHexesForAttacker(CStack *defender, CStack *attacker = NULL);
BattleAction MakeDefend(int stackID);
int PerformBerserkAttack(int stackID); // return ID of creature to attack, -2 means wait, -1 - defend
int PerformDefaultAction(int stackID);
void CBattleLogic::PrintBattleAction(const BattleAction &action);
};
class CGeniusAI : public CGlobalAI
{
private:
ICallback *m_cb;
CBattleLogic *m_battleLogic;
public:
virtual void init(ICallback * CB);
virtual void yourTurn();
virtual void heroKilled(const CGHeroInstance *);
virtual void heroCreated(const CGHeroInstance *);
virtual void heroMoved(const HeroMoveDetails &);
virtual void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val) {};
virtual void showSelDialog(std::string text, std::vector<CSelectableComponent*> & components, int askID){};
virtual void tileRevealed(int3 pos){};
virtual void tileHidden(int3 pos){};
virtual void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
// battle
virtual void actionFinished(const BattleAction *action);//occurs AFTER every action taken by any stack or by the hero
virtual void actionStarted(const BattleAction *action);//occurs BEFORE every action taken by any stack or by the hero
virtual void battleAttack(BattleAttack *ba); //called when stack is performing attack
virtual void battleStackAttacked(BattleStackAttacked * bsa); //called when stack receives damage (after battleAttack())
virtual void battleEnd(BattleResult *br);
virtual void battleNewRound(int round); //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
virtual void battleStackMoved(int ID, int dest);
virtual void battleSpellCasted(SpellCasted *sc);
virtual void battleStart(CCreatureSet *army1, CCreatureSet *army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, bool side); //called by engine when battle starts; side=0 - left, side=1 - right
virtual void battlefieldPrepared(int battlefieldType, std::vector<CObstacle*> obstacles); //called when battlefield is prepared, prior the battle beginning
//
virtual void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving);
virtual void battleStackAttacking(int ID, int dest);
virtual void battleStackIsAttacked(int ID, int dmg, int killed, int IDby, bool byShooting);
virtual BattleAction activeStack(int stackID);
};
}
#endif // __CGENIUSAI_H__

View File

@ -1,14 +1,14 @@
#ifndef AIBASE_H
#define AIBASE_H
#ifdef _MSC_VER
#pragma once
#endif
#include <vector>
#include <iostream>
#include "CGameInterface.h"
#define AI_INTERFACE_VER 1
#endif //AIBASE_H
#ifndef __AI_BASE_H__
#define __AI_BASE_H__
#ifndef __AI_BASE_H__
#define __AI_BASE_H__
#include <vector>
#include <iostream>
#include "CGameInterface.h"
#define AI_INTERFACE_VER 1
#endif // __AI_BASE_H__
#endif // __AI_BASE_H__

View File

@ -1,101 +1,98 @@
#ifndef ADVENTUREMAPBUTTON_H
#define ADVENTUREMAPBUTTON_H
#ifdef _MSC_VER
#pragma once
#endif
#include "CPlayerInterface.h"
#include "client/FunctionList.h"
#include <boost/bind.hpp>
namespace config{struct ButtonInfo;}
class AdventureMapButton
: public ClickableR, public Hoverable, public KeyShortcut, public CButtonBase
{
public:
std::map<int,std::string> hoverTexts; //state -> text for statusbar
std::string helpBox; //for right-click help
CFunctionList<void()> callback;
bool colorChange, blocked,
actOnDown; //runs when mouse is pressed down over it, not when up
void clickRight (tribool down);
virtual void clickLeft (tribool down);
void hover (bool on);
void block(bool on); //if button is blocked then it'll change it's graphic to inactive (offset==2) and won't react on l-clicks
void activate(); // makes button active
void deactivate(); // makes button inactive (but doesn't delete)
AdventureMapButton(); //c-tor
AdventureMapButton( const std::map<int,std::string> &, const std::string &HelpBox, const CFunctionList<void()> &Callback, int x, int y, const std::string &defName, int key=0, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
AdventureMapButton( const std::string &Name, const std::string &HelpBox, const CFunctionList<void()> &Callback, int x, int y, const std::string &defName, int key=0, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
AdventureMapButton( const std::string &Name, const std::string &HelpBox, const CFunctionList<void()> &Callback, config::ButtonInfo *info, int key=0);//c-tor
//AdventureMapButton( std::string Name, std::string HelpBox, boost::function<void()> Callback, int x, int y, std::string defName, bool activ=false, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
void init(const CFunctionList<void()> &Callback, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key );
};
class CHighlightableButton
: public AdventureMapButton
{
public:
CHighlightableButton(const CFunctionList<void()> &onSelect, const CFunctionList<void()> &onDeselect, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key=0 );
bool selected, onlyOn;
CFunctionList<void()> callback2; //when disselecting
void select(bool on);
void clickLeft (tribool down);
};
class CHighlightableButtonsGroup
{
public:
CFunctionList2<void(int)> onChange; //called when changing selected button with new button's id
std::vector<CHighlightableButton*> buttons;
//void addButton(const std::map<int,std::string> &tooltip, const std::string &HelpBox, const std::string &defName, int x, int y, int uid);
void addButton(CHighlightableButton* bt);//add existing button, it'll be deleted by CHighlightableButtonsGroup destructor
void addButton(const std::map<int,std::string> &tooltip, const std::string &HelpBox, const std::string &defName, int x, int y, int uid, const CFunctionList<void()> &OnSelect=0, int key=0); //creates new button
CHighlightableButtonsGroup(const CFunctionList2<void(int)> &OnChange);
~CHighlightableButtonsGroup();
void activate();
void deactivate();
void select(int id, bool mode); //mode==0: id is serial; mode==1: id is unique button id
void selectionChanged(int to);
void show(SDL_Surface * to = NULL);
};
class CSlider : public IShowable, public MotionInterested, public ClickableL
{
public:
AdventureMapButton left, right, slider; //if vertical then left=up
int capacity,//how many elements can be active at same time
amount, //how many elements
value; //first active element
bool horizontal, moving;
CDefEssential *imgs ;
boost::function<void(int)> moved;
//void(T::*moved)(int to);
//T* owner;
void redrawSlider();
void sliderClicked();
void moveLeft();
void clickLeft (tribool down);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void moveRight();
void moveTo(int to);
void block(bool on);
void activate(); // makes button active
void deactivate(); // makes button inactive (but doesn't delete)
void show(SDL_Surface * to = NULL);
CSlider(int x, int y, int totalw, boost::function<void(int)> Moved, int Capacity, int Amount,
int Value=0, bool Horizontal=true);
~CSlider();
};
#endif //ADVENTUREMAPBUTTON_H
#ifndef ADVENTUREMAPBUTTON_H
#define ADVENTUREMAPBUTTON_H
#include "CPlayerInterface.h"
#include "client/FunctionList.h"
#include <boost/bind.hpp>
namespace config{struct ButtonInfo;}
class AdventureMapButton
: public ClickableR, public Hoverable, public KeyShortcut, public CButtonBase
{
public:
std::map<int,std::string> hoverTexts; //state -> text for statusbar
std::string helpBox; //for right-click help
CFunctionList<void()> callback;
bool colorChange, blocked,
actOnDown; //runs when mouse is pressed down over it, not when up
void clickRight (tribool down);
virtual void clickLeft (tribool down);
void hover (bool on);
void block(bool on); //if button is blocked then it'll change it's graphic to inactive (offset==2) and won't react on l-clicks
void activate(); // makes button active
void deactivate(); // makes button inactive (but doesn't delete)
AdventureMapButton(); //c-tor
AdventureMapButton( const std::map<int,std::string> &, const std::string &HelpBox, const CFunctionList<void()> &Callback, int x, int y, const std::string &defName, int key=0, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
AdventureMapButton( const std::string &Name, const std::string &HelpBox, const CFunctionList<void()> &Callback, int x, int y, const std::string &defName, int key=0, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
AdventureMapButton( const std::string &Name, const std::string &HelpBox, const CFunctionList<void()> &Callback, config::ButtonInfo *info, int key=0);//c-tor
//AdventureMapButton( std::string Name, std::string HelpBox, boost::function<void()> Callback, int x, int y, std::string defName, bool activ=false, std::vector<std::string> * add = NULL, bool playerColoredButton = false );//c-tor
void init(const CFunctionList<void()> &Callback, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key );
};
class CHighlightableButton
: public AdventureMapButton
{
public:
CHighlightableButton(const CFunctionList<void()> &onSelect, const CFunctionList<void()> &onDeselect, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key=0 );
bool selected, onlyOn;
CFunctionList<void()> callback2; //when disselecting
void select(bool on);
void clickLeft (tribool down);
};
class CHighlightableButtonsGroup
{
public:
CFunctionList2<void(int)> onChange; //called when changing selected button with new button's id
std::vector<CHighlightableButton*> buttons;
//void addButton(const std::map<int,std::string> &tooltip, const std::string &HelpBox, const std::string &defName, int x, int y, int uid);
void addButton(CHighlightableButton* bt);//add existing button, it'll be deleted by CHighlightableButtonsGroup destructor
void addButton(const std::map<int,std::string> &tooltip, const std::string &HelpBox, const std::string &defName, int x, int y, int uid, const CFunctionList<void()> &OnSelect=0, int key=0); //creates new button
CHighlightableButtonsGroup(const CFunctionList2<void(int)> &OnChange);
~CHighlightableButtonsGroup();
void activate();
void deactivate();
void select(int id, bool mode); //mode==0: id is serial; mode==1: id is unique button id
void selectionChanged(int to);
void show(SDL_Surface * to = NULL);
};
class CSlider : public IShowable, public MotionInterested, public ClickableL
{
public:
AdventureMapButton left, right, slider; //if vertical then left=up
int capacity,//how many elements can be active at same time
amount, //how many elements
value; //first active element
bool horizontal, moving;
CDefEssential *imgs ;
boost::function<void(int)> moved;
//void(T::*moved)(int to);
//T* owner;
void redrawSlider();
void sliderClicked();
void moveLeft();
void clickLeft (tribool down);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void moveRight();
void moveTo(int to);
void block(bool on);
void activate(); // makes button active
void deactivate(); // makes button inactive (but doesn't delete)
void show(SDL_Surface * to = NULL);
CSlider(int x, int y, int totalw, boost::function<void(int)> Moved, int Capacity, int Amount,
int Value=0, bool Horizontal=true);
~CSlider();
};
#endif //ADVENTUREMAPBUTTON_H

View File

@ -1,177 +1,177 @@
#ifndef CADVENTUREMAPINTERFACE_H
#define CADVENTUREMAPINTERFACE_H
#include <typeinfo>
#include "global.h"
#include "SDL.h"
#include "CPlayerInterface.h"
#include <map>
#include "AdventureMapButton.h"
class CDefHandler;
class CCallback;
struct CPath;
class CAdvMapInt;
class CGHeroInstance;
class CGTownInstance;
class CHeroWindow;
/*****************************/
class CMinimap
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested, public virtual CIntObject
{
public:
SDL_Surface * radar;
SDL_Surface * temps;
std::map<int,SDL_Color> colors;
std::map<int,SDL_Color> colorsBlocked;
std::vector<SDL_Surface *> map, FoW; //one bitmap for each level (terrain, Fog of War)
//TODO flagged buildings
std::string statusbarTxt, rcText;
CMinimap(bool draw=true);
void draw();
void redraw(int level=-1);// (level==-1) => redraw all levels
void updateRadar();
void clickRight (tribool down);
void clickLeft (tribool down);
void hover (bool on);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void activate(); // makes button active
void deactivate(); // makes button inactive (but don't deletes)
void hideTile(const int3 &pos); //puts FoW
void showTile(const int3 &pos); //removes FoW
};
class CTerrainRect
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested
{
public:
int tilesw, tilesh; //width and height of terrain to blit in tiles
int3 curHoveredTile;
int moveX, moveY; //shift between actual position of screen and the one we wil blit; ranges from -31 to 31 (in pixels)
CDefHandler * arrows;
CTerrainRect();
CPath * currentPath;
void activate();
void deactivate();
void clickLeft(tribool down);
void clickRight(tribool down);
void hover(bool on);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void show();
void showPath();
int3 whichTileIsIt(const int & x, const int & y); //x,y are cursor position
int3 whichTileIsIt(); //uses current cursor pos
};
class CResDataBar
:public ClickableR, public virtual CIntObject
{
public:
SDL_Surface * bg;
std::vector<std::pair<int,int> > txtpos;
std::string datetext;
void clickRight (tribool down);
void activate();
void deactivate();
CResDataBar();
CResDataBar(const std::string &defname, int x, int y, int offx, int offy, int resdist, int datedist);
~CResDataBar();
void draw();
};
class CInfoBar
:public virtual CIntObject, public TimeInterested
{
public:
CDefHandler *day, *week1, *week2, *week3, *week4;
SComponent * current;
int mode;
int pom;
CInfoBar();
~CInfoBar();
void newDay(int Day);
void showComp(SComponent * comp, int time=5000);
void tick();
void draw(const CGObjectInstance * specific=NULL); // if specific==0 function draws info about selected hero/town
void blitAnim(int mode);//0 - day, 1 - week
CDefHandler * getAnim(int mode);
};
/*****************************/
class CAdvMapInt : public CMainInterface, public KeyInterested //adventure map interface
{
public:
CAdvMapInt(int Player);
~CAdvMapInt();
int3 position; //top left corner of visible map part
int player;
std::vector<CDefHandler *> gems;
bool scrollingLeft ;
bool scrollingRight ;
bool scrollingUp ;
bool scrollingDown ;
bool updateScreen, updateMinimap ;
unsigned char anim, animValHitCount; //animation frame
unsigned char heroAnim, heroAnimValHitCount; //animation frame
CMinimap minimap;
SDL_Surface * bg;
AdventureMapButton kingOverview,//- kingdom overview
underground,//- underground switch
questlog,//- questlog
sleepWake, //- sleep/wake hero
moveHero, //- move hero
spellbook,//- spellbook
advOptions, //- adventure options
sysOptions,//- system options
nextHero, //- next hero
endTurn;//- end turn
//CHeroList herolist;
CTerrainRect terrain; //visible terrain
CStatusBar statusbar;
CResDataBar resdatabar;
CHeroList heroList;
CTownList townList;
CInfoBar infoBar;
CHeroWindow * heroWindow;
const CArmedInstance *selection;
//fuctions binded to buttons
void fshowOverview();
void fswitchLevel();
void fshowQuestlog();
void fsleepWake();
void fmoveHero();
void fshowSpellbok();
void fadventureOPtions();
void fsystemOptions();
void fnextHero();
void fendTurn();
void activate();
void deactivate();
void show(SDL_Surface * to=NULL); //shows and activates adv. map interface
void hide(); //deactivates advmap interface
void update(); //redraws terrain
void select(const CArmedInstance *sel);
void selectionChanged();
void centerOn(int3 on);
int3 verifyPos(int3 ver);
void handleRightClick(std::string text, tribool down, CIntObject * client);
void keyPressed(const SDL_KeyboardEvent & key);
};
#endif //CADVENTUREMAPINTERFACE_H
#ifndef __CADVMAPINTERFACE_H__
#define __CADVMAPINTERFACE_H__
#include <typeinfo>
#include "global.h"
#include "SDL.h"
#include "CPlayerInterface.h"
#include <map>
#include "AdventureMapButton.h"
class CDefHandler;
class CCallback;
struct CPath;
class CAdvMapInt;
class CGHeroInstance;
class CGTownInstance;
class CHeroWindow;
/*****************************/
class CMinimap
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested, public virtual CIntObject
{
public:
SDL_Surface * radar;
SDL_Surface * temps;
std::map<int,SDL_Color> colors;
std::map<int,SDL_Color> colorsBlocked;
std::vector<SDL_Surface *> map, FoW; //one bitmap for each level (terrain, Fog of War)
//TODO flagged buildings
std::string statusbarTxt, rcText;
CMinimap(bool draw=true);
void draw();
void redraw(int level=-1);// (level==-1) => redraw all levels
void updateRadar();
void clickRight (tribool down);
void clickLeft (tribool down);
void hover (bool on);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void activate(); // makes button active
void deactivate(); // makes button inactive (but don't deletes)
void hideTile(const int3 &pos); //puts FoW
void showTile(const int3 &pos); //removes FoW
};
class CTerrainRect
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested
{
public:
int tilesw, tilesh; //width and height of terrain to blit in tiles
int3 curHoveredTile;
int moveX, moveY; //shift between actual position of screen and the one we wil blit; ranges from -31 to 31 (in pixels)
CDefHandler * arrows;
CTerrainRect();
CPath * currentPath;
void activate();
void deactivate();
void clickLeft(tribool down);
void clickRight(tribool down);
void hover(bool on);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void show();
void showPath();
int3 whichTileIsIt(const int & x, const int & y); //x,y are cursor position
int3 whichTileIsIt(); //uses current cursor pos
};
class CResDataBar
:public ClickableR, public virtual CIntObject
{
public:
SDL_Surface * bg;
std::vector<std::pair<int,int> > txtpos;
std::string datetext;
void clickRight (tribool down);
void activate();
void deactivate();
CResDataBar();
CResDataBar(const std::string &defname, int x, int y, int offx, int offy, int resdist, int datedist);
~CResDataBar();
void draw();
};
class CInfoBar
:public virtual CIntObject, public TimeInterested
{
public:
CDefHandler *day, *week1, *week2, *week3, *week4;
SComponent * current;
int mode;
int pom;
CInfoBar();
~CInfoBar();
void newDay(int Day);
void showComp(SComponent * comp, int time=5000);
void tick();
void draw(const CGObjectInstance * specific=NULL); // if specific==0 function draws info about selected hero/town
void blitAnim(int mode);//0 - day, 1 - week
CDefHandler * getAnim(int mode);
};
/*****************************/
class CAdvMapInt : public CMainInterface, public KeyInterested //adventure map interface
{
public:
CAdvMapInt(int Player);
~CAdvMapInt();
int3 position; //top left corner of visible map part
int player;
std::vector<CDefHandler *> gems;
bool scrollingLeft ;
bool scrollingRight ;
bool scrollingUp ;
bool scrollingDown ;
bool updateScreen, updateMinimap ;
unsigned char anim, animValHitCount; //animation frame
unsigned char heroAnim, heroAnimValHitCount; //animation frame
CMinimap minimap;
SDL_Surface * bg;
AdventureMapButton kingOverview,//- kingdom overview
underground,//- underground switch
questlog,//- questlog
sleepWake, //- sleep/wake hero
moveHero, //- move hero
spellbook,//- spellbook
advOptions, //- adventure options
sysOptions,//- system options
nextHero, //- next hero
endTurn;//- end turn
//CHeroList herolist;
CTerrainRect terrain; //visible terrain
CStatusBar statusbar;
CResDataBar resdatabar;
CHeroList heroList;
CTownList townList;
CInfoBar infoBar;
CHeroWindow * heroWindow;
const CArmedInstance *selection;
//fuctions binded to buttons
void fshowOverview();
void fswitchLevel();
void fshowQuestlog();
void fsleepWake();
void fmoveHero();
void fshowSpellbok();
void fadventureOPtions();
void fsystemOptions();
void fnextHero();
void fendTurn();
void activate();
void deactivate();
void show(SDL_Surface * to=NULL); //shows and activates adv. map interface
void hide(); //deactivates advmap interface
void update(); //redraws terrain
void select(const CArmedInstance *sel);
void selectionChanged();
void centerOn(int3 on);
int3 verifyPos(int3 ver);
void handleRightClick(std::string text, tribool down, CIntObject * client);
void keyPressed(const SDL_KeyboardEvent & key);
};
#endif // __CADVMAPINTERFACE_H__

View File

@ -1,261 +1,258 @@
#ifndef CBATTLEINTERFACE_H
#define CBATTLEINTERFACE_H
#ifdef _MSC_VER
#pragma once
#endif
#include "global.h"
#include "CPlayerInterface.h"
#include <list>
class CCreatureSet;
class CGHeroInstance;
class CDefHandler;
class CStack;
class CCallback;
class AdventureMapButton;
class CHighlightableButton;
class CHighlightableButtonsGroup;
struct BattleResult;
struct SpellCasted;
template <typename T> struct CondSh;
class CBattleInterface;
class CBattleHero : public IShowable, public ClickableL
{
public:
bool flip; //false if it's attacking hero, true otherwise
CDefHandler * dh, *flag; //animation and flag
const CGHeroInstance * myHero; //this animation's hero instance
const CBattleInterface * myOwner; //battle interface to which this animation is assigned
int phase; //stage of animation
int image; //frame of animation
unsigned char flagAnim, flagAnimCount; //for flag animation
void show(SDL_Surface * to); //prints next frame of animation to to
void activate();
void deactivate();
void setPhase(int newPhase);
void clickLeft(boost::logic::tribool down);
CBattleHero(const std::string & defName, int phaseG, int imageG, bool filpG, unsigned char player, const CGHeroInstance * hero, const CBattleInterface * owner); //c-tor
~CBattleHero(); //d-tor
};
class CBattleHex : public Hoverable, public MotionInterested, public ClickableL, public ClickableR
{
private:
bool setAlterText; //if true, this hex has set alternative text in console and will clean it
public:
unsigned int myNumber;
bool accesible;
//CStack * ourStack;
bool hovered, strictHovered;
CBattleInterface * myInterface; //interface that owns me
static std::pair<int, int> getXYUnitAnim(const int & hexNum, const bool & attacker, const CCreature * creature); //returns (x, y) of left top corner of animation
//for user interactions
void hover (bool on);
void activate();
void deactivate();
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void clickLeft(boost::logic::tribool down);
void clickRight(boost::logic::tribool down);
CBattleHex();
};
class CBattleObstacle
{
std::vector<int> lockedHexes;
};
class CBattleConsole : public IShowable, public CIntObject
{
private:
std::vector< std::string > texts; //a place where texts are stored
int lastShown; //last shown line of text
public:
std::string alterTxt; //if it's not empty, this text is displayed
CBattleConsole(); //c-tor
~CBattleConsole(); //d-tor
void show(SDL_Surface * to = 0);
bool addText(const std::string & text); //adds text at the last position; returns false if failed (e.g. text longer than 70 characters)
void eraseText(unsigned int pos); //erases added text at position pos
void changeTextAt(const std::string & text, unsigned int pos); //if we have more than pos texts, pos-th is changed to given one
void scrollUp(unsigned int by = 1); //scrolls console up by 'by' positions
void scrollDown(unsigned int by = 1); //scrolls console up by 'by' positions
};
class CBattleReslutWindow : public IShowable, public CIntObject, public IActivable
{
private:
SDL_Surface * background;
AdventureMapButton * exit;
public:
CBattleReslutWindow(const BattleResult & br, const SDL_Rect & pos, const CBattleInterface * owner); //c-tor
~CBattleReslutWindow(); //d-tor
void bExitf();
void activate();
void deactivate();
void show(SDL_Surface * to = 0);
};
class CBattleOptionsWindow : public IShowable, public CIntObject, public IActivable
{
private:
CBattleInterface * myInt;
SDL_Surface * background;
AdventureMapButton * setToDefault, * exit;
CHighlightableButton * viewGrid, * movementShadow, * mouseShadow;
CHighlightableButtonsGroup * animSpeeds;
public:
CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface * owner); //c-tor
~CBattleOptionsWindow(); //d-tor
void bDefaultf();
void bExitf();
void activate();
void deactivate();
void show(SDL_Surface * to = 0);
};
class CBattleInterface : public CMainInterface, public MotionInterested, public KeyInterested
{
private:
SDL_Surface * background, * menu, * amountNormal, * amountNegative, * amountPositive, * amountEffNeutral, * cellBorders, * backgroundWithHexes;
AdventureMapButton * bOptions, * bSurrender, * bFlee, * bAutofight, * bSpell,
* bWait, * bDefence, * bConsoleUp, * bConsoleDown;
CBattleConsole * console;
CBattleHero * attackingHero, * defendingHero;
CCreatureSet * army1, * army2; //fighting armies
CGHeroInstance * attackingHeroInstance, * defendingHeroInstance;
std::map< int, CCreatureAnimation * > creAnims; //animations of creatures from fighting armies (order by BattleInfo's stacks' ID)
std::map< int, CDefHandler * > idToProjectile; //projectiles of creaures (creatureID, defhandler)
std::map< int, bool > creDir; // <creatureID, if false reverse creature's animation>
unsigned char animCount;
int activeStack; //number of active stack; -1 - no one
std::vector<int> shadedHexes; //hexes available for active stack
int previouslyHoveredHex; //number of hex that was hovered by the cursor a while ago
int currentlyHoveredHex; //number of hex that is supposed to be hovered (for a while it may be inappropriately set, but will be renewed soon)
int animSpeed; //speed of animation; 1 - slowest, 2 - medium, 4 - fastest
float getAnimSpeedMultiplier() const; //returns multiplier for number of frames in a group
bool spellDestSelectMode; //if true, player is choosing destination for his spell
int spellSelMode; //0 - any location, 1 - any firendly creature, 2 - any hostile creature, 3 - any creature, 4 - obstacle, -1 - no location
BattleAction * spellToCast; //spell for which player is choosing destination
class CAttHelper
{
public:
int ID; //attacking stack
int IDby; //attacked stack
int dest; //atacked hex
int frame, maxframe; //frame of animation, number of frames of animation
int hitCount; //for delaying animation
bool reversing;
int posShiftDueToDist;
bool shooting;
int shootingGroup; //if shooting is true, print this animation group
} * attackingInfo;
void attackingShowHelper();
void redrawBackgroundWithHexes(int activeStack);
void printConsoleAttacked(int ID, int dmg, int killed, int IDby);
struct SProjectileInfo
{
int x, y; //position on the screen
int dx, dy; //change in position in one step
int step, lastStep; //to know when finish showing this projectile
int creID; //ID of creature that shot this projectile
int frameNum; //frame to display form projectile animation
bool spin; //if true, frameNum will be increased
int animStartDelay; //how many times projectile must be attempted to be shown till it's really show (decremented after hit)
};
std::list<SProjectileInfo> projectiles;
void projectileShowHelper(SDL_Surface * to=NULL); //prints projectiles present on the battlefield
void giveCommand(ui8 action, ui16 tile, ui32 stack, si32 additional=-1);
bool isTileAttackable(const int & number) const; //returns true if tile 'number' is neighbouring any tile from active stack's range or is one of these tiles
struct SBattleEffect
{
int x, y; //position on the screen
int frame, maxFrame;
CDefHandler * anim; //animation to display
};
std::list<SBattleEffect> battleEffects; //different animations to display on the screen like spell effects
public:
CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, CGHeroInstance *hero1, CGHeroInstance *hero2, const SDL_Rect & myRect); //c-tor
~CBattleInterface(); //d-tor
//std::vector<TimeInterested*> timeinterested; //animation handling
bool printCellBorders; //if true, cell borders will be printed
void setPrintCellBorders(bool set); //set for above member
bool printStackRange; //if true,range of active stack will be printed
void setPrintStackRange(bool set); //set for above member
bool printMouseShadow; //if true, hex under mouse will be shaded
void setPrintMouseShadow(bool set); //set for above member
void setAnimSpeed(int set); //set for animSpeed
int getAnimSpeed() const; //get for animSpeed
CBattleHex bfield[BFIELD_SIZE]; //11 lines, 17 hexes on each
std::vector< CBattleObstacle * > obstacles; //vector of obstacles on the battlefield
SDL_Surface * cellBorder, * cellShade;
CondSh<BattleAction *> *givenCommand; //data != NULL if we have i.e. moved current unit
bool myTurn; //if true, interface is active (commands can be ordered
CBattleReslutWindow * resWindow; //window of end of battle
bool showStackQueue; //if true, queue of stacks will be shown
//button handle funcs:
void bOptionsf();
void bSurrenderf();
void bFleef();
void reallyFlee(); //performs fleeing without asking player
void bAutofightf();
void bSpellf();
void bWaitf();
void bDefencef();
void bConsoleUpf();
void bConsoleDownf();
//end of button handle funcs
//napisz tu klase odpowiadajaca za wyswietlanie bitwy i obsluge uzytkownika, polecenia ma przekazywac callbackiem
void activate();
void deactivate();
void show(SDL_Surface * to = NULL);
void keyPressed(const SDL_KeyboardEvent & key);
void mouseMoved(const SDL_MouseMotionEvent &sEvent);
bool reverseCreature(int number, int hex, bool wideTrick = false); //reverses animation of given creature playing animation of reversing
struct SStackAttackedInfo
{
int ID; //id of attacked stack
int dmg; //damage dealt
int amountKilled; //how many creatures in stack has been killed
int IDby; //ID of attacking stack
bool byShooting; //if true, stack has been attacked by shooting
bool killed; //if true, stack has been killed
};
//call-ins
void newStack(CStack stack); //new stack appeared on battlefield
void stackRemoved(CStack stack); //stack disappeared from batlefiled
//void stackKilled(int ID, int dmg, int killed, int IDby, bool byShooting); //stack has been killed (but corpses remain)
void stackActivated(int number); //active stack has been changed
void stackMoved(int number, int destHex, bool endMoving); //stack with id number moved to destHex
void stacksAreAttacked(std::vector<SStackAttackedInfo> attackedInfos); //called when a certain amount of stacks has been attacked
void stackAttacking(int ID, int dest); //called when stack with id ID is attacking something on hex dest
void newRound(int number); //caled when round is ended; number is the number of round
void hexLclicked(int whichOne); //hex only call-in
void stackIsShooting(int ID, int dest); //called when stack with id ID is shooting to hex dest
void battleFinished(const BattleResult& br); //called when battle is finished - battleresult window should be printed
void spellCasted(SpellCasted * sc); //called when a hero casts a spell
void castThisSpell(int spellID); //called when player has chosen a spell from spellbook
void displayEffect(ui32 effect, int destTile); //displays effect of a spell on the battlefield; affected: true - attacker. false - defender
friend class CBattleHex;
friend class CBattleReslutWindow;
friend class CPlayerInterface;
};
#ifndef CBATTLEINTERFACE_H
#define CBATTLEINTERFACE_H
#include "global.h"
#include "CPlayerInterface.h"
#include <list>
class CCreatureSet;
class CGHeroInstance;
class CDefHandler;
class CStack;
class CCallback;
class AdventureMapButton;
class CHighlightableButton;
class CHighlightableButtonsGroup;
struct BattleResult;
struct SpellCasted;
template <typename T> struct CondSh;
class CBattleInterface;
class CBattleHero : public IShowable, public ClickableL
{
public:
bool flip; //false if it's attacking hero, true otherwise
CDefHandler * dh, *flag; //animation and flag
const CGHeroInstance * myHero; //this animation's hero instance
const CBattleInterface * myOwner; //battle interface to which this animation is assigned
int phase; //stage of animation
int image; //frame of animation
unsigned char flagAnim, flagAnimCount; //for flag animation
void show(SDL_Surface * to); //prints next frame of animation to to
void activate();
void deactivate();
void setPhase(int newPhase);
void clickLeft(boost::logic::tribool down);
CBattleHero(const std::string & defName, int phaseG, int imageG, bool filpG, unsigned char player, const CGHeroInstance * hero, const CBattleInterface * owner); //c-tor
~CBattleHero(); //d-tor
};
class CBattleHex : public Hoverable, public MotionInterested, public ClickableL, public ClickableR
{
private:
bool setAlterText; //if true, this hex has set alternative text in console and will clean it
public:
unsigned int myNumber;
bool accesible;
//CStack * ourStack;
bool hovered, strictHovered;
CBattleInterface * myInterface; //interface that owns me
static std::pair<int, int> getXYUnitAnim(const int & hexNum, const bool & attacker, const CCreature * creature); //returns (x, y) of left top corner of animation
//for user interactions
void hover (bool on);
void activate();
void deactivate();
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
void clickLeft(boost::logic::tribool down);
void clickRight(boost::logic::tribool down);
CBattleHex();
};
class CBattleObstacle
{
std::vector<int> lockedHexes;
};
class CBattleConsole : public IShowable, public CIntObject
{
private:
std::vector< std::string > texts; //a place where texts are stored
int lastShown; //last shown line of text
public:
std::string alterTxt; //if it's not empty, this text is displayed
CBattleConsole(); //c-tor
~CBattleConsole(); //d-tor
void show(SDL_Surface * to = 0);
bool addText(const std::string & text); //adds text at the last position; returns false if failed (e.g. text longer than 70 characters)
void eraseText(unsigned int pos); //erases added text at position pos
void changeTextAt(const std::string & text, unsigned int pos); //if we have more than pos texts, pos-th is changed to given one
void scrollUp(unsigned int by = 1); //scrolls console up by 'by' positions
void scrollDown(unsigned int by = 1); //scrolls console up by 'by' positions
};
class CBattleReslutWindow : public IShowable, public CIntObject, public IActivable
{
private:
SDL_Surface * background;
AdventureMapButton * exit;
public:
CBattleReslutWindow(const BattleResult & br, const SDL_Rect & pos, const CBattleInterface * owner); //c-tor
~CBattleReslutWindow(); //d-tor
void bExitf();
void activate();
void deactivate();
void show(SDL_Surface * to = 0);
};
class CBattleOptionsWindow : public IShowable, public CIntObject, public IActivable
{
private:
CBattleInterface * myInt;
SDL_Surface * background;
AdventureMapButton * setToDefault, * exit;
CHighlightableButton * viewGrid, * movementShadow, * mouseShadow;
CHighlightableButtonsGroup * animSpeeds;
public:
CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface * owner); //c-tor
~CBattleOptionsWindow(); //d-tor
void bDefaultf();
void bExitf();
void activate();
void deactivate();
void show(SDL_Surface * to = 0);
};
class CBattleInterface : public CMainInterface, public MotionInterested, public KeyInterested
{
private:
SDL_Surface * background, * menu, * amountNormal, * amountNegative, * amountPositive, * amountEffNeutral, * cellBorders, * backgroundWithHexes;
AdventureMapButton * bOptions, * bSurrender, * bFlee, * bAutofight, * bSpell,
* bWait, * bDefence, * bConsoleUp, * bConsoleDown;
CBattleConsole * console;
CBattleHero * attackingHero, * defendingHero;
CCreatureSet * army1, * army2; //fighting armies
CGHeroInstance * attackingHeroInstance, * defendingHeroInstance;
std::map< int, CCreatureAnimation * > creAnims; //animations of creatures from fighting armies (order by BattleInfo's stacks' ID)
std::map< int, CDefHandler * > idToProjectile; //projectiles of creaures (creatureID, defhandler)
std::map< int, bool > creDir; // <creatureID, if false reverse creature's animation>
unsigned char animCount;
int activeStack; //number of active stack; -1 - no one
std::vector<int> shadedHexes; //hexes available for active stack
int previouslyHoveredHex; //number of hex that was hovered by the cursor a while ago
int currentlyHoveredHex; //number of hex that is supposed to be hovered (for a while it may be inappropriately set, but will be renewed soon)
int animSpeed; //speed of animation; 1 - slowest, 2 - medium, 4 - fastest
float getAnimSpeedMultiplier() const; //returns multiplier for number of frames in a group
bool spellDestSelectMode; //if true, player is choosing destination for his spell
int spellSelMode; //0 - any location, 1 - any firendly creature, 2 - any hostile creature, 3 - any creature, 4 - obstacle, -1 - no location
BattleAction * spellToCast; //spell for which player is choosing destination
class CAttHelper
{
public:
int ID; //attacking stack
int IDby; //attacked stack
int dest; //atacked hex
int frame, maxframe; //frame of animation, number of frames of animation
int hitCount; //for delaying animation
bool reversing;
int posShiftDueToDist;
bool shooting;
int shootingGroup; //if shooting is true, print this animation group
} * attackingInfo;
void attackingShowHelper();
void redrawBackgroundWithHexes(int activeStack);
void printConsoleAttacked(int ID, int dmg, int killed, int IDby);
struct SProjectileInfo
{
int x, y; //position on the screen
int dx, dy; //change in position in one step
int step, lastStep; //to know when finish showing this projectile
int creID; //ID of creature that shot this projectile
int frameNum; //frame to display form projectile animation
bool spin; //if true, frameNum will be increased
int animStartDelay; //how many times projectile must be attempted to be shown till it's really show (decremented after hit)
};
std::list<SProjectileInfo> projectiles;
void projectileShowHelper(SDL_Surface * to=NULL); //prints projectiles present on the battlefield
void giveCommand(ui8 action, ui16 tile, ui32 stack, si32 additional=-1);
bool isTileAttackable(const int & number) const; //returns true if tile 'number' is neighbouring any tile from active stack's range or is one of these tiles
struct SBattleEffect
{
int x, y; //position on the screen
int frame, maxFrame;
CDefHandler * anim; //animation to display
};
std::list<SBattleEffect> battleEffects; //different animations to display on the screen like spell effects
public:
CBattleInterface(CCreatureSet * army1, CCreatureSet * army2, CGHeroInstance *hero1, CGHeroInstance *hero2, const SDL_Rect & myRect); //c-tor
~CBattleInterface(); //d-tor
//std::vector<TimeInterested*> timeinterested; //animation handling
bool printCellBorders; //if true, cell borders will be printed
void setPrintCellBorders(bool set); //set for above member
bool printStackRange; //if true,range of active stack will be printed
void setPrintStackRange(bool set); //set for above member
bool printMouseShadow; //if true, hex under mouse will be shaded
void setPrintMouseShadow(bool set); //set for above member
void setAnimSpeed(int set); //set for animSpeed
int getAnimSpeed() const; //get for animSpeed
CBattleHex bfield[BFIELD_SIZE]; //11 lines, 17 hexes on each
std::vector< CBattleObstacle * > obstacles; //vector of obstacles on the battlefield
SDL_Surface * cellBorder, * cellShade;
CondSh<BattleAction *> *givenCommand; //data != NULL if we have i.e. moved current unit
bool myTurn; //if true, interface is active (commands can be ordered
CBattleReslutWindow * resWindow; //window of end of battle
bool showStackQueue; //if true, queue of stacks will be shown
//button handle funcs:
void bOptionsf();
void bSurrenderf();
void bFleef();
void reallyFlee(); //performs fleeing without asking player
void bAutofightf();
void bSpellf();
void bWaitf();
void bDefencef();
void bConsoleUpf();
void bConsoleDownf();
//end of button handle funcs
//napisz tu klase odpowiadajaca za wyswietlanie bitwy i obsluge uzytkownika, polecenia ma przekazywac callbackiem
void activate();
void deactivate();
void show(SDL_Surface * to = NULL);
void keyPressed(const SDL_KeyboardEvent & key);
void mouseMoved(const SDL_MouseMotionEvent &sEvent);
bool reverseCreature(int number, int hex, bool wideTrick = false); //reverses animation of given creature playing animation of reversing
struct SStackAttackedInfo
{
int ID; //id of attacked stack
int dmg; //damage dealt
int amountKilled; //how many creatures in stack has been killed
int IDby; //ID of attacking stack
bool byShooting; //if true, stack has been attacked by shooting
bool killed; //if true, stack has been killed
};
//call-ins
void newStack(CStack stack); //new stack appeared on battlefield
void stackRemoved(CStack stack); //stack disappeared from batlefiled
//void stackKilled(int ID, int dmg, int killed, int IDby, bool byShooting); //stack has been killed (but corpses remain)
void stackActivated(int number); //active stack has been changed
void stackMoved(int number, int destHex, bool endMoving); //stack with id number moved to destHex
void stacksAreAttacked(std::vector<SStackAttackedInfo> attackedInfos); //called when a certain amount of stacks has been attacked
void stackAttacking(int ID, int dest); //called when stack with id ID is attacking something on hex dest
void newRound(int number); //caled when round is ended; number is the number of round
void hexLclicked(int whichOne); //hex only call-in
void stackIsShooting(int ID, int dest); //called when stack with id ID is shooting to hex dest
void battleFinished(const BattleResult& br); //called when battle is finished - battleresult window should be printed
void spellCasted(SpellCasted * sc); //called when a hero casts a spell
void castThisSpell(int spellID); //called when player has chosen a spell from spellbook
void displayEffect(ui32 effect, int destTile); //displays effect of a spell on the battlefield; affected: true - attacker. false - defender
friend class CBattleHex;
friend class CBattleReslutWindow;
friend class CPlayerInterface;
};
#endif //CBATTLEINTERFACE_H

View File

@ -1,231 +1,228 @@
#ifndef CCASTLEINTERFACE_H
#define CCASTLEINTERFACE_H
#ifdef _MSC_VER
#pragma once
#endif
#include "global.h"
#include <SDL.h>
#include "CPlayerInterface.h"
//#include "boost/tuple/tuple.hpp"
class CGTownInstance;
class CTownHandler;
class CHallInterface;
struct Structure;
class CSpell;
class AdventureMapButton;
class CResDataBar;
class CBuildingRect : public Hoverable, public MotionInterested, public ClickableL, public ClickableR//, public TimeInterested
{
public:
bool moi; //motion interested is active
int offset, max; //first and last animation frame
Structure* str;
CDefHandler* def;
SDL_Surface* border;
SDL_Surface* area;
CBuildingRect(Structure *Str);
~CBuildingRect();
void activate();
void deactivate();
bool operator<(const CBuildingRect & p2) const;
void hover(bool on);
void clickLeft (tribool down);
void clickRight (tribool down);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
};
class CHeroGSlot : public ClickableL, public ClickableR, public Hoverable
{
public:
CCastleInterface *owner;
const CGHeroInstance *hero;
int upg; //0 - up garrison, 1 - down garrison
bool highlight;
void hover (bool on);
void clickRight (boost::logic::tribool down);
void clickLeft(boost::logic::tribool down);
void activate();
void deactivate();
void show();
CHeroGSlot(int x, int y, int updown, const CGHeroInstance *h,CCastleInterface * Owner);
~CHeroGSlot();
};
class CCastleInterface : public CMainInterface
{
public:
SDL_Rect pos;
bool showing;
CBuildingRect * hBuild; //highlighted building
SDL_Surface * townInt;
SDL_Surface * cityBg;
const CGTownInstance * town;
CStatusBar * statusbar;
CResDataBar *resdatabar;
unsigned char animval, count;
CDefHandler *hall,*fort;
CDefEssential* bicons; //150x70 buildings imgs
CTownList * townlist;
CHeroGSlot hslotup, hslotdown;
CGarrisonInt * garr;
AdventureMapButton *exit;
AdventureMapButton *split;
std::vector<CBuildingRect*> buildings; //building id, building def, structure struct, border, filling
CCastleInterface(const CGTownInstance * Town, bool Activate=true);
~CCastleInterface();
void townChange();
void show(SDL_Surface * to=NULL);
void showAll(SDL_Surface * to=NULL, bool forceTotalRedraw = false);
void buildingClicked(int building);
void enterMageGuild();
CRecrutationWindow * showRecruitmentWindow(int building);
void enterHall();
void close();
void splitF();
void activate();
void deactivate();
void addBuilding(int bid);
void removeBuilding(int bid);
void recreateBuildings();
};
class CHallInterface : public IShowActivable
{
public:
CMinorResDataBar resdatabar;
SDL_Rect pos;
class CBuildingBox : public Hoverable, public ClickableL, public ClickableR
{
public:
int BID;
int state;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
//(-1) - forbidden in this town, 0 - possible, 1 - lack of res, 2 - requirements/buildings per turn limit, (3) - already exists
void hover(bool on);
void clickLeft (tribool down);
void clickRight (tribool down);
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
CBuildingBox(int id);
CBuildingBox(int id, int x, int y);
~CBuildingBox();
};
class CBuildWindow: public IShowable, public ClickableR
{
public:
int tid, bid, state; //town id, building id, state
bool mode; // 0 - normal (with buttons), 1 - r-click popup
SDL_Surface * bitmap; //main window bitmap, with blitted res/text, without buttons/subtitle in "statusbar"
AdventureMapButton *buy, *cancel;
void activate();
void deactivate();
std::string getTextForState(int state);
void clickRight (tribool down);
void show(SDL_Surface * to=NULL);
void Buy();
void close();
CBuildWindow(int Tid, int Bid, int State, bool Mode);
~CBuildWindow();
};
CDefEssential *bars, //0 - yellow, 1 - green, 2 - red, 3 - gray
*status; //0 - already, 1 - can't, 2 - lack of resources
std::vector< std::vector<CBuildingBox*> >boxes;
AdventureMapButton *exit;
SDL_Surface * bg;
CHallInterface(CCastleInterface * owner);
~CHallInterface();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
class CFortScreen : public CMainInterface, public CIntObject
{
class RecArea : public ClickableL
{
public:
int bid;
RecArea(int BID):bid(BID){};
void clickLeft (tribool down);
void activate();
void deactivate();
};
public:
CMinorResDataBar resdatabar;
AdventureMapButton *exit;
SDL_Surface * bg;
std::vector<SDL_Rect> positions;
std::vector<RecArea*> recAreas;
std::vector<CCreaturePic*> crePics;
CFortScreen(CCastleInterface * owner);
void draw( CCastleInterface * owner, bool first);
~CFortScreen();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
class CMageGuildScreen : public IShowActivable, public CIntObject
{
public:
class Scroll : public ClickableL, public Hoverable, public ClickableR
{
public:
CSpell *spell;
Scroll(CSpell *Spell):spell(Spell){};
void clickLeft (tribool down);
void clickRight (tribool down);
void hover(bool on);
void activate();
void deactivate();
};
std::vector<std::vector<SDL_Rect> > positions;
SDL_Surface *bg;
CDefEssential *scrolls, *scrolls2;
AdventureMapButton *exit;
std::vector<Scroll> spells;
CMinorResDataBar resdatabar;
CMageGuildScreen(CCastleInterface * owner);
~CMageGuildScreen();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
class CBlacksmithDialog : public IShowable, public CIntObject
{
public:
AdventureMapButton *buy, *cancel;
SDL_Surface *bmp;
CBlacksmithDialog(bool possible, int creMachineID, int aid, int hid);
~CBlacksmithDialog();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
#ifndef CCASTLEINTERFACE_H
#define CCASTLEINTERFACE_H
#include "global.h"
#include <SDL.h>
#include "CPlayerInterface.h"
//#include "boost/tuple/tuple.hpp"
class CGTownInstance;
class CTownHandler;
class CHallInterface;
struct Structure;
class CSpell;
class AdventureMapButton;
class CResDataBar;
class CBuildingRect : public Hoverable, public MotionInterested, public ClickableL, public ClickableR//, public TimeInterested
{
public:
bool moi; //motion interested is active
int offset, max; //first and last animation frame
Structure* str;
CDefHandler* def;
SDL_Surface* border;
SDL_Surface* area;
CBuildingRect(Structure *Str);
~CBuildingRect();
void activate();
void deactivate();
bool operator<(const CBuildingRect & p2) const;
void hover(bool on);
void clickLeft (tribool down);
void clickRight (tribool down);
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
};
class CHeroGSlot : public ClickableL, public ClickableR, public Hoverable
{
public:
CCastleInterface *owner;
const CGHeroInstance *hero;
int upg; //0 - up garrison, 1 - down garrison
bool highlight;
void hover (bool on);
void clickRight (boost::logic::tribool down);
void clickLeft(boost::logic::tribool down);
void activate();
void deactivate();
void show();
CHeroGSlot(int x, int y, int updown, const CGHeroInstance *h,CCastleInterface * Owner);
~CHeroGSlot();
};
class CCastleInterface : public CMainInterface
{
public:
SDL_Rect pos;
bool showing;
CBuildingRect * hBuild; //highlighted building
SDL_Surface * townInt;
SDL_Surface * cityBg;
const CGTownInstance * town;
CStatusBar * statusbar;
CResDataBar *resdatabar;
unsigned char animval, count;
CDefHandler *hall,*fort;
CDefEssential* bicons; //150x70 buildings imgs
CTownList * townlist;
CHeroGSlot hslotup, hslotdown;
CGarrisonInt * garr;
AdventureMapButton *exit;
AdventureMapButton *split;
std::vector<CBuildingRect*> buildings; //building id, building def, structure struct, border, filling
CCastleInterface(const CGTownInstance * Town, bool Activate=true);
~CCastleInterface();
void townChange();
void show(SDL_Surface * to=NULL);
void showAll(SDL_Surface * to=NULL, bool forceTotalRedraw = false);
void buildingClicked(int building);
void enterMageGuild();
CRecrutationWindow * showRecruitmentWindow(int building);
void enterHall();
void close();
void splitF();
void activate();
void deactivate();
void addBuilding(int bid);
void removeBuilding(int bid);
void recreateBuildings();
};
class CHallInterface : public IShowActivable
{
public:
CMinorResDataBar resdatabar;
SDL_Rect pos;
class CBuildingBox : public Hoverable, public ClickableL, public ClickableR
{
public:
int BID;
int state;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
//(-1) - forbidden in this town, 0 - possible, 1 - lack of res, 2 - requirements/buildings per turn limit, (3) - already exists
void hover(bool on);
void clickLeft (tribool down);
void clickRight (tribool down);
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
CBuildingBox(int id);
CBuildingBox(int id, int x, int y);
~CBuildingBox();
};
class CBuildWindow: public IShowable, public ClickableR
{
public:
int tid, bid, state; //town id, building id, state
bool mode; // 0 - normal (with buttons), 1 - r-click popup
SDL_Surface * bitmap; //main window bitmap, with blitted res/text, without buttons/subtitle in "statusbar"
AdventureMapButton *buy, *cancel;
void activate();
void deactivate();
std::string getTextForState(int state);
void clickRight (tribool down);
void show(SDL_Surface * to=NULL);
void Buy();
void close();
CBuildWindow(int Tid, int Bid, int State, bool Mode);
~CBuildWindow();
};
CDefEssential *bars, //0 - yellow, 1 - green, 2 - red, 3 - gray
*status; //0 - already, 1 - can't, 2 - lack of resources
std::vector< std::vector<CBuildingBox*> >boxes;
AdventureMapButton *exit;
SDL_Surface * bg;
CHallInterface(CCastleInterface * owner);
~CHallInterface();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
class CFortScreen : public CMainInterface, public CIntObject
{
class RecArea : public ClickableL
{
public:
int bid;
RecArea(int BID):bid(BID){};
void clickLeft (tribool down);
void activate();
void deactivate();
};
public:
CMinorResDataBar resdatabar;
AdventureMapButton *exit;
SDL_Surface * bg;
std::vector<SDL_Rect> positions;
std::vector<RecArea*> recAreas;
std::vector<CCreaturePic*> crePics;
CFortScreen(CCastleInterface * owner);
void draw( CCastleInterface * owner, bool first);
~CFortScreen();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
class CMageGuildScreen : public IShowActivable, public CIntObject
{
public:
class Scroll : public ClickableL, public Hoverable, public ClickableR
{
public:
CSpell *spell;
Scroll(CSpell *Spell):spell(Spell){};
void clickLeft (tribool down);
void clickRight (tribool down);
void hover(bool on);
void activate();
void deactivate();
};
std::vector<std::vector<SDL_Rect> > positions;
SDL_Surface *bg;
CDefEssential *scrolls, *scrolls2;
AdventureMapButton *exit;
std::vector<Scroll> spells;
CMinorResDataBar resdatabar;
CMageGuildScreen(CCastleInterface * owner);
~CMageGuildScreen();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
class CBlacksmithDialog : public IShowable, public CIntObject
{
public:
AdventureMapButton *buy, *cancel;
SDL_Surface *bmp;
CBlacksmithDialog(bool possible, int creMachineID, int aid, int hid);
~CBlacksmithDialog();
void close();
void show(SDL_Surface * to=NULL);
void activate();
void deactivate();
};
#endif //CCASTLEINTERFACE_H

View File

@ -1,136 +1,133 @@
#ifndef CHEROWINDOW_H
#define CHEROWINDOW_H
#ifdef _MSC_VER
#pragma once
#endif
#include "CPlayerInterface.h"
class AdventureMapButton;
struct SDL_Surface;
class CGHeroInstance;
class CDefHandler;
class CArtifact;
class CHeroWindow;
class LClickableArea: public ClickableL
{
public:
virtual void clickLeft (tribool down);
virtual void activate();
virtual void deactivate();
};
class RClickableArea: public ClickableR
{
public:
virtual void clickRight (tribool down);
virtual void activate();
virtual void deactivate();
};
class LClickableAreaHero : public LClickableArea
{
public:
int id;
CHeroWindow * owner;
virtual void clickLeft (tribool down);
};
class LRClickableAreaWText: public LClickableArea, public RClickableArea, public Hoverable
{
public:
std::string text, hoverText;
virtual void activate();
virtual void deactivate();
virtual void clickLeft (tribool down);
virtual void clickRight (tribool down);
virtual void hover(bool on);
};
class LRClickableAreaWTextComp: public LClickableArea, public RClickableArea, public Hoverable
{
public:
std::string text, hoverText;
int baseType;
int bonus, type;
virtual void activate();
virtual void deactivate();
virtual void clickLeft (tribool down);
virtual void clickRight (tribool down);
virtual void hover(bool on);
};
class CArtPlace: public IShowable, public LRClickableAreaWTextComp
{
private:
bool active;
public:
//bool spellBook, warMachine1, warMachine2, warMachine3, warMachine4,
// misc1, misc2, misc3, misc4, misc5, feet, lRing, rRing, torso,
// lHand, rHand, neck, shoulders, head; //my types
ui16 slotID; //0 head 1 shoulders 2 neck 3 right hand 4 left hand 5 torso 6 right ring 7 left ring 8 feet 9 misc. slot 1 10 misc. slot 2 11 misc. slot 3 12 misc. slot 4 13 ballista (war machine 1) 14 ammo cart (war machine 2) 15 first aid tent (war machine 3) 16 catapult 17 spell book 18 misc. slot 5 19+ backpack slots
bool clicked;
CHeroWindow * ourWindow;
const CArtifact * ourArt;
CArtPlace(const CArtifact * Art);
void clickLeft (tribool down);
void clickRight (tribool down);
void activate();
void deactivate();
void show(SDL_Surface * to = NULL);
bool fitsHere(const CArtifact * art); //returns true if given artifact can be placed here
~CArtPlace();
};
class CHeroWindow: public IShowActivable, public virtual CIntObject
{
SDL_Surface * background, * curBack;
const CGHeroInstance * curHero;
CGarrisonInt * garInt;
CStatusBar * ourBar; //heroWindow's statusBar
//general graphics
CDefHandler *flags;
//buttons
AdventureMapButton * gar4button; //splitting
std::vector<LClickableAreaHero *> heroListMi; //new better list of heroes
std::vector<CArtPlace *> artWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
std::vector<CArtPlace *> backpack; //hero's visible backpack (only 5 elements!)
int backpackPos; //unmber of first art visible in backpack (in hero's vector)
CArtPlace * activeArtPlace;
//clickable areas
LRClickableAreaWText * portraitArea;
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
LRClickableAreaWText * expArea;
LRClickableAreaWText * spellPointsArea;
std::vector<LRClickableAreaWTextComp *> secSkillAreas;
public:
AdventureMapButton * quitButton, * dismissButton, * questlogButton, //general
* leftArtRoll, * rightArtRoll;
CHighlightableButton *gar2button; //garrison / formation handling;
CHighlightableButtonsGroup *formations;
int player;
CHeroWindow(int playerColor); //c-tor
~CHeroWindow(); //d-tor
void setHero(const CGHeroInstance * Hero); //sets main displayed hero
void activate(); //activates hero window;
void deactivate(); //activates hero window;
virtual void show(SDL_Surface * to = NULL); //shows hero window
void redrawCurBack(); //redraws curBAck from scratch
void quit(); //stops displaying hero window
void dismissCurrent(); //dissmissed currently displayed hero (curHero)
void questlog(); //show quest log in hero window
void leftArtRoller(); //scrolls artifacts in bag left
void rightArtRoller(); //scrolls artifacts in bag right
void switchHero(); //changes displayed hero
//friends
friend void CArtPlace::clickLeft(tribool down);
friend class CPlayerInterface;
};
#ifndef CHEROWINDOW_H
#define CHEROWINDOW_H
#include "CPlayerInterface.h"
class AdventureMapButton;
struct SDL_Surface;
class CGHeroInstance;
class CDefHandler;
class CArtifact;
class CHeroWindow;
class LClickableArea: public ClickableL
{
public:
virtual void clickLeft (tribool down);
virtual void activate();
virtual void deactivate();
};
class RClickableArea: public ClickableR
{
public:
virtual void clickRight (tribool down);
virtual void activate();
virtual void deactivate();
};
class LClickableAreaHero : public LClickableArea
{
public:
int id;
CHeroWindow * owner;
virtual void clickLeft (tribool down);
};
class LRClickableAreaWText: public LClickableArea, public RClickableArea, public Hoverable
{
public:
std::string text, hoverText;
virtual void activate();
virtual void deactivate();
virtual void clickLeft (tribool down);
virtual void clickRight (tribool down);
virtual void hover(bool on);
};
class LRClickableAreaWTextComp: public LClickableArea, public RClickableArea, public Hoverable
{
public:
std::string text, hoverText;
int baseType;
int bonus, type;
virtual void activate();
virtual void deactivate();
virtual void clickLeft (tribool down);
virtual void clickRight (tribool down);
virtual void hover(bool on);
};
class CArtPlace: public IShowable, public LRClickableAreaWTextComp
{
private:
bool active;
public:
//bool spellBook, warMachine1, warMachine2, warMachine3, warMachine4,
// misc1, misc2, misc3, misc4, misc5, feet, lRing, rRing, torso,
// lHand, rHand, neck, shoulders, head; //my types
ui16 slotID; //0 head 1 shoulders 2 neck 3 right hand 4 left hand 5 torso 6 right ring 7 left ring 8 feet 9 misc. slot 1 10 misc. slot 2 11 misc. slot 3 12 misc. slot 4 13 ballista (war machine 1) 14 ammo cart (war machine 2) 15 first aid tent (war machine 3) 16 catapult 17 spell book 18 misc. slot 5 19+ backpack slots
bool clicked;
CHeroWindow * ourWindow;
const CArtifact * ourArt;
CArtPlace(const CArtifact * Art);
void clickLeft (tribool down);
void clickRight (tribool down);
void activate();
void deactivate();
void show(SDL_Surface * to = NULL);
bool fitsHere(const CArtifact * art); //returns true if given artifact can be placed here
~CArtPlace();
};
class CHeroWindow: public IShowActivable, public virtual CIntObject
{
SDL_Surface * background, * curBack;
const CGHeroInstance * curHero;
CGarrisonInt * garInt;
CStatusBar * ourBar; //heroWindow's statusBar
//general graphics
CDefHandler *flags;
//buttons
AdventureMapButton * gar4button; //splitting
std::vector<LClickableAreaHero *> heroListMi; //new better list of heroes
std::vector<CArtPlace *> artWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
std::vector<CArtPlace *> backpack; //hero's visible backpack (only 5 elements!)
int backpackPos; //unmber of first art visible in backpack (in hero's vector)
CArtPlace * activeArtPlace;
//clickable areas
LRClickableAreaWText * portraitArea;
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
LRClickableAreaWText * expArea;
LRClickableAreaWText * spellPointsArea;
std::vector<LRClickableAreaWTextComp *> secSkillAreas;
public:
AdventureMapButton * quitButton, * dismissButton, * questlogButton, //general
* leftArtRoll, * rightArtRoll;
CHighlightableButton *gar2button; //garrison / formation handling;
CHighlightableButtonsGroup *formations;
int player;
CHeroWindow(int playerColor); //c-tor
~CHeroWindow(); //d-tor
void setHero(const CGHeroInstance * Hero); //sets main displayed hero
void activate(); //activates hero window;
void deactivate(); //activates hero window;
virtual void show(SDL_Surface * to = NULL); //shows hero window
void redrawCurBack(); //redraws curBAck from scratch
void quit(); //stops displaying hero window
void dismissCurrent(); //dissmissed currently displayed hero (curHero)
void questlog(); //show quest log in hero window
void leftArtRoller(); //scrolls artifacts in bag left
void rightArtRoller(); //scrolls artifacts in bag right
void switchHero(); //changes displayed hero
//friends
friend void CArtPlace::clickLeft(tribool down);
friend class CPlayerInterface;
};
#endif //CHEROWINDOW_H

View File

@ -1,47 +1,44 @@
#ifndef CBITMAPHANDLER_H
#define CBITMAPHANDLER_H
#ifdef _MSC_VER
#pragma once
#endif
#include "../global.h"
struct SDL_Surface;
class CLodHandler;
enum Epcxformat {PCX8B, PCX24B};
struct BMPPalette
{
unsigned char R,G,B,F;
};
struct BMPHeader
{
int fullSize, _h1, _h2, _h3, _c1, _c2, _c3, _c4, x, y,
dataSize1, dataSize2; //DataSize=X*Y+2*Y
unsigned char _c5[8];
void print(std::ostream & out);
BMPHeader(){_h1=_h2=0;for(int i=0;i<8;i++)_c5[i]=0;};
};
class CPCXConv
{
public:
unsigned char * pcx, *bmp;
int pcxs, bmps;
void fromFile(std::string path);
void saveBMP(std::string path);
void openPCX(char * PCX, int len);
void openPCX();
void convert();
SDL_Surface * getSurface(); //for standard H3 PCX
//SDL_Surface * getSurfaceZ(); //for ZSoft PCX
CPCXConv(){pcx=bmp=NULL;pcxs=bmps=0;};
~CPCXConv(){if (pcxs) delete[] pcx; if(bmps) delete[] bmp;}
};
namespace BitmapHandler
{
extern CLodHandler *bitmaph;
SDL_Surface * loadBitmap(std::string fname, bool setKey=false);
};
#ifndef CBITMAPHANDLER_H
#define CBITMAPHANDLER_H
#include "../global.h"
struct SDL_Surface;
class CLodHandler;
enum Epcxformat {PCX8B, PCX24B};
struct BMPPalette
{
unsigned char R,G,B,F;
};
struct BMPHeader
{
int fullSize, _h1, _h2, _h3, _c1, _c2, _c3, _c4, x, y,
dataSize1, dataSize2; //DataSize=X*Y+2*Y
unsigned char _c5[8];
void print(std::ostream & out);
BMPHeader(){_h1=_h2=0;for(int i=0;i<8;i++)_c5[i]=0;};
};
class CPCXConv
{
public:
unsigned char * pcx, *bmp;
int pcxs, bmps;
void fromFile(std::string path);
void saveBMP(std::string path);
void openPCX(char * PCX, int len);
void openPCX();
void convert();
SDL_Surface * getSurface(); //for standard H3 PCX
//SDL_Surface * getSurfaceZ(); //for ZSoft PCX
CPCXConv(){pcx=bmp=NULL;pcxs=bmps=0;};
~CPCXConv(){if (pcxs) delete[] pcx; if(bmps) delete[] bmp;}
};
namespace BitmapHandler
{
extern CLodHandler *bitmaph;
SDL_Surface * loadBitmap(std::string fname, bool setKey=false);
};
#endif //CBITMAPHANDLER_H

View File

@ -1,67 +1,66 @@
#ifndef CCONFIGHANDLER_H
#define CCONFIGHANDLER_H
#pragma once
#include "../global.h"
class CAdvMapInt;
namespace config
{
struct ClientConfig
{
int resx, resy, bpp, fullscreen; //client resolution/colours
int port, localInformation;
std::string server, //server address (e.g. 127.0.0.1)
defaultAI; //dll name
};
struct ButtonInfo
{
std::string defName;
std::vector<std::string> additionalDefs;
int x, y; //position on the screen
bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics)
};
struct AdventureMapConfig
{
//minimap properties
int minimapX, minimapY, minimapW, minimapH;
//statusbar
int statusbarX, statusbarY; //pos
std::string statusbarG; //graphic name
//resdatabar
int resdatabarX, resdatabarY, resDist, resDateDist, resOffsetX, resOffsetY; //pos
std::string resdatabarG; //graphic name
//infobox
int infoboxX, infoboxY;
//advmap
int tilesW, tilesH, advmapX, advmapY, advmapTrimX, advmapTrimY;
//general properties
std::string mainGraphic;
//buttons
ButtonInfo kingOverview, underground, questlog, sleepWake, moveHero, spellbook, advOptions,
sysOptions, nextHero, endTurn;
//hero list
int hlistX, hlistY, hlistSize;
std::string hlistMB, hlistMN, hlistAU, hlistAD;
//town list
int tlistX, tlistY, tlistSize;
std::string tlistAU, tlistAD;
//gems
int gemX[4], gemY[4];
std::vector<std::string> gemG;
};
struct GUIOptions
{
AdventureMapConfig ac;
};
class CConfigHandler
{
public:
ClientConfig cc;
std::map<std::pair<int,int>, GUIOptions > guiOptions;
GUIOptions *go(); //return pointer to gui options appropriate for used screen resolution
void init();
CConfigHandler(void);
~CConfigHandler(void);
};
}
extern config::CConfigHandler conf;
#ifndef CCONFIGHANDLER_H
#define CCONFIGHANDLER_H
#include "../global.h"
class CAdvMapInt;
namespace config
{
struct ClientConfig
{
int resx, resy, bpp, fullscreen; //client resolution/colours
int port, localInformation;
std::string server, //server address (e.g. 127.0.0.1)
defaultAI; //dll name
};
struct ButtonInfo
{
std::string defName;
std::vector<std::string> additionalDefs;
int x, y; //position on the screen
bool playerColoured; //if true button will be colored to main player's color (works properly only for appropriate 8bpp graphics)
};
struct AdventureMapConfig
{
//minimap properties
int minimapX, minimapY, minimapW, minimapH;
//statusbar
int statusbarX, statusbarY; //pos
std::string statusbarG; //graphic name
//resdatabar
int resdatabarX, resdatabarY, resDist, resDateDist, resOffsetX, resOffsetY; //pos
std::string resdatabarG; //graphic name
//infobox
int infoboxX, infoboxY;
//advmap
int tilesW, tilesH, advmapX, advmapY, advmapTrimX, advmapTrimY;
//general properties
std::string mainGraphic;
//buttons
ButtonInfo kingOverview, underground, questlog, sleepWake, moveHero, spellbook, advOptions,
sysOptions, nextHero, endTurn;
//hero list
int hlistX, hlistY, hlistSize;
std::string hlistMB, hlistMN, hlistAU, hlistAD;
//town list
int tlistX, tlistY, tlistSize;
std::string tlistAU, tlistAD;
//gems
int gemX[4], gemY[4];
std::vector<std::string> gemG;
};
struct GUIOptions
{
AdventureMapConfig ac;
};
class CConfigHandler
{
public:
ClientConfig cc;
std::map<std::pair<int,int>, GUIOptions > guiOptions;
GUIOptions *go(); //return pointer to gui options appropriate for used screen resolution
void init();
CConfigHandler(void);
~CConfigHandler(void);
};
}
extern config::CConfigHandler conf;
#endif //CCONFIGHANDLER_H

View File

@ -1,57 +1,54 @@
#ifndef CCREATUREANIMATION_H
#define CCREATUREANIMATION_H
#ifdef _MSC_VER
#pragma once
#endif
#include "../global.h"
#include "../CPlayerInterface.h"
#include "../hch/CDefHandler.h"
class CCreatureAnimation : public CIntObject
{
private:
int totalEntries, DEFType, totalBlocks;
int length;
BMPPalette palette[256];
int * RLEntries;
struct SEntry
{
std::string name;
int offset;
int group;
} ;
std::vector<SEntry> SEntries ;
std::string defName, curDir;
int readNormalNr (int pos, int bytCon, unsigned char * str=NULL) const;
void putPixel(
SDL_Surface * dest,
const int & ftcp,
const BMPPalette & color,
const unsigned char & palc,
const bool & yellowBorder
) const;
////////////
unsigned char * FDef; //animation raw data
int curFrame; //number of currently displayed frame
unsigned int frames; //number of frames
public:
int type; //type of animation being displayed (-1 - whole animation, >0 - specified part [default: -1])
int fullWidth, fullHeight; //read-only, please!
CCreatureAnimation(std::string name); //c-tor
~CCreatureAnimation(); //d-tor
void setType(int type); //sets type of animation and cleares framecount
int getType() const; //returns type of animation
int nextFrame(SDL_Surface * dest, int x, int y, bool attacker, bool incrementFrame = true, bool yellowBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next
int nextFrameMiddle(SDL_Surface * dest, int x, int y, bool attacker, bool IncrementFrame = true, bool yellowBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next
void incrementFrame();
int getFrame() const;
int framesInGroup(int group) const; //retirns number of fromes in given group
};
#ifndef CCREATUREANIMATION_H
#define CCREATUREANIMATION_H
#include "../global.h"
#include "../CPlayerInterface.h"
#include "../hch/CDefHandler.h"
class CCreatureAnimation : public CIntObject
{
private:
int totalEntries, DEFType, totalBlocks;
int length;
BMPPalette palette[256];
int * RLEntries;
struct SEntry
{
std::string name;
int offset;
int group;
} ;
std::vector<SEntry> SEntries ;
std::string defName, curDir;
int readNormalNr (int pos, int bytCon, unsigned char * str=NULL) const;
void putPixel(
SDL_Surface * dest,
const int & ftcp,
const BMPPalette & color,
const unsigned char & palc,
const bool & yellowBorder
) const;
////////////
unsigned char * FDef; //animation raw data
int curFrame; //number of currently displayed frame
unsigned int frames; //number of frames
public:
int type; //type of animation being displayed (-1 - whole animation, >0 - specified part [default: -1])
int fullWidth, fullHeight; //read-only, please!
CCreatureAnimation(std::string name); //c-tor
~CCreatureAnimation(); //d-tor
void setType(int type); //sets type of animation and cleares framecount
int getType() const; //returns type of animation
int nextFrame(SDL_Surface * dest, int x, int y, bool attacker, bool incrementFrame = true, bool yellowBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next
int nextFrameMiddle(SDL_Surface * dest, int x, int y, bool attacker, bool IncrementFrame = true, bool yellowBorder = false, SDL_Rect * destRect = NULL); //0 - success, any other - error //print next
void incrementFrame();
int getFrame() const;
int framesInGroup(int group) const; //retirns number of fromes in given group
};
#endif //CCREATUREANIMATION_H

View File

@ -1,95 +1,92 @@
#ifndef CSPELLWINDOW_H
#define CSPELLWINDOW_H
#ifdef _MSC_VER
#pragma once
#endif
#include "../global.h"
#include "../CPlayerInterface.h"
struct SDL_Surface;
class CDefHandler;
struct SDL_Rect;
class CGHeroInstance;
class SpellbookInteractiveArea : public ClickableL, public ClickableR, public Hoverable
{
private:
boost::function<void()> onLeft;
std::string textOnRclick;
boost::function<void()> onHoverOn;
boost::function<void()> onHoverOff;
public:
void clickLeft(boost::logic::tribool down);
void clickRight(boost::logic::tribool down);
void hover(bool on);
void activate();
void deactivate();
SpellbookInteractiveArea(const SDL_Rect & myRect, boost::function<void()> funcL, const std::string & textR, boost::function<void()> funcHon, boost::function<void()> funcHoff);//c-tor
};
class CSpellWindow : public IShowActivable, public CIntObject
{
private:
class SpellArea : public ClickableL, public ClickableR, public Hoverable
{
public:
int mySpell;
CSpellWindow * owner;
SpellArea(SDL_Rect pos, CSpellWindow * owner);
void clickLeft(boost::logic::tribool down);
void clickRight(boost::logic::tribool down);
void hover(bool on);
void activate();
void deactivate();
};
SDL_Surface * background, * leftCorner, * rightCorner;
CDefHandler * spells, //pictures of spells
* spellTab, //school select
* schools, //schools' pictures
* schoolBorders [4]; //schools' 'borders': [0]: air, [1]: fire, [2]: water, [3]: earth
SpellbookInteractiveArea * exitBtn, * battleSpells, * adventureSpells, * manaPoints;
SpellbookInteractiveArea * selectSpellsA, * selectSpellsE, * selectSpellsF, * selectSpellsW, * selectSpellsAll;
SpellbookInteractiveArea * lCorner, * rCorner;
SpellArea * spellAreas[12];
CStatusBar * statusBar;
Uint8 sitesPerTabAdv[5];
Uint8 sitesPerTabBattle[5];
bool battleSpellsOnly; //if true, only battle spells are displayed; if false, only adventure map spells are displayed
Uint8 selectedTab; // 0 - air magic, 1 - fire magic, 2 - water magic, 3 - earth magic, 4 - all schools
Uint8 spellSite; //changes when corners are clicked
std::set<ui32> mySpells; //all spels in this spellbook
Uint8 schoolLvls[4]; //levels of magic for different schools: [0]: air, [1]: fire, [2]: water, [3]: earth; 0 - none, 1 - beginner, 2 - medium, 3 - expert
void computeSpellsPerArea(); //recalculates spellAreas::mySpell
public:
CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * myHero); //c-tor
~CSpellWindow(); //d-tor
void fexitb();
void fadvSpellsb();
void fbattleSpellsb();
void fmanaPtsb();
void fspellsAb();
void fspellsEb();
void fspellsFb();
void fspellsWb();
void fspellsAllb();
void fLcornerb();
void fRcornerb();
void activate();
void deactivate();
void show(SDL_Surface * to = NULL);
};
#ifndef CSPELLWINDOW_H
#define CSPELLWINDOW_H
#include "../global.h"
#include "../CPlayerInterface.h"
struct SDL_Surface;
class CDefHandler;
struct SDL_Rect;
class CGHeroInstance;
class SpellbookInteractiveArea : public ClickableL, public ClickableR, public Hoverable
{
private:
boost::function<void()> onLeft;
std::string textOnRclick;
boost::function<void()> onHoverOn;
boost::function<void()> onHoverOff;
public:
void clickLeft(boost::logic::tribool down);
void clickRight(boost::logic::tribool down);
void hover(bool on);
void activate();
void deactivate();
SpellbookInteractiveArea(const SDL_Rect & myRect, boost::function<void()> funcL, const std::string & textR, boost::function<void()> funcHon, boost::function<void()> funcHoff);//c-tor
};
class CSpellWindow : public IShowActivable, public CIntObject
{
private:
class SpellArea : public ClickableL, public ClickableR, public Hoverable
{
public:
int mySpell;
CSpellWindow * owner;
SpellArea(SDL_Rect pos, CSpellWindow * owner);
void clickLeft(boost::logic::tribool down);
void clickRight(boost::logic::tribool down);
void hover(bool on);
void activate();
void deactivate();
};
SDL_Surface * background, * leftCorner, * rightCorner;
CDefHandler * spells, //pictures of spells
* spellTab, //school select
* schools, //schools' pictures
* schoolBorders [4]; //schools' 'borders': [0]: air, [1]: fire, [2]: water, [3]: earth
SpellbookInteractiveArea * exitBtn, * battleSpells, * adventureSpells, * manaPoints;
SpellbookInteractiveArea * selectSpellsA, * selectSpellsE, * selectSpellsF, * selectSpellsW, * selectSpellsAll;
SpellbookInteractiveArea * lCorner, * rCorner;
SpellArea * spellAreas[12];
CStatusBar * statusBar;
Uint8 sitesPerTabAdv[5];
Uint8 sitesPerTabBattle[5];
bool battleSpellsOnly; //if true, only battle spells are displayed; if false, only adventure map spells are displayed
Uint8 selectedTab; // 0 - air magic, 1 - fire magic, 2 - water magic, 3 - earth magic, 4 - all schools
Uint8 spellSite; //changes when corners are clicked
std::set<ui32> mySpells; //all spels in this spellbook
Uint8 schoolLvls[4]; //levels of magic for different schools: [0]: air, [1]: fire, [2]: water, [3]: earth; 0 - none, 1 - beginner, 2 - medium, 3 - expert
void computeSpellsPerArea(); //recalculates spellAreas::mySpell
public:
CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * myHero); //c-tor
~CSpellWindow(); //d-tor
void fexitb();
void fadvSpellsb();
void fbattleSpellsb();
void fmanaPtsb();
void fspellsAb();
void fspellsEb();
void fspellsFb();
void fspellsWb();
void fspellsAllb();
void fLcornerb();
void fRcornerb();
void activate();
void deactivate();
void show(SDL_Surface * to = NULL);
};
#endif //CSPELLWINDOW_H

View File

@ -1,65 +1,62 @@
#ifndef CLIENT_H
#define CLIENT_H
#ifdef _MSC_VER
#pragma once
#endif
#include "../global.h"
#include <boost/thread.hpp>
struct StartInfo;
class CGameState;
class CGameInterface;
class CConnection;
class CCallback;
class CClient;
void processCommand(const std::string &message, CClient *&client);
namespace boost
{
class mutex;
class condition_variable;
}
template <typename T>
struct CSharedCond
{
boost::mutex *mx;
boost::condition_variable *cv;
T *res;
CSharedCond(T*R)
{
res = R;
mx = new boost::mutex;
cv = new boost::condition_variable;
}
~CSharedCond()
{
delete res;
delete mx;
delete cv;
}
};
class CClient
{
CCallback *cb;
CGameState *gs;
std::map<ui8,CGameInterface *> playerint;
CConnection *serv;
void waitForMoveAndSend(int color);
public:
CClient(void);
CClient(CConnection *con, StartInfo *si);
~CClient(void);
void close();
void save(const std::string & fname);
void process(int what);
void run();
friend class CCallback; //handling players actions
friend class CScriptCallback; //for objects scripts
friend void processCommand(const std::string &message, CClient *&client); //handling console
};
#ifndef CLIENT_H
#define CLIENT_H
#include "../global.h"
#include <boost/thread.hpp>
struct StartInfo;
class CGameState;
class CGameInterface;
class CConnection;
class CCallback;
class CClient;
void processCommand(const std::string &message, CClient *&client);
namespace boost
{
class mutex;
class condition_variable;
}
template <typename T>
struct CSharedCond
{
boost::mutex *mx;
boost::condition_variable *cv;
T *res;
CSharedCond(T*R)
{
res = R;
mx = new boost::mutex;
cv = new boost::condition_variable;
}
~CSharedCond()
{
delete res;
delete mx;
delete cv;
}
};
class CClient
{
CCallback *cb;
CGameState *gs;
std::map<ui8,CGameInterface *> playerint;
CConnection *serv;
void waitForMoveAndSend(int color);
public:
CClient(void);
CClient(CConnection *con, StartInfo *si);
~CClient(void);
void close();
void save(const std::string & fname);
void process(int what);
void run();
friend class CCallback; //handling players actions
friend class CScriptCallback; //for objects scripts
friend void processCommand(const std::string &message, CClient *&client); //handling console
};
#endif //CLIENT_H

View File

@ -1,69 +1,66 @@
#ifndef GRAPHICS_H
#define GRAPHICS_H
#ifdef _MSC_VER
#pragma once
#endif
#include "../global.h"
class CDefEssential;
struct SDL_Surface;
class CGHeroInstance;
class CGTownInstance;
class CDefHandler;
class CHeroClass;
struct SDL_Color;
class Graphics
{
public:
//various graphics
SDL_Color * playerColors; //array [8]
SDL_Color * neutralColor;
SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
SDL_Surface * hInfo, *tInfo; //hero and town infobox bgs
SDL_Surface *heroInGarrison; //icon for town infobox
std::vector<std::pair<int, int> > slotsPos; //creature slot positions in infoboxes
CDefEssential *luck22, *luck30, *luck42, *luck82,
*morale22, *morale30, *morale42, *morale82,
*halls, *forts, *bigTownPic;
std::map<int,SDL_Surface*> heroWins; //hero_ID => infobox
std::map<int,SDL_Surface*> townWins; //town_ID => infobox
CDefHandler * artDefs; //artifacts
std::vector<SDL_Surface *> portraitSmall; //48x32 px portraits of heroes
std::vector<SDL_Surface *> portraitLarge; //58x64 px portraits of heroes
std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
CDefHandler * pskillsb, *resources; //82x93
CDefHandler * pskillsm; //42x42
CDefHandler * un44; //many things
CDefHandler * smallIcons, *resources32; //resources 32x32
CDefHandler * flags;
//creatures
std::map<int,SDL_Surface*> smallImgs; //creature ID -> small 32x32 img of creature; //ID=-2 is for blank (black) img; -1 for the border
std::map<int,SDL_Surface*> bigImgs; //creature ID -> big 58x64 img of creature; //ID=-2 is for blank (black) img; -1 for the border
std::map<int,SDL_Surface*> backgrounds; //castle ID -> 100x130 background creature image // -1 is for neutral
std::map<int,SDL_Surface*> backgroundsm; //castle ID -> 100x120 background creature image // -1 is for neutral
//for battles
std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle
std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
CDefHandler * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
std::vector<std::string> guildBgs;// name of bitmaps with imgs for mage guild screen
//functions
Graphics();
void initializeBattleGraphics();
void loadPaletteAndColors();
void loadHeroFlags();
void loadHeroFlags(std::pair<std::vector<CDefHandler *> Graphics::*, std::vector<const char *> > &pr, bool mode);
void loadHeroAnim(std::vector<CDefHandler **> & anims);
void loadHeroPortraits();
SDL_Surface * drawHeroInfoWin(const CGHeroInstance * curh);
SDL_Surface * drawPrimarySkill(const CGHeroInstance *curh, SDL_Surface *ret, int from=0, int to=PRIMARY_SKILLS);
SDL_Surface * drawTownInfoWin(const CGTownInstance * curh);
SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //returns small picture of town: ID=-1 - blank; -2 - border; -3 - random
void blueToPlayersAdv(SDL_Surface * sur, int player); //replaces blue interface colour with a color of player
};
extern Graphics * graphics;
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include "../global.h"
class CDefEssential;
struct SDL_Surface;
class CGHeroInstance;
class CGTownInstance;
class CDefHandler;
class CHeroClass;
struct SDL_Color;
class Graphics
{
public:
//various graphics
SDL_Color * playerColors; //array [8]
SDL_Color * neutralColor;
SDL_Color * playerColorPalette; //palette to make interface colors good - array of size [256]
SDL_Surface * hInfo, *tInfo; //hero and town infobox bgs
SDL_Surface *heroInGarrison; //icon for town infobox
std::vector<std::pair<int, int> > slotsPos; //creature slot positions in infoboxes
CDefEssential *luck22, *luck30, *luck42, *luck82,
*morale22, *morale30, *morale42, *morale82,
*halls, *forts, *bigTownPic;
std::map<int,SDL_Surface*> heroWins; //hero_ID => infobox
std::map<int,SDL_Surface*> townWins; //town_ID => infobox
CDefHandler * artDefs; //artifacts
std::vector<SDL_Surface *> portraitSmall; //48x32 px portraits of heroes
std::vector<SDL_Surface *> portraitLarge; //58x64 px portraits of heroes
std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
CDefHandler * pskillsb, *resources; //82x93
CDefHandler * pskillsm; //42x42
CDefHandler * un44; //many things
CDefHandler * smallIcons, *resources32; //resources 32x32
CDefHandler * flags;
//creatures
std::map<int,SDL_Surface*> smallImgs; //creature ID -> small 32x32 img of creature; //ID=-2 is for blank (black) img; -1 for the border
std::map<int,SDL_Surface*> bigImgs; //creature ID -> big 58x64 img of creature; //ID=-2 is for blank (black) img; -1 for the border
std::map<int,SDL_Surface*> backgrounds; //castle ID -> 100x130 background creature image // -1 is for neutral
std::map<int,SDL_Surface*> backgroundsm; //castle ID -> 100x120 background creature image // -1 is for neutral
//for battles
std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle
std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
CDefHandler * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
std::vector<std::string> guildBgs;// name of bitmaps with imgs for mage guild screen
//functions
Graphics();
void initializeBattleGraphics();
void loadPaletteAndColors();
void loadHeroFlags();
void loadHeroFlags(std::pair<std::vector<CDefHandler *> Graphics::*, std::vector<const char *> > &pr, bool mode);
void loadHeroAnim(std::vector<CDefHandler **> & anims);
void loadHeroPortraits();
SDL_Surface * drawHeroInfoWin(const CGHeroInstance * curh);
SDL_Surface * drawPrimarySkill(const CGHeroInstance *curh, SDL_Surface *ret, int from=0, int to=PRIMARY_SKILLS);
SDL_Surface * drawTownInfoWin(const CGTownInstance * curh);
SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //returns small picture of town: ID=-1 - blank; -2 - border; -3 - random
void blueToPlayersAdv(SDL_Surface * sur, int player); //replaces blue interface colour with a color of player
};
extern Graphics * graphics;
#endif //GRAPHICS_H

View File

@ -0,0 +1,5 @@
# This code depends on make tool being used
DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
ifneq (${DEPFILES},)
include ${DEPFILES}
endif

View File

@ -0,0 +1,92 @@
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# NOCDDL
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
# build
build: .build-post
.build-pre:
# Add your pre 'build' code here...
.build-post: .build-impl
# Add your post 'build' code here...
# clean
clean: .clean-post
.clean-pre:
# Add your pre 'clean' code here...
.clean-post: .clean-impl
# Add your post 'clean' code here...
# clobber
clobber: .clobber-post
.clobber-pre:
# Add your pre 'clobber' code here...
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
# all
all: .all-post
.all-pre:
# Add your pre 'all' code here...
.all-post: .all-impl
# Add your post 'all' code here...
# help
help: .help-post
.help-pre:
# Add your pre 'help' code here...
.help-post: .help-impl
# Add your post 'help' code here...
# include project implementation makefile
include nbproject/Makefile-impl.mk

View File

@ -0,0 +1,257 @@
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a -pre and a -post target defined where you can add customized code.
#
# This makefile implements configuration specific macros and targets.
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
CC=gcc
CCC=g++
CXX=g++
FC=
# Macros
PLATFORM=GNU-Linux-x86
# Include project Makefile
include Makefile
# Object Directory
OBJECTDIR=build/Debug/${PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSpellHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CLuaHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CSpellWindow.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCastleInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCursorHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CObjectHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CCreatureAnimation.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Client.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInfo.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CHeroWindow.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMessage.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPlayerInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CAbilityHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSndHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CBattleInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../mapHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPathfinder.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPreGame.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CBitmapHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Graphics.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CDefHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../AdventureMapButton.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_Extensions.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CConfigHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CAdvmapInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CThreadHelper.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CMusicHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_framerate.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCallback.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMT.o
# C Compiler Flags
CFLAGS=
# CC Compiler Flags
CCFLAGS=-D_GNU_SOURCE=1 -D_REENTRANT
CXXFLAGS=-D_GNU_SOURCE=1 -D_REENTRANT
# Fortran Compiler Flags
FFLAGS=
# Link Libraries and Options
LDLIBSOPTIONS=-L../../../../boost/lib -Wl,-rpath ../../lib/vcmi_lib/dist/Debug/GNU-Linux-x86 -L../../lib/vcmi_lib/dist/Debug/GNU-Linux-x86 -lvcmi_lib
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
${MAKE} -f nbproject/Makefile-Debug.mk dist/Debug/${PLATFORM}/vcmi_client
dist/Debug/${PLATFORM}/vcmi_client: ../../lib/vcmi_lib/dist/Debug/GNU-Linux-x86/libvcmi_lib.so
dist/Debug/${PLATFORM}/vcmi_client: ${OBJECTFILES}
${MKDIR} -p dist/Debug/${PLATFORM}
${LINK.cc} -lboost_system-gcc43-mt-1_37 -lboost_thread-gcc43-mt-1_37 -lboost_filesystem-gcc43-mt-1_37 -lSDL -lSDL_ttf -lSDL_image -lSDL_mixer -o dist/Debug/${PLATFORM}/vcmi_client ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSpellHandler.o: ../../hch/CSpellHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSpellHandler.o ../../hch/CSpellHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CLuaHandler.o: ../../CLuaHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CLuaHandler.o ../../CLuaHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CSpellWindow.o: ../CSpellWindow.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CSpellWindow.o ../CSpellWindow.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCastleInterface.o: ../../CCastleInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCastleInterface.o ../../CCastleInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCursorHandler.o: ../../CCursorHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCursorHandler.o ../../CCursorHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CObjectHandler.o: ../../hch/CObjectHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CObjectHandler.o ../../hch/CObjectHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CCreatureAnimation.o: ../CCreatureAnimation.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CCreatureAnimation.o ../CCreatureAnimation.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Client.o: ../Client.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Client.o ../Client.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInfo.o: ../../CGameInfo.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInfo.o ../../CGameInfo.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CHeroWindow.o: ../../CHeroWindow.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CHeroWindow.o ../../CHeroWindow.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMessage.o: ../../CMessage.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMessage.o ../../CMessage.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPlayerInterface.o: ../../CPlayerInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPlayerInterface.o ../../CPlayerInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CAbilityHandler.o: ../../hch/CAbilityHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CAbilityHandler.o ../../hch/CAbilityHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSndHandler.o: ../../hch/CSndHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSndHandler.o ../../hch/CSndHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CBattleInterface.o: ../../CBattleInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CBattleInterface.o ../../CBattleInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../mapHandler.o: ../../mapHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../mapHandler.o ../../mapHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPathfinder.o: ../../CPathfinder.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPathfinder.o ../../CPathfinder.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInterface.o: ../../CGameInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInterface.o ../../CGameInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPreGame.o: ../../CPreGame.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPreGame.o ../../CPreGame.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CBitmapHandler.o: ../CBitmapHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CBitmapHandler.o ../CBitmapHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Graphics.o: ../Graphics.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Graphics.o ../Graphics.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CDefHandler.o: ../../hch/CDefHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CDefHandler.o ../../hch/CDefHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../AdventureMapButton.o: ../../AdventureMapButton.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../AdventureMapButton.o ../../AdventureMapButton.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_Extensions.o: ../../SDL_Extensions.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_Extensions.o ../../SDL_Extensions.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CConfigHandler.o: ../CConfigHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CConfigHandler.o ../CConfigHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CAdvmapInterface.o: ../../CAdvmapInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CAdvmapInterface.o ../../CAdvmapInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CThreadHelper.o: ../../CThreadHelper.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CThreadHelper.o ../../CThreadHelper.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CMusicHandler.o: ../../hch/CMusicHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CMusicHandler.o ../../hch/CMusicHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_framerate.o: ../../SDL_framerate.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_framerate.o ../../SDL_framerate.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCallback.o: ../../CCallback.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCallback.o ../../CCallback.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMT.o: ../../CMT.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -g -Wall -I/usr/include/SDL -I../../../../boost/include/boost-1_37 -I.. -I../../hch -I/usr/include/lua5.1 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMT.o ../../CMT.cpp
# Subprojects
.build-subprojects:
cd ../../lib/vcmi_lib && ${MAKE} -f Makefile-nb CONF=Debug
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r build/Debug
${RM} dist/Debug/${PLATFORM}/vcmi_client
# Subprojects
.clean-subprojects:
cd ../../lib/vcmi_lib && ${MAKE} -f Makefile-nb CONF=Debug clean
# Enable dependency checking
.dep.inc: .depcheck-impl
include .dep.inc

View File

@ -0,0 +1,253 @@
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a -pre and a -post target defined where you can add customized code.
#
# This makefile implements configuration specific macros and targets.
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
CC=gcc
CCC=g++
CXX=g++
FC=
# Macros
PLATFORM=GNU-Linux-x86
# Include project Makefile
include Makefile
# Object Directory
OBJECTDIR=build/Release/${PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSpellHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CLuaHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CSpellWindow.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCastleInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCursorHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CObjectHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CCreatureAnimation.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Client.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInfo.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CHeroWindow.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMessage.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPlayerInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CAbilityHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSndHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CBattleInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../mapHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPathfinder.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPreGame.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CBitmapHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Graphics.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CDefHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../AdventureMapButton.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_Extensions.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CConfigHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CAdvmapInterface.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CThreadHelper.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CMusicHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_framerate.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCallback.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMT.o
# C Compiler Flags
CFLAGS=
# CC Compiler Flags
CCFLAGS=
CXXFLAGS=
# Fortran Compiler Flags
FFLAGS=
# Link Libraries and Options
LDLIBSOPTIONS=
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
${MAKE} -f nbproject/Makefile-Release.mk dist/Release/${PLATFORM}/vcmi_client
dist/Release/${PLATFORM}/vcmi_client: ${OBJECTFILES}
${MKDIR} -p dist/Release/${PLATFORM}
${LINK.cc} -o dist/Release/${PLATFORM}/vcmi_client ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSpellHandler.o: ../../hch/CSpellHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSpellHandler.o ../../hch/CSpellHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CLuaHandler.o: ../../CLuaHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CLuaHandler.o ../../CLuaHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CSpellWindow.o: ../CSpellWindow.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CSpellWindow.o ../CSpellWindow.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCastleInterface.o: ../../CCastleInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCastleInterface.o ../../CCastleInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCursorHandler.o: ../../CCursorHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCursorHandler.o ../../CCursorHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CObjectHandler.o: ../../hch/CObjectHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CObjectHandler.o ../../hch/CObjectHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CCreatureAnimation.o: ../CCreatureAnimation.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CCreatureAnimation.o ../CCreatureAnimation.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Client.o: ../Client.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Client.o ../Client.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInfo.o: ../../CGameInfo.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInfo.o ../../CGameInfo.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CHeroWindow.o: ../../CHeroWindow.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CHeroWindow.o ../../CHeroWindow.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMessage.o: ../../CMessage.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMessage.o ../../CMessage.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPlayerInterface.o: ../../CPlayerInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPlayerInterface.o ../../CPlayerInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CAbilityHandler.o: ../../hch/CAbilityHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CAbilityHandler.o ../../hch/CAbilityHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSndHandler.o: ../../hch/CSndHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CSndHandler.o ../../hch/CSndHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CBattleInterface.o: ../../CBattleInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CBattleInterface.o ../../CBattleInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../mapHandler.o: ../../mapHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../mapHandler.o ../../mapHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPathfinder.o: ../../CPathfinder.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPathfinder.o ../../CPathfinder.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInterface.o: ../../CGameInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CGameInterface.o ../../CGameInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPreGame.o: ../../CPreGame.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CPreGame.o ../../CPreGame.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CBitmapHandler.o: ../CBitmapHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CBitmapHandler.o ../CBitmapHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Graphics.o: ../Graphics.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../Graphics.o ../Graphics.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CDefHandler.o: ../../hch/CDefHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CDefHandler.o ../../hch/CDefHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../AdventureMapButton.o: ../../AdventureMapButton.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../AdventureMapButton.o ../../AdventureMapButton.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_Extensions.o: ../../SDL_Extensions.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_Extensions.o ../../SDL_Extensions.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CConfigHandler.o: ../CConfigHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../CConfigHandler.o ../CConfigHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CAdvmapInterface.o: ../../CAdvmapInterface.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CAdvmapInterface.o ../../CAdvmapInterface.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CThreadHelper.o: ../../CThreadHelper.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CThreadHelper.o ../../CThreadHelper.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CMusicHandler.o: ../../hch/CMusicHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CMusicHandler.o ../../hch/CMusicHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_framerate.o: ../../SDL_framerate.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../SDL_framerate.o ../../SDL_framerate.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCallback.o: ../../CCallback.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CCallback.o ../../CCallback.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMT.o: ../../CMT.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../..
${RM} $@.d
$(COMPILE.cc) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/client/vcmi_client/../../CMT.o ../../CMT.cpp
# Subprojects
.build-subprojects:
# Clean Targets
.clean-conf:
${RM} -r build/Release
${RM} dist/Release/${PLATFORM}/vcmi_client
# Subprojects
.clean-subprojects:
# Enable dependency checking
.dep.inc: .depcheck-impl
include .dep.inc

View File

@ -0,0 +1,123 @@
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a pre- and a post- target defined where you can add customization code.
#
# This makefile implements macros and targets common to all configurations.
#
# NOCDDL
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
# and .clean-reqprojects-conf unless SUB has the value 'no'
SUB_no=NO
SUBPROJECTS=${SUB_${SUB}}
BUILD_SUBPROJECTS_=.build-subprojects
BUILD_SUBPROJECTS_NO=
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
CLEAN_SUBPROJECTS_=.clean-subprojects
CLEAN_SUBPROJECTS_NO=
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
# Project Name
PROJECTNAME=vcmi_client
# Active Configuration
DEFAULTCONF=Debug
CONF=${DEFAULTCONF}
# All Configurations
ALLCONFS=Debug Release
# build
.build-impl: .build-pre .validate-impl .depcheck-impl
@#echo "=> Running $@... Configuration=$(CONF)"
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
# clean
.clean-impl: .clean-pre .validate-impl .depcheck-impl
@#echo "=> Running $@... Configuration=$(CONF)"
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
# clobber
.clobber-impl: .clobber-pre .depcheck-impl
@#echo "=> Running $@..."
for CONF in ${ALLCONFS}; \
do \
${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
done
# all
.all-impl: .all-pre .depcheck-impl
@#echo "=> Running $@..."
for CONF in ${ALLCONFS}; \
do \
${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
done
# dependency checking support
.depcheck-impl:
@echo "# This code depends on make tool being used" >.dep.inc
@if [ -n "${MAKE_VERSION}" ]; then \
echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
echo "include \$${DEPFILES}" >>.dep.inc; \
echo "endif" >>.dep.inc; \
else \
echo ".KEEP_STATE:" >>.dep.inc; \
echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
fi
# configuration validation
.validate-impl:
@if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
then \
echo ""; \
echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
echo "See 'make help' for details."; \
echo "Current directory: " `pwd`; \
echo ""; \
fi
@if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
then \
exit 1; \
fi
# help
.help-impl: .help-pre
@echo "This makefile supports the following configurations:"
@echo " ${ALLCONFS}"
@echo ""
@echo "and the following targets:"
@echo " build (default target)"
@echo " clean"
@echo " clobber"
@echo " all"
@echo " help"
@echo ""
@echo "Makefile Usage:"
@echo " make [CONF=<CONFIGURATION>] [SUB=no] build"
@echo " make [CONF=<CONFIGURATION>] [SUB=no] clean"
@echo " make [SUB=no] clobber"
@echo " make [SUB=no] all"
@echo " make help"
@echo ""
@echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
@echo " also build subprojects."
@echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
@echo " also clean subprojects."
@echo "Target 'clobber' will remove all built files from all configurations and,"
@echo " unless 'SUB=no', also from subprojects."
@echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
@echo " also build subprojects."
@echo "Target 'help' prints this message."
@echo ""

View File

@ -0,0 +1,72 @@
#!/bin/bash -x
#
# Generated - do not edit!
#
# Macros
TOP=`pwd`
PLATFORM=GNU-Linux-x86
TMPDIR=build/Debug/${PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/Debug/${PLATFORM}/vcmi_client
OUTPUT_BASENAME=vcmi_client
PACKAGE_TOP_DIR=vcmiclient/
# Functions
function checkReturnCode
{
rc=$?
if [ $rc != 0 ]
then
exit $rc
fi
}
function makeDirectory
# $1 directory path
# $2 permission (optional)
{
mkdir -p "$1"
checkReturnCode
if [ "$2" != "" ]
then
chmod $2 "$1"
checkReturnCode
fi
}
function copyFileToTmpDir
# $1 from-file path
# $2 to-file path
# $3 permission
{
cp "$1" "$2"
checkReturnCode
if [ "$3" != "" ]
then
chmod $3 "$2"
checkReturnCode
fi
}
# Setup
cd "${TOP}"
mkdir -p dist/Debug/${PLATFORM}/package
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}
# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/vcmiclient/bin
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
# Generate tar file
cd "${TOP}"
rm -f dist/Debug/${PLATFORM}/package/vcmiclient.tar
cd ${TMPDIR}
tar -vcf ../../../../dist/Debug/${PLATFORM}/package/vcmiclient.tar *
checkReturnCode
# Cleanup
cd "${TOP}"
rm -rf ${TMPDIR}

View File

@ -0,0 +1,72 @@
#!/bin/bash -x
#
# Generated - do not edit!
#
# Macros
TOP=`pwd`
PLATFORM=GNU-Linux-x86
TMPDIR=build/Release/${PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/Release/${PLATFORM}/vcmi_client
OUTPUT_BASENAME=vcmi_client
PACKAGE_TOP_DIR=vcmiclient/
# Functions
function checkReturnCode
{
rc=$?
if [ $rc != 0 ]
then
exit $rc
fi
}
function makeDirectory
# $1 directory path
# $2 permission (optional)
{
mkdir -p "$1"
checkReturnCode
if [ "$2" != "" ]
then
chmod $2 "$1"
checkReturnCode
fi
}
function copyFileToTmpDir
# $1 from-file path
# $2 to-file path
# $3 permission
{
cp "$1" "$2"
checkReturnCode
if [ "$3" != "" ]
then
chmod $3 "$2"
checkReturnCode
fi
}
# Setup
cd "${TOP}"
mkdir -p dist/Release/${PLATFORM}/package
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}
# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/vcmiclient/bin
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
# Generate tar file
cd "${TOP}"
rm -f dist/Release/${PLATFORM}/package/vcmiclient.tar
cd ${TMPDIR}
tar -vcf ../../../../dist/Release/${PLATFORM}/package/vcmiclient.tar *
checkReturnCode
# Cleanup
cd "${TOP}"
rm -rf ${TMPDIR}

View File

@ -0,0 +1,595 @@
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="51">
<logicalFolder name="root" displayName="root" projectFiles="true">
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>../../AdventureMapButton.h</itemPath>
<itemPath>../../AI_Base.h</itemPath>
<itemPath>../../hch/CAbilityHandler.h</itemPath>
<itemPath>../../CAdvmapInterface.h</itemPath>
<itemPath>../../hch/CAmbarCendamo.h</itemPath>
<itemPath>../../hch/CArtHandler.h</itemPath>
<itemPath>../../CBattleInterface.h</itemPath>
<itemPath>../CBitmapHandler.h</itemPath>
<itemPath>../../hch/CBuildingHandler.h</itemPath>
<itemPath>../../CCallback.h</itemPath>
<itemPath>../../CCastleInterface.h</itemPath>
<itemPath>../CConfigHandler.h</itemPath>
<itemPath>../CCreatureAnimation.h</itemPath>
<itemPath>../../CCursorHandler.h</itemPath>
<itemPath>../../hch/CDefHandler.h</itemPath>
<itemPath>../../CGameInfo.h</itemPath>
<itemPath>../../CGameInterface.h</itemPath>
<itemPath>../../hch/CHeroHandler.h</itemPath>
<itemPath>../../CHeroWindow.h</itemPath>
<itemPath>../Client.h</itemPath>
<itemPath>../../CLuaHandler.h</itemPath>
<itemPath>../../CMessage.h</itemPath>
<itemPath>../../hch/CMusicHandler.h</itemPath>
<itemPath>../../hch/CObjectHandler.h</itemPath>
<itemPath>../../CPathfinder.h</itemPath>
<itemPath>../../CPlayerInterface.h</itemPath>
<itemPath>../../CPreGame.h</itemPath>
<itemPath>../../hch/CSndHandler.h</itemPath>
<itemPath>../CSpellWindow.h</itemPath>
<itemPath>../../CThreadHelper.h</itemPath>
<itemPath>../FunctionList.h</itemPath>
<itemPath>../../global.h</itemPath>
<itemPath>../Graphics.h</itemPath>
<itemPath>../../int3.h</itemPath>
<itemPath>../../map.h</itemPath>
<itemPath>../../mapHandler.h</itemPath>
<itemPath>../../nodrze.h</itemPath>
<itemPath>../../SDL_framerate.h</itemPath>
<itemPath>../../StartInfo.h</itemPath>
<itemPath>../../stdafx.h</itemPath>
<itemPath>../../timeHandler.h</itemPath>
</logicalFolder>
<logicalFolder name="ResourceFiles"
displayName="Resource Files"
projectFiles="true">
</logicalFolder>
<logicalFolder name="SourceFiles"
displayName="Source Files"
projectFiles="true">
<itemPath>../../AdventureMapButton.cpp</itemPath>
<itemPath>../../hch/CAbilityHandler.cpp</itemPath>
<itemPath>../../CAdvmapInterface.cpp</itemPath>
<itemPath>../../CBattleInterface.cpp</itemPath>
<itemPath>../CBitmapHandler.cpp</itemPath>
<itemPath>../../CCallback.cpp</itemPath>
<itemPath>../../CCastleInterface.cpp</itemPath>
<itemPath>../CConfigHandler.cpp</itemPath>
<itemPath>../CCreatureAnimation.cpp</itemPath>
<itemPath>../../CCursorHandler.cpp</itemPath>
<itemPath>../../hch/CDefHandler.cpp</itemPath>
<itemPath>../../CGameInfo.cpp</itemPath>
<itemPath>../../CGameInterface.cpp</itemPath>
<itemPath>../../CHeroWindow.cpp</itemPath>
<itemPath>../Client.cpp</itemPath>
<itemPath>../../CLuaHandler.cpp</itemPath>
<itemPath>../../CMessage.cpp</itemPath>
<itemPath>../../CMT.cpp</itemPath>
<itemPath>../../hch/CMusicHandler.cpp</itemPath>
<itemPath>../../hch/CObjectHandler.cpp</itemPath>
<itemPath>../../CPathfinder.cpp</itemPath>
<itemPath>../../CPlayerInterface.cpp</itemPath>
<itemPath>../../CPreGame.cpp</itemPath>
<itemPath>../../hch/CSndHandler.cpp</itemPath>
<itemPath>../../hch/CSpellHandler.cpp</itemPath>
<itemPath>../CSpellWindow.cpp</itemPath>
<itemPath>../../CThreadHelper.cpp</itemPath>
<itemPath>../Graphics.cpp</itemPath>
<itemPath>../../mapHandler.cpp</itemPath>
<itemPath>../../SDL_Extensions.cpp</itemPath>
<itemPath>../../SDL_framerate.cpp</itemPath>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false">
<itemPath>Makefile</itemPath>
</logicalFolder>
</logicalFolder>
<sourceRootList>
<Elem>..</Elem>
</sourceRootList>
<projectmakefile>Makefile</projectmakefile>
<confs>
<conf name="Debug" type="1">
<toolsSet>
<developmentServer>localhost</developmentServer>
<compilerSet>GNU|GNU</compilerSet>
<platform>2</platform>
</toolsSet>
<compileType>
<ccCompilerTool>
<includeDirectories>
<directoryPath>/usr/include/SDL</directoryPath>
<directoryPath>../../../../boost/include/boost-1_37</directoryPath>
<directoryPath>..</directoryPath>
<directoryPath>../../hch</directoryPath>
<directoryPath>/usr/include/lua5.1</directoryPath>
</includeDirectories>
<commandLine>-D_GNU_SOURCE=1 -D_REENTRANT</commandLine>
<warningLevel>2</warningLevel>
</ccCompilerTool>
<linkerTool>
<output>dist/Debug/${PLATFORM}/vcmi_client</output>
<linkerAddLib>
<directoryPath>../../../../boost/lib</directoryPath>
</linkerAddLib>
<linkerLibItems>
<linkerLibProjectItem>
<makeArtifact PL="../../lib/vcmi_lib"
CT="2"
CN="Debug"
AC="true"
BL="true"
WD="../../lib/vcmi_lib"
BC="${MAKE} -f Makefile-nb CONF=Debug"
CC="${MAKE} -f Makefile-nb CONF=Debug clean"
OP="dist/Debug/GNU-Linux-x86/libvcmi_lib.so">
</makeArtifact>
</linkerLibProjectItem>
</linkerLibItems>
<commandLine>-lboost_system-gcc43-mt-1_37 -lboost_thread-gcc43-mt-1_37 -lboost_filesystem-gcc43-mt-1_37 -lSDL -lSDL_ttf -lSDL_image -lSDL_mixer</commandLine>
</linkerTool>
</compileType>
<item path="../../AI_Base.h">
<itemTool>3</itemTool>
</item>
<item path="../../AdventureMapButton.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../AdventureMapButton.h">
<itemTool>3</itemTool>
</item>
<item path="../../CAdvmapInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CAdvmapInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CBattleInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CBattleInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CCallback.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CCallback.h">
<itemTool>3</itemTool>
</item>
<item path="../../CCastleInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CCastleInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CCursorHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CCursorHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../CGameInfo.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CGameInfo.h">
<itemTool>3</itemTool>
</item>
<item path="../../CGameInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CGameInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CHeroWindow.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CHeroWindow.h">
<itemTool>3</itemTool>
</item>
<item path="../../CLuaHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CLuaHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../CMT.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CMessage.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CMessage.h">
<itemTool>3</itemTool>
</item>
<item path="../../CPathfinder.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CPathfinder.h">
<itemTool>3</itemTool>
</item>
<item path="../../CPlayerInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CPlayerInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CPreGame.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CPreGame.h">
<itemTool>3</itemTool>
</item>
<item path="../../CThreadHelper.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CThreadHelper.h">
<itemTool>3</itemTool>
</item>
<item path="../../SDL_Extensions.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../SDL_framerate.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../SDL_framerate.h">
<itemTool>3</itemTool>
</item>
<item path="../../StartInfo.h">
<itemTool>3</itemTool>
</item>
<item path="../../global.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CAbilityHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CAbilityHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CAmbarCendamo.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CArtHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CBuildingHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CDefHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CDefHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CHeroHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CMusicHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CMusicHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CObjectHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CObjectHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CSndHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CSndHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CSpellHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../int3.h">
<itemTool>3</itemTool>
</item>
<item path="../../map.h">
<itemTool>3</itemTool>
</item>
<item path="../../mapHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../mapHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../nodrze.h">
<itemTool>3</itemTool>
</item>
<item path="../../stdafx.h">
<itemTool>3</itemTool>
</item>
<item path="../../timeHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../CBitmapHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CBitmapHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../CConfigHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CConfigHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../CCreatureAnimation.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CCreatureAnimation.h">
<itemTool>3</itemTool>
</item>
<item path="../CSpellWindow.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CSpellWindow.h">
<itemTool>3</itemTool>
</item>
<item path="../Client.cpp">
<itemTool>1</itemTool>
</item>
<item path="../Client.h">
<itemTool>3</itemTool>
</item>
<item path="../FunctionList.h">
<itemTool>3</itemTool>
</item>
<item path="../Graphics.cpp">
<itemTool>1</itemTool>
</item>
<item path="../Graphics.h">
<itemTool>3</itemTool>
</item>
</conf>
<conf name="Release" type="1">
<toolsSet>
<developmentServer>localhost</developmentServer>
<compilerSet>GNU|GNU</compilerSet>
<platform>2</platform>
</toolsSet>
<compileType>
<cCompilerTool>
<developmentMode>5</developmentMode>
</cCompilerTool>
<ccCompilerTool>
<developmentMode>5</developmentMode>
</ccCompilerTool>
<fortranCompilerTool>
<developmentMode>5</developmentMode>
</fortranCompilerTool>
<linkerTool>
<linkerLibItems>
</linkerLibItems>
</linkerTool>
</compileType>
<item path="../../AI_Base.h">
<itemTool>3</itemTool>
</item>
<item path="../../AdventureMapButton.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../AdventureMapButton.h">
<itemTool>3</itemTool>
</item>
<item path="../../CAdvmapInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CAdvmapInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CBattleInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CBattleInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CCallback.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CCallback.h">
<itemTool>3</itemTool>
</item>
<item path="../../CCastleInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CCastleInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CCursorHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CCursorHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../CGameInfo.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CGameInfo.h">
<itemTool>3</itemTool>
</item>
<item path="../../CGameInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CGameInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CHeroWindow.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CHeroWindow.h">
<itemTool>3</itemTool>
</item>
<item path="../../CLuaHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CLuaHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../CMT.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CMessage.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CMessage.h">
<itemTool>3</itemTool>
</item>
<item path="../../CPathfinder.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CPathfinder.h">
<itemTool>3</itemTool>
</item>
<item path="../../CPlayerInterface.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CPlayerInterface.h">
<itemTool>3</itemTool>
</item>
<item path="../../CPreGame.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CPreGame.h">
<itemTool>3</itemTool>
</item>
<item path="../../CThreadHelper.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../CThreadHelper.h">
<itemTool>3</itemTool>
</item>
<item path="../../SDL_Extensions.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../SDL_framerate.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../SDL_framerate.h">
<itemTool>3</itemTool>
</item>
<item path="../../StartInfo.h">
<itemTool>3</itemTool>
</item>
<item path="../../global.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CAbilityHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CAbilityHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CAmbarCendamo.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CArtHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CBuildingHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CDefHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CDefHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CHeroHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CMusicHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CMusicHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CObjectHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CObjectHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CSndHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../hch/CSndHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../hch/CSpellHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../int3.h">
<itemTool>3</itemTool>
</item>
<item path="../../map.h">
<itemTool>3</itemTool>
</item>
<item path="../../mapHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../../mapHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../../nodrze.h">
<itemTool>3</itemTool>
</item>
<item path="../../stdafx.h">
<itemTool>3</itemTool>
</item>
<item path="../../timeHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../CBitmapHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CBitmapHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../CConfigHandler.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CConfigHandler.h">
<itemTool>3</itemTool>
</item>
<item path="../CCreatureAnimation.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CCreatureAnimation.h">
<itemTool>3</itemTool>
</item>
<item path="../CSpellWindow.cpp">
<itemTool>1</itemTool>
</item>
<item path="../CSpellWindow.h">
<itemTool>3</itemTool>
</item>
<item path="../Client.cpp">
<itemTool>1</itemTool>
</item>
<item path="../Client.h">
<itemTool>3</itemTool>
</item>
<item path="../FunctionList.h">
<itemTool>3</itemTool>
</item>
<item path="../Graphics.cpp">
<itemTool>1</itemTool>
</item>
<item path="../Graphics.h">
<itemTool>3</itemTool>
</item>
</conf>
</confs>
</configurationDescriptor>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="51">
<projectmakefile>Makefile</projectmakefile>
<defaultConf>0</defaultConf>
<confs>
<conf name="Debug" type="1">
<gdbdebugger version="2">
<gdb_command>gdb</gdb_command>
<array_repeat_threshold>10</array_repeat_threshold>
</gdbdebugger>
<runprofile version="5">
<args></args>
<rundir></rundir>
<buildfirst>true</buildfirst>
<console-type>0</console-type>
<terminal-type>0</terminal-type>
<environment>
</environment>
</runprofile>
</conf>
<conf name="Release" type="1">
<gdbdebugger version="2">
<gdb_command>gdb</gdb_command>
<array_repeat_threshold>10</array_repeat_threshold>
</gdbdebugger>
<runprofile version="5">
<args></args>
<rundir></rundir>
<buildfirst>true</buildfirst>
<console-type>0</console-type>
<terminal-type>0</terminal-type>
<environment>
</environment>
</runprofile>
</conf>
</confs>
</configurationDescriptor>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1">
<file>
<url>file:/home/t0/vcmi/trunk/client/vcmi_client/../../hch/CMusicHandler.cpp</url>
<line>67</line>
</file>
<file>
<url>file:/home/t0/vcmi/trunk/CPreGame.h</url>
<line>272</line>
</file>
<file>
<url>file:/home/t0/vcmi/trunk/client/vcmi_client/../CSpellWindow.cpp</url>
<line>638</line>
</file>
<file>
<url>file:/home/t0/vcmi/trunk/client/vcmi_client/../../CBattleInterface.cpp</url>
<line>1754</line>
<line>2257</line>
</file>
<file>
<url>file:/home/t0/vcmi/trunk/CMessage.cpp</url>
<line>103</line>
</file>
</editor-bookmarks>
</project-private>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.cnd.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>vcmi_client</name>
<make-project-type>0</make-project-type>
<c-extensions/>
<cpp-extensions>cpp</cpp-extensions>
<header-extensions>h</header-extensions>
<sourceEncoding>UTF-8</sourceEncoding>
<make-dep-projects>
<make-dep-project>../../lib/vcmi_lib</make-dep-project>
</make-dep-projects>
</data>
</configuration>
</project>

View File

@ -1,58 +1,58 @@
#ifndef COBJINFOECTHANDLER_H
#define COBJINFOECTHANDLER_H
#include <vector>
#include <map>
#include "../global.h"
class CDefHandler;
class CLodHandler;
class DLL_EXPORT CGDefInfo
{
public:
std::string name;
unsigned char visitMap[6];
unsigned char blockMap[6];
unsigned char visitDir; //directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
int id, subid; //of object described by this defInfo
int terrainAllowed, //on which terrain it is possible to place object
terrainMenu; //in which menus in map editor object will be showed
int width, height; //tiles
int type; //(0- ground, 1- towns, 2-creatures, 3- heroes, 4-artifacts, 5- resources)
CDefHandler * handler;
int printPriority;
bool isVisitable();
bool operator<(const CGDefInfo& por)
{
if(id!=por.id)
return id<por.id;
else
return subid<por.subid;
}
template <typename Handler> void serialize(Handler &h, const int version)
{
h & name & visitMap & blockMap & visitDir & id & subid &terrainAllowed & terrainMenu & width & height & type & printPriority;
}
CGDefInfo();
};
class DLL_EXPORT CDefObjInfoHandler
{
public:
std::map<int,std::map<int,CGDefInfo*> > gobjs;
std::map<int,CGDefInfo*> castles;
//std::vector<DefObjInfo> objs;
void load();
template <typename Handler> void serialize(Handler &h, const int version)
{
h & gobjs;
if(!h.saving) //recrete castles map
for(std::map<int,std::map<int,CGDefInfo*> >::iterator i=gobjs.begin(); i!=gobjs.end(); i++)
for(std::map<int,CGDefInfo*>::iterator j=i->second.begin(); j!=i->second.end(); j++)
if(j->second->id == 98)
castles[j->second->subid]=j->second;
}
};
#endif //COBJINFOECTHANDLER_H
#ifndef __CDEFOBJINFOHANDLER_H__
#define __CDEFOBJINFOHANDLER_H__
#include <vector>
#include <map>
#include "../global.h"
class CDefHandler;
class CLodHandler;
class DLL_EXPORT CGDefInfo
{
public:
std::string name;
unsigned char visitMap[6];
unsigned char blockMap[6];
unsigned char visitDir; //directions from which object can be entered, format same as for moveDir in CGHeroInstance(but 0 - 7)
int id, subid; //of object described by this defInfo
int terrainAllowed, //on which terrain it is possible to place object
terrainMenu; //in which menus in map editor object will be showed
int width, height; //tiles
int type; //(0- ground, 1- towns, 2-creatures, 3- heroes, 4-artifacts, 5- resources)
CDefHandler * handler;
int printPriority;
bool isVisitable();
bool operator<(const CGDefInfo& por)
{
if(id!=por.id)
return id<por.id;
else
return subid<por.subid;
}
template <typename Handler> void serialize(Handler &h, const int version)
{
h & name & visitMap & blockMap & visitDir & id & subid &terrainAllowed & terrainMenu & width & height & type & printPriority;
}
CGDefInfo();
};
class DLL_EXPORT CDefObjInfoHandler
{
public:
std::map<int,std::map<int,CGDefInfo*> > gobjs;
std::map<int,CGDefInfo*> castles;
//std::vector<DefObjInfo> objs;
void load();
template <typename Handler> void serialize(Handler &h, const int version)
{
h & gobjs;
if(!h.saving) //recrete castles map
for(std::map<int,std::map<int,CGDefInfo*> >::iterator i=gobjs.begin(); i!=gobjs.end(); i++)
for(std::map<int,CGDefInfo*>::iterator j=i->second.begin(); j!=i->second.end(); j++)
if(j->second->id == 98)
castles[j->second->subid]=j->second;
}
};
#endif // __CDEFOBJINFOHANDLER_H__

View File

@ -1,150 +1,150 @@
#ifndef CVIDEOHANDLEER_H
#define CVIDEOHANDLEER_H
#include <stdio.h>
#ifdef WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif
//
#define BINKNOTHREADEDIO 0x00800000
//
// protected
// FLib: HINST;
// FLibName: string;
// FFileHandle: HFile;
// function GetCurrentFrame: int; virtual; abstract;
// function GetFramesCount: int; virtual; abstract;
// procedure SetCurrentFrame(v: int); virtual; abstract;
// procedure DoOpen(FileHandle: hFile); virtual; abstract;
// function NormalizeFrame(i:int):int;
// procedure SetPause(v:Boolean); virtual; abstract;
//
// procedure LoadProc(var Proc:Pointer; const ProcName:string);
// public
// Width:pint;
// Height:pint;
// constructor Create(const LibName:string);
// destructor Destroy; override;
// procedure Open(FileHandle:hFile); overload;
// procedure Open(FileName:string); overload;
//// procedure Open(FileData:TRSByteArray); overload;
// procedure SetVolume(i: int); virtual;
// procedure Close; virtual;
// procedure NextFrame; virtual; abstract;
// procedure PreparePic(b:TBitmap); virtual;
// procedure GotoFrame(Index:int; b:TBitmap); virtual;
// function ExtractFrame(b:TBitmap = nil):TBitmap; virtual; abstract;
// function Wait:Boolean; virtual; abstract;
// // Workaround for Bink and Smack thread synchronization bug
// property Frame: int read GetCurrentFrame write SetCurrentFrame;
// property FramesCount: int read GetFramesCount;
// property LibInstance: HINST read FLib;
// property Pause: Boolean write SetPause;
//TRSSmkStruct = packed record
// Version: int;
// Width: int;
// Height: int;
// FrameCount: int;
// mspf: int;
// Unk1: array[0..87] of byte;
// Palette: array[0..775] of byte;
// CurrentFrame: int; // Starting with 0
// // 72 - Øèï
// // 1060 - interesting
// // 1100 - Mute:Bool
//end;
//TRSBinkStruct = packed record
// Width: int;
// Height: int;
// FrameCount: int;
// CurrentFrame: int; // Starting with 1
// LastFrame: int;
// FPSMul: int; // frames/second multiplier
// FPSDiv: int; // frames/second divisor
// Unk1: int;
// Flags: int;
// Unk2: array[0..259] of byte;
// CurrentPlane: int;
// Plane1: ptr;
// Plane2: ptr;
// Unk3: array[0..1] of int;
// YPlaneWidth: int;
// YPlaneHeight: int;
// UVPlaneWidth: int;
// UVPlaneHeight: int;
//end;
typedef struct
{
int width;
int height;
int frameCount;
int currentFrame;
int lastFrame;
int FPSMul;
int FPSDiv;
int unknown0;
unsigned char flags;
unsigned char unknown1[260];
int CurPlane; // current plane
void *plane0; // pointer to plane 0
void *plane1; // pointer to plane 1
int unknown2;
int unknown3;
int yWidth; // Y plane width
int yHeight; // Y plane height
int uvWidth; // U&V plane width
int uvHeight; // U&V plane height
int d,e,f,g,h,i;
} BINK_STRUCT, *HBINK;
struct SMKStruct
{
int version, width, height, frameCount, mspf, currentFrame;
unsigned char unk1[88], palette[776];
};
class DLLHandler
{
public:
#if !defined(__amigaos4__) && !defined(__unix__)
HINSTANCE dll;
#else
void *dll;
#endif
void Instantiate(const char *filename);
const char *GetLibExtension();
void *FindAddress234(const char *symbol);
virtual ~DLLHandler();
};
class CBIKHandler
{
public:
DLLHandler ourLib;
int newmode;
#if !defined(__amigaos4__) && !defined(__unix__)
HANDLE hBinkFile;
#else
void *hBinkFile;
#endif
HBINK hBink;
BINK_STRUCT data;
unsigned char * buffer;
void * waveOutOpen, * BinkGetError, *BinkOpen, *BinkSetSoundSystem ;
int width, height;
CBIKHandler();
void open(std::string name);
void close();
};
#endif //CVIDEOHANDLEER_H
#ifndef __CVIDEOHANDLER_H__
#define __CVIDEOHANDLER_H__
#include <stdio.h>
#ifdef WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif
//
#define BINKNOTHREADEDIO 0x00800000
//
// protected
// FLib: HINST;
// FLibName: string;
// FFileHandle: HFile;
// function GetCurrentFrame: int; virtual; abstract;
// function GetFramesCount: int; virtual; abstract;
// procedure SetCurrentFrame(v: int); virtual; abstract;
// procedure DoOpen(FileHandle: hFile); virtual; abstract;
// function NormalizeFrame(i:int):int;
// procedure SetPause(v:Boolean); virtual; abstract;
//
// procedure LoadProc(var Proc:Pointer; const ProcName:string);
// public
// Width:pint;
// Height:pint;
// constructor Create(const LibName:string);
// destructor Destroy; override;
// procedure Open(FileHandle:hFile); overload;
// procedure Open(FileName:string); overload;
//// procedure Open(FileData:TRSByteArray); overload;
// procedure SetVolume(i: int); virtual;
// procedure Close; virtual;
// procedure NextFrame; virtual; abstract;
// procedure PreparePic(b:TBitmap); virtual;
// procedure GotoFrame(Index:int; b:TBitmap); virtual;
// function ExtractFrame(b:TBitmap = nil):TBitmap; virtual; abstract;
// function Wait:Boolean; virtual; abstract;
// // Workaround for Bink and Smack thread synchronization bug
// property Frame: int read GetCurrentFrame write SetCurrentFrame;
// property FramesCount: int read GetFramesCount;
// property LibInstance: HINST read FLib;
// property Pause: Boolean write SetPause;
//TRSSmkStruct = packed record
// Version: int;
// Width: int;
// Height: int;
// FrameCount: int;
// mspf: int;
// Unk1: array[0..87] of byte;
// Palette: array[0..775] of byte;
// CurrentFrame: int; // Starting with 0
// // 72 - Øèï
// // 1060 - interesting
// // 1100 - Mute:Bool
//end;
//TRSBinkStruct = packed record
// Width: int;
// Height: int;
// FrameCount: int;
// CurrentFrame: int; // Starting with 1
// LastFrame: int;
// FPSMul: int; // frames/second multiplier
// FPSDiv: int; // frames/second divisor
// Unk1: int;
// Flags: int;
// Unk2: array[0..259] of byte;
// CurrentPlane: int;
// Plane1: ptr;
// Plane2: ptr;
// Unk3: array[0..1] of int;
// YPlaneWidth: int;
// YPlaneHeight: int;
// UVPlaneWidth: int;
// UVPlaneHeight: int;
//end;
typedef struct
{
int width;
int height;
int frameCount;
int currentFrame;
int lastFrame;
int FPSMul;
int FPSDiv;
int unknown0;
unsigned char flags;
unsigned char unknown1[260];
int CurPlane; // current plane
void *plane0; // pointer to plane 0
void *plane1; // pointer to plane 1
int unknown2;
int unknown3;
int yWidth; // Y plane width
int yHeight; // Y plane height
int uvWidth; // U&V plane width
int uvHeight; // U&V plane height
int d,e,f,g,h,i;
} BINK_STRUCT, *HBINK;
struct SMKStruct
{
int version, width, height, frameCount, mspf, currentFrame;
unsigned char unk1[88], palette[776];
};
class DLLHandler
{
public:
#if !defined(__amigaos4__) && !defined(__unix__)
HINSTANCE dll;
#else
void *dll;
#endif
void Instantiate(const char *filename);
const char *GetLibExtension();
void *FindAddress234(const char *symbol);
virtual ~DLLHandler();
};
class CBIKHandler
{
public:
DLLHandler ourLib;
int newmode;
#if !defined(__amigaos4__) && !defined(__unix__)
HANDLE hBinkFile;
#else
void *hBinkFile;
#endif
HBINK hBink;
BINK_STRUCT data;
unsigned char * buffer;
void * waveOutOpen, * BinkGetError, *BinkOpen, *BinkSetSoundSystem ;
int width, height;
CBIKHandler();
void open(std::string name);
void close();
};
#endif // __CVIDEOHANDLER_H__

View File

@ -1,13 +1,14 @@
#pragma once
struct BattleAction
{
ui8 side; //who made this action: false - left, true - right player
ui32 stackNumber;//stack ID, -1 left hero, -2 right hero,
ui8 actionType; // 0 = Cancel BattleAction 1 = Hero cast a spell 2 = Walk 3 = Defend 4 = Retreat from the battle 5 = Surrender 6 = Walk and Attack 7 = Shoot 8 = Wait 9 = Catapult 10 = Monster casts a spell (i.e. Faerie Dragons)
ui16 destinationTile;
si32 additionalInfo; // e.g. spell number if type is 1 || 10; tile to attack if type is 6
template <typename Handler> void serialize(Handler &h, const int version)
{
h & side & stackNumber & actionType & destinationTile & additionalInfo;
}
};
#ifndef __BATTLEACTION_H__
#define __BATTLEACTION_H__
struct BattleAction
{
ui8 side; //who made this action: false - left, true - right player
ui32 stackNumber;//stack ID, -1 left hero, -2 right hero,
ui8 actionType; // 0 = Cancel BattleAction 1 = Hero cast a spell 2 = Walk 3 = Defend 4 = Retreat from the battle 5 = Surrender 6 = Walk and Attack 7 = Shoot 8 = Wait 9 = Catapult 10 = Monster casts a spell (i.e. Faerie Dragons)
ui16 destinationTile;
si32 additionalInfo; // e.g. spell number if type is 1 || 10; tile to attack if type is 6
template <typename Handler> void serialize(Handler &h, const int version)
{
h & side & stackNumber & actionType & destinationTile & additionalInfo;
}
};#endif // __BATTLEACTION_H__

View File

@ -1,13 +1,14 @@
#pragma once
#include <boost/thread.hpp>
template <typename T> struct CondSh
{
T data;
boost::condition_variable cond;
boost::mutex mx;
CondSh(){};
CondSh(T t){data = t;};
void set(T t){mx.lock();data=t;mx.unlock();}; //set data
void setn(T t){mx.lock();data=t;mx.unlock();cond.notify_all();}; //set data and notify
T get(){boost::unique_lock<boost::mutex> lock(mx); return data;};
};
#ifndef __CONDSH_H__
#define __CONDSH_H__
#include <boost/thread.hpp>
template <typename T> struct CondSh
{
T data;
boost::condition_variable cond;
boost::mutex mx;
CondSh(){};
CondSh(T t){data = t;};
void set(T t){mx.lock();data=t;mx.unlock();}; //set data
void setn(T t){mx.lock();data=t;mx.unlock();cond.notify_all();}; //set data and notify
T get(){boost::unique_lock<boost::mutex> lock(mx); return data;};
};#endif // __CONDSH_H__

View File

@ -1,417 +1,416 @@
#ifndef CONNECTION_H
#define CONNECTION_H
#pragma once
#include "../global.h"
#include <string>
#include <vector>
#include <set>
#include <boost/type_traits/is_fundamental.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_array.hpp>
const int version = 63;
class CConnection;
namespace mpl = boost::mpl;
namespace boost
{
namespace asio
{
namespace ip
{
class tcp;
}
class io_service;
template <typename Protocol> class stream_socket_service;
template <typename Protocol,typename StreamSocketService>
class basic_stream_socket;
template <typename Protocol> class socket_acceptor_service;
template <typename Protocol,typename SocketAcceptorService>
class basic_socket_acceptor;
}
class mutex;
};
enum SerializationLvl
{
Wrong=0,
Primitive,
Pointer,
Serializable
};
template<typename Ser,typename T>
struct SavePrimitive
{
static void invoke(Ser &s, const T &data)
{
s.savePrimitive(data);
}
};
template<typename Ser,typename T>
struct SaveSerializable
{
static void invoke(Ser &s, const T &data)
{
s.saveSerializable(data);
}
};
template<typename Ser,typename T>
struct LoadPrimitive
{
static void invoke(Ser &s, T &data)
{
s.loadPrimitive(data);
}
};
template<typename Ser,typename T>
struct SavePointer
{
static void invoke(Ser &s, const T &data)
{
s.savePointer(data);
}
};
template<typename Ser,typename T>
struct LoadPointer
{
static void invoke(Ser &s, T &data)
{
s.loadPointer(data);
}
};
template<typename Ser,typename T>
struct LoadSerializable
{
static void invoke(Ser &s, T &data)
{
s.loadSerializable(data);
}
};
template<typename Ser,typename T>
struct SaveWrong
{
static void invoke(Ser &s, const T &data)
{
throw std::exception("Wrong save serialization call!");
}
};
template<typename Ser,typename T>
struct LoadWrong
{
static void invoke(Ser &s, const T &data)
{
throw std::exception("Wrong load serialization call!");
}
};
template<typename T>
struct SerializationLevel
{
typedef mpl::integral_c_tag tag;
typedef
typename mpl::eval_if<
boost::is_fundamental<T>,
mpl::int_<Primitive>,
//else
typename mpl::eval_if<
boost::is_class<T>,
mpl::int_<Serializable>,
//else
typename mpl::eval_if<
boost::is_array<T>,
mpl::int_<Primitive>,
//else
typename mpl::eval_if<
boost::is_pointer<T>,
mpl::int_<Pointer>,
//else
typename mpl::eval_if<
boost::is_enum<T>,
mpl::int_<Primitive>,
//else
mpl::int_<Wrong>
>
>
>
>
>::type type;
static const int value = SerializationLevel::type::value;
};
template <typename Serializer> class DLL_EXPORT COSer
{
public:
bool saving;
COSer(){saving=true;};
Serializer * This()
{
return static_cast<Serializer*>(this);
}
template<class T>
Serializer & operator<<(const T &t)
{
this->This()->save(t);
return * this->This();
}
template<class T>
COSer & operator&(T & t)
{
return * this->This() << t;
}
int write(const void * data, unsigned size);
template <typename T>
void savePrimitive(const T &data)
{
this->This()->write(&data,sizeof(data));
}
template <typename T>
void savePointer(const T &data)
{
*this << *data;
}
template <typename T>
void save(const T &data)
{
typedef
//if
typename mpl::eval_if< mpl::equal_to<SerializationLevel<T>,mpl::int_<Primitive> >,
mpl::identity<SavePrimitive<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Pointer> >,
mpl::identity<SavePointer<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Serializable> >,
mpl::identity<SaveSerializable<Serializer,T> >,
//else
mpl::identity<SaveWrong<Serializer,T> >
>
>
>::type typex;
typex::invoke(* this->This(), data);
}
template <typename T>
void saveSerializable(const T &data)
{
const_cast<T&>(data).serialize(*this,version);
}
template <typename T>
void saveSerializable(const std::vector<T> &data)
{
boost::uint32_t length = data.size();
*this << length;
for(ui32 i=0;i<length;i++)
*this << data[i];
}
template <typename T>
void saveSerializable(const std::set<T> &data)
{
std::set<T> &d = const_cast<std::set<T> &>(data);
boost::uint32_t length = d.size();
*this << length;
for(typename std::set<T>::iterator i=d.begin();i!=d.end();i++)
*this << *i;
}
void saveSerializable(const std::string &data)
{
if(!data.length())
{
*this << ui8(0);
}
else
{
*this << ui32(data.length());
this->This()->write(data.c_str(),data.size());
}
}
template <typename T1, typename T2>
void saveSerializable(const std::pair<T1,T2> &data)
{
*this << data.first << data.second;
}
template <typename T1, typename T2>
void saveSerializable(const std::map<T1,T2> &data)
{
*this << ui32(data.size());
for(typename std::map<T1,T2>::const_iterator i=data.begin();i!=data.end();i++)
*this << i->first << i->second;
}
};
template <typename Serializer> class DLL_EXPORT CISer
{
public:
bool saving;
CISer(){saving = false;};
Serializer * This()
{
return static_cast<Serializer*>(this);
}
template<class T>
Serializer & operator>>(T &t)
{
this->This()->load(t);
return * this->This();
}
template<class T>
CISer & operator&(T & t)
{
return * this->This() >> t;
}
int write(const void * data, unsigned size);
template <typename T>
void load(T &data)
{
typedef
//if
typename mpl::eval_if< mpl::equal_to<SerializationLevel<T>,mpl::int_<Primitive> >,
mpl::identity<LoadPrimitive<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Pointer> >,
mpl::identity<LoadPointer<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Serializable> >,
mpl::identity<LoadSerializable<Serializer,T> >,
//else
mpl::identity<LoadWrong<Serializer,T> >
>
>
>::type typex;
typex::invoke(* this->This(), data);
}
template <typename T>
void loadPrimitive(T &data)
{
this->This()->read(&data,sizeof(data));
}
template <typename T>
void loadSerializable(T &data)
{
data.serialize(*this,version);
}
template <typename T>
void loadPointer(T &data)
{
tlog5<<"Allocating memory for pointer!"<<std::endl;
typedef typename boost::remove_pointer<T>::type npT;
data = new npT;
*this >> *data;
}
template <typename T>
void loadSerializable(std::vector<T> &data)
{
boost::uint32_t length;
*this >> length;
data.resize(length);
for(ui32 i=0;i<length;i++)
*this >> data[i];
}
template <typename T>
void loadSerializable(std::set<T> &data)
{
boost::uint32_t length;
*this >> length;
T ins;
for(ui32 i=0;i<length;i++)
{
*this >> ins;
data.insert(ins);
}
}
template <typename T1, typename T2>
void loadSerializable(std::pair<T1,T2> &data)
{
*this >> data.first >> data.second;
}
template <typename T1, typename T2>
void loadSerializable(std::map<T1,T2> &data)
{
ui32 length;
*this >> length;
T1 t;
for(int i=0;i<length;i++)
{
*this >> t;
*this >> data[t];
}
}
void loadSerializable(std::string &data)
{
ui8 length[4];
*this >> length[0];
if(!length[0]) return;
*this >> length[1];
*this >> length[2];
*this >> length[3];
data.resize(*((ui32*)length));
this->This()->read((void*)data.c_str(),*((ui32*)length));
}
};
class DLL_EXPORT CSaveFile
: public COSer<CSaveFile>
{
void dummyMagicFunction()
{
*this << std::string("This function makes stuff working.");
}
public:
std::ofstream *sfile;
CSaveFile(const std::string &fname);
~CSaveFile();
int write(const void * data, unsigned size);
};
class DLL_EXPORT CConnection
:public CISer<CConnection>, public COSer<CConnection>
{
std::ostream &out;
CConnection(void);
void init();
public:
boost::mutex *rmx, *wmx; // read/write mutexes
boost::asio::basic_stream_socket < boost::asio::ip::tcp , boost::asio::stream_socket_service<boost::asio::ip::tcp> > * socket;
bool logging;
bool connected;
bool myEndianess, contactEndianess; //true if little endian, if ednianess is different we'll have to revert recieved multi-byte vars
boost::asio::io_service *io_service;
std::string name; //who uses this connection
CConnection
(std::string host, std::string port, std::string Name, std::ostream & Out);
CConnection
(boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > * acceptor,
boost::asio::io_service *Io_service, std::string Name, std::ostream & Out);
CConnection
(boost::asio::basic_stream_socket < boost::asio::ip::tcp , boost::asio::stream_socket_service<boost::asio::ip::tcp> > * Socket,
std::string Name, std::ostream & Out); //use immediately after accepting connection into socket
int write(const void * data, unsigned size);
int read(void * data, unsigned size);
int readLine(void * data, unsigned maxSize);
void close();
~CConnection(void);
};
#endif //CONNECTION_H
#ifndef CONNECTION_H
#define CONNECTION_H
#include "../global.h"
#include <string>
#include <vector>
#include <set>
#include <boost/type_traits/is_fundamental.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_array.hpp>
const int version = 63;
class CConnection;
namespace mpl = boost::mpl;
namespace boost
{
namespace asio
{
namespace ip
{
class tcp;
}
class io_service;
template <typename Protocol> class stream_socket_service;
template <typename Protocol,typename StreamSocketService>
class basic_stream_socket;
template <typename Protocol> class socket_acceptor_service;
template <typename Protocol,typename SocketAcceptorService>
class basic_socket_acceptor;
}
class mutex;
};
enum SerializationLvl
{
Wrong=0,
Primitive,
Pointer,
Serializable
};
template<typename Ser,typename T>
struct SavePrimitive
{
static void invoke(Ser &s, const T &data)
{
s.savePrimitive(data);
}
};
template<typename Ser,typename T>
struct SaveSerializable
{
static void invoke(Ser &s, const T &data)
{
s.saveSerializable(data);
}
};
template<typename Ser,typename T>
struct LoadPrimitive
{
static void invoke(Ser &s, T &data)
{
s.loadPrimitive(data);
}
};
template<typename Ser,typename T>
struct SavePointer
{
static void invoke(Ser &s, const T &data)
{
s.savePointer(data);
}
};
template<typename Ser,typename T>
struct LoadPointer
{
static void invoke(Ser &s, T &data)
{
s.loadPointer(data);
}
};
template<typename Ser,typename T>
struct LoadSerializable
{
static void invoke(Ser &s, T &data)
{
s.loadSerializable(data);
}
};
template<typename Ser,typename T>
struct SaveWrong
{
static void invoke(Ser &s, const T &data)
{
throw std::exception("Wrong save serialization call!");
}
};
template<typename Ser,typename T>
struct LoadWrong
{
static void invoke(Ser &s, const T &data)
{
throw std::exception("Wrong load serialization call!");
}
};
template<typename T>
struct SerializationLevel
{
typedef mpl::integral_c_tag tag;
typedef
typename mpl::eval_if<
boost::is_fundamental<T>,
mpl::int_<Primitive>,
//else
typename mpl::eval_if<
boost::is_class<T>,
mpl::int_<Serializable>,
//else
typename mpl::eval_if<
boost::is_array<T>,
mpl::int_<Primitive>,
//else
typename mpl::eval_if<
boost::is_pointer<T>,
mpl::int_<Pointer>,
//else
typename mpl::eval_if<
boost::is_enum<T>,
mpl::int_<Primitive>,
//else
mpl::int_<Wrong>
>
>
>
>
>::type type;
static const int value = SerializationLevel::type::value;
};
template <typename Serializer> class DLL_EXPORT COSer
{
public:
bool saving;
COSer(){saving=true;};
Serializer * This()
{
return static_cast<Serializer*>(this);
}
template<class T>
Serializer & operator<<(const T &t)
{
this->This()->save(t);
return * this->This();
}
template<class T>
COSer & operator&(T & t)
{
return * this->This() << t;
}
int write(const void * data, unsigned size);
template <typename T>
void savePrimitive(const T &data)
{
this->This()->write(&data,sizeof(data));
}
template <typename T>
void savePointer(const T &data)
{
*this << *data;
}
template <typename T>
void save(const T &data)
{
typedef
//if
typename mpl::eval_if< mpl::equal_to<SerializationLevel<T>,mpl::int_<Primitive> >,
mpl::identity<SavePrimitive<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Pointer> >,
mpl::identity<SavePointer<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Serializable> >,
mpl::identity<SaveSerializable<Serializer,T> >,
//else
mpl::identity<SaveWrong<Serializer,T> >
>
>
>::type typex;
typex::invoke(* this->This(), data);
}
template <typename T>
void saveSerializable(const T &data)
{
const_cast<T&>(data).serialize(*this,version);
}
template <typename T>
void saveSerializable(const std::vector<T> &data)
{
boost::uint32_t length = data.size();
*this << length;
for(ui32 i=0;i<length;i++)
*this << data[i];
}
template <typename T>
void saveSerializable(const std::set<T> &data)
{
std::set<T> &d = const_cast<std::set<T> &>(data);
boost::uint32_t length = d.size();
*this << length;
for(typename std::set<T>::iterator i=d.begin();i!=d.end();i++)
*this << *i;
}
void saveSerializable(const std::string &data)
{
if(!data.length())
{
*this << ui8(0);
}
else
{
*this << ui32(data.length());
this->This()->write(data.c_str(),data.size());
}
}
template <typename T1, typename T2>
void saveSerializable(const std::pair<T1,T2> &data)
{
*this << data.first << data.second;
}
template <typename T1, typename T2>
void saveSerializable(const std::map<T1,T2> &data)
{
*this << ui32(data.size());
for(typename std::map<T1,T2>::const_iterator i=data.begin();i!=data.end();i++)
*this << i->first << i->second;
}
};
template <typename Serializer> class DLL_EXPORT CISer
{
public:
bool saving;
CISer(){saving = false;};
Serializer * This()
{
return static_cast<Serializer*>(this);
}
template<class T>
Serializer & operator>>(T &t)
{
this->This()->load(t);
return * this->This();
}
template<class T>
CISer & operator&(T & t)
{
return * this->This() >> t;
}
int write(const void * data, unsigned size);
template <typename T>
void load(T &data)
{
typedef
//if
typename mpl::eval_if< mpl::equal_to<SerializationLevel<T>,mpl::int_<Primitive> >,
mpl::identity<LoadPrimitive<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Pointer> >,
mpl::identity<LoadPointer<Serializer,T> >,
//else if
typename mpl::eval_if<mpl::equal_to<SerializationLevel<T>,mpl::int_<Serializable> >,
mpl::identity<LoadSerializable<Serializer,T> >,
//else
mpl::identity<LoadWrong<Serializer,T> >
>
>
>::type typex;
typex::invoke(* this->This(), data);
}
template <typename T>
void loadPrimitive(T &data)
{
this->This()->read(&data,sizeof(data));
}
template <typename T>
void loadSerializable(T &data)
{
data.serialize(*this,version);
}
template <typename T>
void loadPointer(T &data)
{
tlog5<<"Allocating memory for pointer!"<<std::endl;
typedef typename boost::remove_pointer<T>::type npT;
data = new npT;
*this >> *data;
}
template <typename T>
void loadSerializable(std::vector<T> &data)
{
boost::uint32_t length;
*this >> length;
data.resize(length);
for(ui32 i=0;i<length;i++)
*this >> data[i];
}
template <typename T>
void loadSerializable(std::set<T> &data)
{
boost::uint32_t length;
*this >> length;
T ins;
for(ui32 i=0;i<length;i++)
{
*this >> ins;
data.insert(ins);
}
}
template <typename T1, typename T2>
void loadSerializable(std::pair<T1,T2> &data)
{
*this >> data.first >> data.second;
}
template <typename T1, typename T2>
void loadSerializable(std::map<T1,T2> &data)
{
ui32 length;
*this >> length;
T1 t;
for(int i=0;i<length;i++)
{
*this >> t;
*this >> data[t];
}
}
void loadSerializable(std::string &data)
{
ui8 length[4];
*this >> length[0];
if(!length[0]) return;
*this >> length[1];
*this >> length[2];
*this >> length[3];
data.resize(*((ui32*)length));
this->This()->read((void*)data.c_str(),*((ui32*)length));
}
};
class DLL_EXPORT CSaveFile
: public COSer<CSaveFile>
{
void dummyMagicFunction()
{
*this << std::string("This function makes stuff working.");
}
public:
std::ofstream *sfile;
CSaveFile(const std::string &fname);
~CSaveFile();
int write(const void * data, unsigned size);
};
class DLL_EXPORT CConnection
:public CISer<CConnection>, public COSer<CConnection>
{
std::ostream &out;
CConnection(void);
void init();
public:
boost::mutex *rmx, *wmx; // read/write mutexes
boost::asio::basic_stream_socket < boost::asio::ip::tcp , boost::asio::stream_socket_service<boost::asio::ip::tcp> > * socket;
bool logging;
bool connected;
bool myEndianess, contactEndianess; //true if little endian, if ednianess is different we'll have to revert recieved multi-byte vars
boost::asio::io_service *io_service;
std::string name; //who uses this connection
CConnection
(std::string host, std::string port, std::string Name, std::ostream & Out);
CConnection
(boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > * acceptor,
boost::asio::io_service *Io_service, std::string Name, std::ostream & Out);
CConnection
(boost::asio::basic_stream_socket < boost::asio::ip::tcp , boost::asio::stream_socket_service<boost::asio::ip::tcp> > * Socket,
std::string Name, std::ostream & Out); //use immediately after accepting connection into socket
int write(const void * data, unsigned size);
int read(void * data, unsigned size);
int readLine(void * data, unsigned maxSize);
void close();
~CConnection(void);
};
#endif //CONNECTION_H

View File

@ -1,52 +1,53 @@
#pragma once
#include "../global.h"
#include <vector>
#include <set>
#include "../client/FunctionList.h"
class CGObjectInstance;
class CGTownInstance;
class CGHeroInstance;
struct SelectionDialog;
struct YesNoDialog;
struct InfoWindow;
struct MetaString;
struct ShowInInfobox;
struct BattleResult;
class IGameCallback
{
public:
virtual ~IGameCallback(){};
virtual int getOwner(int heroID)=0;
virtual int getResource(int player, int which)=0;
virtual int getSelectedHero()=0;
virtual int getDate(int mode=0)=0;
virtual const CGObjectInstance* getObj(int objid)=0;
virtual const CGHeroInstance* getHero(int objid)=0;
virtual const CGTownInstance* getTown(int objid)=0;
virtual const CGHeroInstance* getSelectedHero(int player)=0; //NULL if no hero is selected
virtual int getCurrentPlayer()=0;
//do sth
virtual void changeSpells(int hid, bool give, const std::set<ui32> &spells)=0;
virtual void removeObject(int objid)=0;
virtual void setBlockVis(int objid, bool bv)=0;
virtual void setOwner(int objid, ui8 owner)=0;
virtual void setHoverName(int objid, MetaString * name)=0;
virtual void changePrimSkill(int ID, int which, int val, bool abs=false)=0;
virtual void showInfoDialog(InfoWindow *iw)=0;
virtual void showYesNoDialog(YesNoDialog *iw, const CFunctionList<void(ui32)> &callback)=0;
virtual void showSelectionDialog(SelectionDialog *iw, const CFunctionList<void(ui32)> &callback)=0; //returns question id
virtual void giveResource(int player, int which, int val)=0;
virtual void showCompInfo(ShowInInfobox * comp)=0;
virtual void heroVisitCastle(int obj, int heroID)=0;
virtual void stopHeroVisitCastle(int obj, int heroID)=0;
virtual void giveHeroArtifact(int artid, int hid, int position)=0; //pos==-1 - first free slot in backpack=0; pos==-2 - default if available or backpack
virtual void startBattleI(const CCreatureSet * army1, const CCreatureSet * army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, boost::function<void(BattleResult*)> cb)=0; //use hero=NULL for no hero
virtual void startBattleI(int heroID, CCreatureSet army, int3 tile, boost::function<void(BattleResult*)> cb)=0; //for hero<=>neutral army
virtual void setAmount(int objid, ui32 val)=0;
virtual void moveHero(int hid, int3 pos, bool instant)=0;
};
#ifndef __IGAMECALLBACK_H__
#define __IGAMECALLBACK_H__
#include "../global.h"
#include <vector>
#include <set>
#include "../client/FunctionList.h"
class CGObjectInstance;
class CGTownInstance;
class CGHeroInstance;
struct SelectionDialog;
struct YesNoDialog;
struct InfoWindow;
struct MetaString;
struct ShowInInfobox;
struct BattleResult;
class IGameCallback
{
public:
virtual ~IGameCallback(){};
virtual int getOwner(int heroID)=0;
virtual int getResource(int player, int which)=0;
virtual int getSelectedHero()=0;
virtual int getDate(int mode=0)=0;
virtual const CGObjectInstance* getObj(int objid)=0;
virtual const CGHeroInstance* getHero(int objid)=0;
virtual const CGTownInstance* getTown(int objid)=0;
virtual const CGHeroInstance* getSelectedHero(int player)=0; //NULL if no hero is selected
virtual int getCurrentPlayer()=0;
//do sth
virtual void changeSpells(int hid, bool give, const std::set<ui32> &spells)=0;
virtual void removeObject(int objid)=0;
virtual void setBlockVis(int objid, bool bv)=0;
virtual void setOwner(int objid, ui8 owner)=0;
virtual void setHoverName(int objid, MetaString * name)=0;
virtual void changePrimSkill(int ID, int which, int val, bool abs=false)=0;
virtual void showInfoDialog(InfoWindow *iw)=0;
virtual void showYesNoDialog(YesNoDialog *iw, const CFunctionList<void(ui32)> &callback)=0;
virtual void showSelectionDialog(SelectionDialog *iw, const CFunctionList<void(ui32)> &callback)=0; //returns question id
virtual void giveResource(int player, int which, int val)=0;
virtual void showCompInfo(ShowInInfobox * comp)=0;
virtual void heroVisitCastle(int obj, int heroID)=0;
virtual void stopHeroVisitCastle(int obj, int heroID)=0;
virtual void giveHeroArtifact(int artid, int hid, int position)=0; //pos==-1 - first free slot in backpack=0; pos==-2 - default if available or backpack
virtual void startBattleI(const CCreatureSet * army1, const CCreatureSet * army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, boost::function<void(BattleResult*)> cb)=0; //use hero=NULL for no hero
virtual void startBattleI(int heroID, CCreatureSet army, int3 tile, boost::function<void(BattleResult*)> cb)=0; //for hero<=>neutral army
virtual void setAmount(int objid, ui32 val)=0;
virtual void moveHero(int hid, int3 pos, bool instant)=0;
};#endif // __IGAMECALLBACK_H__

92
lib/vcmi_lib/Makefile-nb Normal file
View File

@ -0,0 +1,92 @@
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# NOCDDL
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
# build
build: .build-post
.build-pre:
# Add your pre 'build' code here...
.build-post: .build-impl
# Add your post 'build' code here...
# clean
clean: .clean-post
.clean-pre:
# Add your pre 'clean' code here...
.clean-post: .clean-impl
# Add your post 'clean' code here...
# clobber
clobber: .clobber-post
.clobber-pre:
# Add your pre 'clobber' code here...
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
# all
all: .all-post
.all-pre:
# Add your pre 'all' code here...
.all-post: .all-impl
# Add your post 'all' code here...
# help
help: .help-post
.help-pre:
# Add your pre 'help' code here...
.help-post: .help-impl
# Add your post 'help' code here...
# include project implementation makefile
include nbproject/Makefile-impl.mk

View File

@ -0,0 +1,163 @@
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a -pre and a -post target defined where you can add customized code.
#
# This makefile implements configuration specific macros and targets.
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
CC=gcc
CCC=g++
CXX=g++
FC=
# Macros
PLATFORM=GNU-Linux-x86
# Include project Makefile
include Makefile-nb
# Object Directory
OBJECTDIR=build/Debug/${PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CHeroHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CTownHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../Connection.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../VCMI_Lib.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CSpellHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CCreatureHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameState.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CDefObjInfoHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CConsoleHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CLodHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CObjectHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameInfo.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CGeneralTextHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../map.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CArtHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CBuildingHandler.o
# C Compiler Flags
CFLAGS=
# CC Compiler Flags
CCFLAGS=
CXXFLAGS=
# Fortran Compiler Flags
FFLAGS=
# Link Libraries and Options
LDLIBSOPTIONS=-L../../../../boost/lib
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
${MAKE} -f nbproject/Makefile-Debug.mk dist/Debug/${PLATFORM}/libvcmi_lib.so
dist/Debug/${PLATFORM}/libvcmi_lib.so: ${OBJECTFILES}
${MKDIR} -p dist/Debug/${PLATFORM}
${LINK.cc} -shared -o dist/Debug/${PLATFORM}/libvcmi_lib.so -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CHeroHandler.o: ../../hch/CHeroHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CHeroHandler.o ../../hch/CHeroHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CTownHandler.o: ../../hch/CTownHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CTownHandler.o ../../hch/CTownHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../Connection.o: ../Connection.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/..
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../Connection.o ../Connection.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../VCMI_Lib.o: ../VCMI_Lib.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/..
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../VCMI_Lib.o ../VCMI_Lib.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CSpellHandler.o: ../../hch/CSpellHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CSpellHandler.o ../../hch/CSpellHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CCreatureHandler.o: ../../hch/CCreatureHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CCreatureHandler.o ../../hch/CCreatureHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameState.o: ../../CGameState.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameState.o ../../CGameState.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CDefObjInfoHandler.o: ../../hch/CDefObjInfoHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CDefObjInfoHandler.o ../../hch/CDefObjInfoHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CConsoleHandler.o: ../../CConsoleHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CConsoleHandler.o ../../CConsoleHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CLodHandler.o: ../../hch/CLodHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CLodHandler.o ../../hch/CLodHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CObjectHandler.o: ../../hch/CObjectHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CObjectHandler.o ../../hch/CObjectHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameInfo.o: ../../CGameInfo.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameInfo.o ../../CGameInfo.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CGeneralTextHandler.o: ../../hch/CGeneralTextHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CGeneralTextHandler.o ../../hch/CGeneralTextHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../map.o: ../../map.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../map.o ../../map.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CArtHandler.o: ../../hch/CArtHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CArtHandler.o ../../hch/CArtHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CBuildingHandler.o: ../../hch/CBuildingHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -g -I../../hch -I../.. -I../../../../boost/include/boost-1_37 -I/usr/include/SDL -I../../../../boost/include/boost-1_37/boost -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CBuildingHandler.o ../../hch/CBuildingHandler.cpp
# Subprojects
.build-subprojects:
# Clean Targets
.clean-conf:
${RM} -r build/Debug
${RM} dist/Debug/${PLATFORM}/libvcmi_lib.so
# Subprojects
.clean-subprojects:
# Enable dependency checking
.dep.inc: .depcheck-impl
include .dep.inc

View File

@ -0,0 +1,163 @@
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a -pre and a -post target defined where you can add customized code.
#
# This makefile implements configuration specific macros and targets.
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
CC=gcc
CCC=g++
CXX=g++
FC=
# Macros
PLATFORM=GNU-Linux-x86
# Include project Makefile
include Makefile-nb
# Object Directory
OBJECTDIR=build/Release/${PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CHeroHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CTownHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../Connection.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../VCMI_Lib.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CSpellHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CCreatureHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameState.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CDefObjInfoHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CConsoleHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CLodHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CObjectHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameInfo.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CGeneralTextHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../map.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CArtHandler.o \
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CBuildingHandler.o
# C Compiler Flags
CFLAGS=
# CC Compiler Flags
CCFLAGS=
CXXFLAGS=
# Fortran Compiler Flags
FFLAGS=
# Link Libraries and Options
LDLIBSOPTIONS=
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
${MAKE} -f nbproject/Makefile-Release.mk dist/Release/${PLATFORM}/libvcmi_lib.so
dist/Release/${PLATFORM}/libvcmi_lib.so: ${OBJECTFILES}
${MKDIR} -p dist/Release/${PLATFORM}
${LINK.cc} -shared -o dist/Release/${PLATFORM}/libvcmi_lib.so -fPIC ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CHeroHandler.o: ../../hch/CHeroHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CHeroHandler.o ../../hch/CHeroHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CTownHandler.o: ../../hch/CTownHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CTownHandler.o ../../hch/CTownHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../Connection.o: ../Connection.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/..
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../Connection.o ../Connection.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../VCMI_Lib.o: ../VCMI_Lib.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/..
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../VCMI_Lib.o ../VCMI_Lib.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CSpellHandler.o: ../../hch/CSpellHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CSpellHandler.o ../../hch/CSpellHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CCreatureHandler.o: ../../hch/CCreatureHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CCreatureHandler.o ../../hch/CCreatureHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameState.o: ../../CGameState.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameState.o ../../CGameState.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CDefObjInfoHandler.o: ../../hch/CDefObjInfoHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CDefObjInfoHandler.o ../../hch/CDefObjInfoHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CConsoleHandler.o: ../../CConsoleHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CConsoleHandler.o ../../CConsoleHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CLodHandler.o: ../../hch/CLodHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CLodHandler.o ../../hch/CLodHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CObjectHandler.o: ../../hch/CObjectHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CObjectHandler.o ../../hch/CObjectHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameInfo.o: ../../CGameInfo.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../CGameInfo.o ../../CGameInfo.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CGeneralTextHandler.o: ../../hch/CGeneralTextHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CGeneralTextHandler.o ../../hch/CGeneralTextHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../map.o: ../../map.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../..
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../map.o ../../map.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CArtHandler.o: ../../hch/CArtHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CArtHandler.o ../../hch/CArtHandler.cpp
${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CBuildingHandler.o: ../../hch/CBuildingHandler.cpp
${MKDIR} -p ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch
${RM} $@.d
$(COMPILE.cc) -O2 -fPIC -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/home/t0/vcmi/trunk/lib/vcmi_lib/../../hch/CBuildingHandler.o ../../hch/CBuildingHandler.cpp
# Subprojects
.build-subprojects:
# Clean Targets
.clean-conf:
${RM} -r build/Release
${RM} dist/Release/${PLATFORM}/libvcmi_lib.so
# Subprojects
.clean-subprojects:
# Enable dependency checking
.dep.inc: .depcheck-impl
include .dep.inc

View File

@ -0,0 +1,123 @@
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a pre- and a post- target defined where you can add customization code.
#
# This makefile implements macros and targets common to all configurations.
#
# NOCDDL
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
# and .clean-reqprojects-conf unless SUB has the value 'no'
SUB_no=NO
SUBPROJECTS=${SUB_${SUB}}
BUILD_SUBPROJECTS_=.build-subprojects
BUILD_SUBPROJECTS_NO=
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
CLEAN_SUBPROJECTS_=.clean-subprojects
CLEAN_SUBPROJECTS_NO=
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
# Project Name
PROJECTNAME=vcmi_lib
# Active Configuration
DEFAULTCONF=Debug
CONF=${DEFAULTCONF}
# All Configurations
ALLCONFS=Debug Release
# build
.build-impl: .build-pre .validate-impl .depcheck-impl
@#echo "=> Running $@... Configuration=$(CONF)"
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
# clean
.clean-impl: .clean-pre .validate-impl .depcheck-impl
@#echo "=> Running $@... Configuration=$(CONF)"
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
# clobber
.clobber-impl: .clobber-pre .depcheck-impl
@#echo "=> Running $@..."
for CONF in ${ALLCONFS}; \
do \
${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
done
# all
.all-impl: .all-pre .depcheck-impl
@#echo "=> Running $@..."
for CONF in ${ALLCONFS}; \
do \
${MAKE} -f nbproject/Makefile-$${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf; \
done
# dependency checking support
.depcheck-impl:
@echo "# This code depends on make tool being used" >.dep.inc
@if [ -n "${MAKE_VERSION}" ]; then \
echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
echo "include \$${DEPFILES}" >>.dep.inc; \
echo "endif" >>.dep.inc; \
else \
echo ".KEEP_STATE:" >>.dep.inc; \
echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
fi
# configuration validation
.validate-impl:
@if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
then \
echo ""; \
echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
echo "See 'make help' for details."; \
echo "Current directory: " `pwd`; \
echo ""; \
fi
@if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
then \
exit 1; \
fi
# help
.help-impl: .help-pre
@echo "This makefile supports the following configurations:"
@echo " ${ALLCONFS}"
@echo ""
@echo "and the following targets:"
@echo " build (default target)"
@echo " clean"
@echo " clobber"
@echo " all"
@echo " help"
@echo ""
@echo "Makefile Usage:"
@echo " make [CONF=<CONFIGURATION>] [SUB=no] build"
@echo " make [CONF=<CONFIGURATION>] [SUB=no] clean"
@echo " make [SUB=no] clobber"
@echo " make [SUB=no] all"
@echo " make help"
@echo ""
@echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
@echo " also build subprojects."
@echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
@echo " also clean subprojects."
@echo "Target 'clobber' will remove all built files from all configurations and,"
@echo " unless 'SUB=no', also from subprojects."
@echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
@echo " also build subprojects."
@echo "Target 'help' prints this message."
@echo ""

View File

@ -0,0 +1,72 @@
#!/bin/bash -x
#
# Generated - do not edit!
#
# Macros
TOP=`pwd`
PLATFORM=GNU-Linux-x86
TMPDIR=build/Debug/${PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/Debug/${PLATFORM}/libvcmi_lib.so
OUTPUT_BASENAME=libvcmi_lib.so
PACKAGE_TOP_DIR=libvcmilib.so/
# Functions
function checkReturnCode
{
rc=$?
if [ $rc != 0 ]
then
exit $rc
fi
}
function makeDirectory
# $1 directory path
# $2 permission (optional)
{
mkdir -p "$1"
checkReturnCode
if [ "$2" != "" ]
then
chmod $2 "$1"
checkReturnCode
fi
}
function copyFileToTmpDir
# $1 from-file path
# $2 to-file path
# $3 permission
{
cp "$1" "$2"
checkReturnCode
if [ "$3" != "" ]
then
chmod $3 "$2"
checkReturnCode
fi
}
# Setup
cd "${TOP}"
mkdir -p dist/Debug/${PLATFORM}/package
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}
# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/libvcmilib.so/lib
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
# Generate tar file
cd "${TOP}"
rm -f dist/Debug/${PLATFORM}/package/libvcmilib.so.tar
cd ${TMPDIR}
tar -vcf ../../../../dist/Debug/${PLATFORM}/package/libvcmilib.so.tar *
checkReturnCode
# Cleanup
cd "${TOP}"
rm -rf ${TMPDIR}

View File

@ -0,0 +1,72 @@
#!/bin/bash -x
#
# Generated - do not edit!
#
# Macros
TOP=`pwd`
PLATFORM=GNU-Linux-x86
TMPDIR=build/Release/${PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/Release/${PLATFORM}/libvcmi_lib.so
OUTPUT_BASENAME=libvcmi_lib.so
PACKAGE_TOP_DIR=libvcmilib.so/
# Functions
function checkReturnCode
{
rc=$?
if [ $rc != 0 ]
then
exit $rc
fi
}
function makeDirectory
# $1 directory path
# $2 permission (optional)
{
mkdir -p "$1"
checkReturnCode
if [ "$2" != "" ]
then
chmod $2 "$1"
checkReturnCode
fi
}
function copyFileToTmpDir
# $1 from-file path
# $2 to-file path
# $3 permission
{
cp "$1" "$2"
checkReturnCode
if [ "$3" != "" ]
then
chmod $3 "$2"
checkReturnCode
fi
}
# Setup
cd "${TOP}"
mkdir -p dist/Release/${PLATFORM}/package
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}
# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/libvcmilib.so/lib
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
# Generate tar file
cd "${TOP}"
rm -f dist/Release/${PLATFORM}/package/libvcmilib.so.tar
cd ${TMPDIR}
tar -vcf ../../../../dist/Release/${PLATFORM}/package/libvcmilib.so.tar *
checkReturnCode
# Cleanup
cd "${TOP}"
rm -rf ${TMPDIR}

780
map.h
View File

@ -1,390 +1,390 @@
#ifndef MAPD_H
#define MAPD_H
#ifdef _MSC_VER
#pragma warning (disable : 4482)
#endif
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include "global.h"
class CGDefInfo;
class CGObjectInstance;
class CGHeroInstance;
class CGTownInstance;
enum ESortBy{_name, _playerAm, _size, _format, _viccon, _loscon};
enum EDefType {TOWN_DEF, HERO_DEF, CREATURES_DEF, SEERHUT_DEF, RESOURCE_DEF, TERRAINOBJ_DEF,
EVENTOBJ_DEF, SIGN_DEF, GARRISON_DEF, ARTIFACT_DEF, WITCHHUT_DEF, SCHOLAR_DEF, PLAYERONLY_DEF,
SHRINE_DEF, SPELLSCROLL_DEF, PANDORA_DEF, GRAIL_DEF, CREGEN_DEF, CREGEN2_DEF, CREGEN3_DEF,
BORDERGUARD_DEF, HEROPLACEHOLDER_DEF};
class DLL_EXPORT CSpecObjInfo
{
public:
virtual ~CSpecObjInfo(){};
};
class DLL_EXPORT CCreGenObjInfo : public CSpecObjInfo
{
public:
unsigned char player; //owner
bool asCastle;
int identifier;
unsigned char castles[2]; //allowed castles
};
class DLL_EXPORT CCreGen2ObjInfo : public CSpecObjInfo
{
public:
unsigned char player; //owner
bool asCastle;
int identifier;
unsigned char castles[2]; //allowed castles
unsigned char minLevel, maxLevel; //minimal and maximal level of creature in dwelling: <0, 6>
};
class DLL_EXPORT CCreGen3ObjInfo : public CSpecObjInfo
{
public:
unsigned char player; //owner
unsigned char minLevel, maxLevel; //minimal and maximal level of creature in dwelling: <0, 6>
};
struct DLL_EXPORT Sresource
{
std::string resName; //name of this resource
int amount; //it can be greater and lesser than 0
};
struct DLL_EXPORT TimeEvent
{
std::string eventName;
std::string message;
std::vector<Sresource> decIncRes; //decreases / increases of resources
unsigned int whichPlayers; //which players are affected by this event (+1 - first, +2 - second, +4 - third, +8 - fourth etc.)
bool areHumansAffected;
bool areCompsAffected;
int firstAfterNDays; //how many days after appears this event
int nextAfterNDays; //how many days after the epperance before appaers this event
};
struct DLL_EXPORT TerrainTile
{
EterrainType tertype; // type of terrain
unsigned char terview; // look of terrain
Eriver nuine; // type of Eriver (0 if there is no Eriver)
unsigned char rivDir; // direction of Eriver
Eroad malle; // type of Eroad (0 if there is no Eriver)
unsigned char roadDir; // direction of Eroad
unsigned char siodmyTajemniczyBajt; //bitfield, info whether this tile is coastal and how to rotate tile graphics
bool visitable; //false = not visitable; true = visitable
bool blocked; //false = free; true = blocked;
std::vector <CGObjectInstance*> visitableObjects; //pointers to objects hero can visit while being on this tile
std::vector <CGObjectInstance*> blockingObjects; //pointers to objects that are blocking this tile
template <typename Handler> void serialize(Handler &h, const int version)
{
h & tertype & terview & nuine & rivDir & malle &roadDir & siodmyTajemniczyBajt;
}
};
struct DLL_EXPORT SheroName //name of starting hero
{
int heroID;
std::string heroName;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & heroID & heroName;
}
};
struct DLL_EXPORT PlayerInfo
{
si32 p7, p8, p9;
ui8 canHumanPlay;
ui8 canComputerPlay;
ui32 AITactic; //(00 - random, 01 - warrior, 02 - builder, 03 - explorer)
ui32 allowedFactions; //(01 - castle; 02 - rampart; 04 - tower; 08 - inferno; 16 - necropolis; 32 - dungeon; 64 - stronghold; 128 - fortress; 256 - conflux);
ui8 isFactionRandom;
ui32 mainHeroPortrait; //it's ID of hero with choosen portrait; 255 if standard
std::string mainHeroName;
std::vector<SheroName> heroesNames;
ui8 hasMainTown;
ui8 generateHeroAtMainTown;
int3 posOfMainTown;
ui8 team;
ui8 generateHero;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & p7 & p8 & p9 & canHumanPlay & canComputerPlay & AITactic & allowedFactions & isFactionRandom &
mainHeroPortrait & mainHeroName & heroesNames & hasMainTown & generateHeroAtMainTown &
posOfMainTown & team & generateHero;
}
};
struct DLL_EXPORT LossCondition
{
ElossCon typeOfLossCon;
int3 castlePos;
int3 heroPos;
int timeLimit; // in days
template <typename Handler> void serialize(Handler &h, const int version)
{
h & typeOfLossCon & castlePos & heroPos & timeLimit;
}
};
struct DLL_EXPORT CspecificVictoryConidtions
{
bool allowNormalVictory;
bool appliesToAI;
};
struct DLL_EXPORT VicCon0 : public CspecificVictoryConidtions //acquire artifact
{
int ArtifactID;
};
struct DLL_EXPORT VicCon1 : public CspecificVictoryConidtions //accumulate creatures
{
int monsterID;
int neededQuantity;
};
struct DLL_EXPORT VicCon2 : public CspecificVictoryConidtions // accumulate resources
{
int resourceID;
int neededQuantity;
};
struct DLL_EXPORT VicCon3 : public CspecificVictoryConidtions // upgrade specific town
{
int3 posOfCity;
int councilNeededLevel; //0 - town; 1 - city; 2 - capitol
int fortNeededLevel;// 0 - fort; 1 - citadel; 2 - castle
};
struct DLL_EXPORT VicCon4 : public CspecificVictoryConidtions // build grail structure
{
bool anyLocation;
int3 whereBuildGrail;
};
struct DLL_EXPORT VicCon5 : public CspecificVictoryConidtions // defeat a specific hero
{
int3 locationOfHero;
};
struct DLL_EXPORT VicCon6 : public CspecificVictoryConidtions // capture a specific town
{
int3 locationOfTown;
};
struct DLL_EXPORT VicCon7 : public CspecificVictoryConidtions // defeat a specific monster
{
int3 locationOfMonster;
};
struct DLL_EXPORT VicCona : public CspecificVictoryConidtions //transport specific artifact
{
int artifactID;
int3 destinationPlace;
};
struct DLL_EXPORT Rumor
{
std::string name, text;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & name & text;
}
};
struct DLL_EXPORT DisposedHero
{
ui32 ID;
ui16 portrait; //0xFF - default
std::string name;
ui8 players; //who can hire this hero (bitfield)
template <typename Handler> void serialize(Handler &h, const int version)
{
h & ID & portrait & name & players;
}
};
class DLL_EXPORT CMapEvent
{
public:
std::string name, message;
si32 wood, mercury, ore, sulfur, crystal, gems, gold; //gained / taken resources
ui8 players; //affected players
ui8 humanAffected;
ui8 computerAffected;
ui32 firstOccurence;
ui32 nextOccurence; //after nextOccurance day event will occure; if it it 0, event occures only one time;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & name & message & wood & mercury & ore & sulfur & crystal & gems & gold
& players & humanAffected & computerAffected & firstOccurence & nextOccurence;
}
};
class DLL_EXPORT CMapHeader
{
public:
Eformat version; // version of map Eformat
bool areAnyPLayers; // if there are any playable players on map
int height, width;
bool twoLevel; // if map has underground level
std::string name; //name of map
std::string description; //and description
int difficulty; // 0 easy - 4 impossible
int levelLimit;
LossCondition lossCondition;
EvictoryConditions victoryCondition; //victory conditions
CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
PlayerInfo players[8]; // info about players
std::vector<int> teams; // teams[i] = team of player no i
int howManyTeams;
CMapHeader(unsigned char *map); //an argument is a reference to string described a map (unpacked)
};
class DLL_EXPORT CMapInfo : public CMapHeader
{
public:
std::string filename;
int playerAmnt, humenPlayers;
CMapInfo(std::string fname, unsigned char *map):CMapHeader(map),filename(fname)
{
playerAmnt=humenPlayers=0;
for (int i=0;i<PLAYER_LIMIT;i++)
{
if (players[i].canHumanPlay) {playerAmnt++;humenPlayers++;}
else if (players[i].canComputerPlay) {playerAmnt++;}
}
};
};
class DLL_EXPORT mapSorter
{
public:
ESortBy sortBy;
bool operator()(const CMapHeader & a, const CMapHeader& b)
{
switch (sortBy)
{
case _format:
return (a.version<b.version);
break;
case _loscon:
return (a.lossCondition.typeOfLossCon<b.lossCondition.typeOfLossCon);
break;
case _playerAm:
int playerAmntB,humenPlayersB,playerAmntA,humenPlayersA;
playerAmntB=humenPlayersB=playerAmntA=humenPlayersA=0;
for (int i=0;i<8;i++)
{
if (a.players[i].canHumanPlay) {playerAmntA++;humenPlayersA++;}
else if (a.players[i].canComputerPlay) {playerAmntA++;}
if (b.players[i].canHumanPlay) {playerAmntB++;humenPlayersB++;}
else if (b.players[i].canComputerPlay) {playerAmntB++;}
}
if (playerAmntB!=playerAmntA)
return (playerAmntA<playerAmntB);
else
return (humenPlayersA<humenPlayersB);
break;
case _size:
return (a.width<b.width);
break;
case _viccon:
return (a.victoryCondition<b.victoryCondition);
break;
case _name:
return (a.name<b.name);
break;
default:
return (a.name<b.name);
break;
}
};
mapSorter(ESortBy es):sortBy(es){};
};
struct DLL_EXPORT Mapa
{
Eformat version; // version of map Eformat
ui32 checksum;
int twoLevel; // if map has underground level
int difficulty; // 0 easy - 4 impossible
int levelLimit;
bool areAnyPLayers; // if there are any playable players on map
std::string name; //name of map
std::string description; //and description
int height, width;
TerrainTile*** terrain;
std::vector<Rumor> rumors;
std::vector<DisposedHero> disposedHeroes;
std::vector<CGHeroInstance*> predefinedHeroes;
std::vector<CGDefInfo *> defy; // list of .def files with definitions from .h3m (may be custom)
std::set<CGDefInfo *> defs; // other defInfos - for randomized objects, objects added or modified by scripts
PlayerInfo players[8]; // info about players
std::vector<int> teams; // teams[i] = team of player no i
LossCondition lossCondition;
EvictoryConditions victoryCondition; //victory conditions
CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
int howManyTeams;
std::vector<bool> allowedSpell; //allowedSpell[spell_ID] - if the spell is allowed
std::vector<bool> allowedArtifact; //allowedArtifact[artifact_ID] - if the artifact is allowed
std::vector<bool> allowedAbilities; //allowedAbilities[ability_ID] - if the ability is allowed
std::vector<bool> allowedHeroes; //allowedHeroes[hero_ID] - if the hero is allowed
std::vector<CMapEvent> events;
int3 grailPos;
int grailRadious;
std::vector<CGObjectInstance*> objects;
std::vector<CGHeroInstance*> heroes;
std::vector<CGTownInstance*> towns;
void initFromBytes(unsigned char * bufor); //creates map from decompressed .h3m data
void readEvents( unsigned char * bufor, int &i);
void readObjects( unsigned char * bufor, int &i);
void readDefInfo( unsigned char * bufor, int &i);
void readTerrain( unsigned char * bufor, int &i);
void readPredefinedHeroes( unsigned char * bufor, int &i);
void readHeader( unsigned char * bufor, int &i);
void readRumors( unsigned char * bufor, int &i);
void loadViCLossConditions( unsigned char * bufor, int &i);
void loadPlayerInfo( int &pom, unsigned char * bufor, int &i);
void loadHero( CGObjectInstance * &nobj, unsigned char * bufor, int &i);
void loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i);
int loadSeerHut( unsigned char * bufor, int i, CGObjectInstance *& nobj);
void addBlockVisTiles(CGObjectInstance * obj);
void removeBlockVisTiles(CGObjectInstance * obj);
Mapa(std::string filename); //creates map structure from .h3m file
CGHeroInstance * getHero(int ID, int mode=0);
bool isInTheMap(int3 pos);
template <typename Handler> void serialize(Handler &h, const int version)
{
h & version & name & description & width & height & twoLevel & difficulty & levelLimit & rumors & defy & defs
& players & teams & lossCondition & victoryCondition & howManyTeams & allowedSpell & allowedAbilities
& allowedArtifact &allowedHeroes & events;
//TODO: viccondetails
if(h.saving)
{
//saving terrain
for (int i = 0; i < width ; i++)
for (int j = 0; j < height ; j++)
for (int k = 0; k <= twoLevel ; k++)
h & terrain[i][j][k];
}
else
{
//loading terrain
terrain = new TerrainTile**[width]; // allocate memory
for (int ii=0;ii<width;ii++)
{
terrain[ii] = new TerrainTile*[height]; // allocate memory
for(int jj=0;jj<height;jj++)
terrain[ii][jj] = new TerrainTile[twoLevel+1];
}
for (int i = 0; i < width ; i++)
for (int j = 0; j < height ; j++)
for (int k = 0; k <= twoLevel ; k++)
h & terrain[i][j][k];
}
//TODO: recreate blockvis maps
}
};
#endif //MAPD_H
#ifndef __MAP_H__
#define __MAP_H__
#ifdef _MSC_VER
#pragma warning (disable : 4482)
#endif
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include "global.h"
class CGDefInfo;
class CGObjectInstance;
class CGHeroInstance;
class CGTownInstance;
enum ESortBy{_name, _playerAm, _size, _format, _viccon, _loscon};
enum EDefType {TOWN_DEF, HERO_DEF, CREATURES_DEF, SEERHUT_DEF, RESOURCE_DEF, TERRAINOBJ_DEF,
EVENTOBJ_DEF, SIGN_DEF, GARRISON_DEF, ARTIFACT_DEF, WITCHHUT_DEF, SCHOLAR_DEF, PLAYERONLY_DEF,
SHRINE_DEF, SPELLSCROLL_DEF, PANDORA_DEF, GRAIL_DEF, CREGEN_DEF, CREGEN2_DEF, CREGEN3_DEF,
BORDERGUARD_DEF, HEROPLACEHOLDER_DEF};
class DLL_EXPORT CSpecObjInfo
{
public:
virtual ~CSpecObjInfo(){};
};
class DLL_EXPORT CCreGenObjInfo : public CSpecObjInfo
{
public:
unsigned char player; //owner
bool asCastle;
int identifier;
unsigned char castles[2]; //allowed castles
};
class DLL_EXPORT CCreGen2ObjInfo : public CSpecObjInfo
{
public:
unsigned char player; //owner
bool asCastle;
int identifier;
unsigned char castles[2]; //allowed castles
unsigned char minLevel, maxLevel; //minimal and maximal level of creature in dwelling: <0, 6>
};
class DLL_EXPORT CCreGen3ObjInfo : public CSpecObjInfo
{
public:
unsigned char player; //owner
unsigned char minLevel, maxLevel; //minimal and maximal level of creature in dwelling: <0, 6>
};
struct DLL_EXPORT Sresource
{
std::string resName; //name of this resource
int amount; //it can be greater and lesser than 0
};
struct DLL_EXPORT TimeEvent
{
std::string eventName;
std::string message;
std::vector<Sresource> decIncRes; //decreases / increases of resources
unsigned int whichPlayers; //which players are affected by this event (+1 - first, +2 - second, +4 - third, +8 - fourth etc.)
bool areHumansAffected;
bool areCompsAffected;
int firstAfterNDays; //how many days after appears this event
int nextAfterNDays; //how many days after the epperance before appaers this event
};
struct DLL_EXPORT TerrainTile
{
EterrainType tertype; // type of terrain
unsigned char terview; // look of terrain
Eriver nuine; // type of Eriver (0 if there is no Eriver)
unsigned char rivDir; // direction of Eriver
Eroad malle; // type of Eroad (0 if there is no Eriver)
unsigned char roadDir; // direction of Eroad
unsigned char siodmyTajemniczyBajt; //bitfield, info whether this tile is coastal and how to rotate tile graphics
bool visitable; //false = not visitable; true = visitable
bool blocked; //false = free; true = blocked;
std::vector <CGObjectInstance*> visitableObjects; //pointers to objects hero can visit while being on this tile
std::vector <CGObjectInstance*> blockingObjects; //pointers to objects that are blocking this tile
template <typename Handler> void serialize(Handler &h, const int version)
{
h & tertype & terview & nuine & rivDir & malle &roadDir & siodmyTajemniczyBajt;
}
};
struct DLL_EXPORT SheroName //name of starting hero
{
int heroID;
std::string heroName;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & heroID & heroName;
}
};
struct DLL_EXPORT PlayerInfo
{
si32 p7, p8, p9;
ui8 canHumanPlay;
ui8 canComputerPlay;
ui32 AITactic; //(00 - random, 01 - warrior, 02 - builder, 03 - explorer)
ui32 allowedFactions; //(01 - castle; 02 - rampart; 04 - tower; 08 - inferno; 16 - necropolis; 32 - dungeon; 64 - stronghold; 128 - fortress; 256 - conflux);
ui8 isFactionRandom;
ui32 mainHeroPortrait; //it's ID of hero with choosen portrait; 255 if standard
std::string mainHeroName;
std::vector<SheroName> heroesNames;
ui8 hasMainTown;
ui8 generateHeroAtMainTown;
int3 posOfMainTown;
ui8 team;
ui8 generateHero;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & p7 & p8 & p9 & canHumanPlay & canComputerPlay & AITactic & allowedFactions & isFactionRandom &
mainHeroPortrait & mainHeroName & heroesNames & hasMainTown & generateHeroAtMainTown &
posOfMainTown & team & generateHero;
}
};
struct DLL_EXPORT LossCondition
{
ElossCon typeOfLossCon;
int3 castlePos;
int3 heroPos;
int timeLimit; // in days
template <typename Handler> void serialize(Handler &h, const int version)
{
h & typeOfLossCon & castlePos & heroPos & timeLimit;
}
};
struct DLL_EXPORT CspecificVictoryConidtions
{
bool allowNormalVictory;
bool appliesToAI;
};
struct DLL_EXPORT VicCon0 : public CspecificVictoryConidtions //acquire artifact
{
int ArtifactID;
};
struct DLL_EXPORT VicCon1 : public CspecificVictoryConidtions //accumulate creatures
{
int monsterID;
int neededQuantity;
};
struct DLL_EXPORT VicCon2 : public CspecificVictoryConidtions // accumulate resources
{
int resourceID;
int neededQuantity;
};
struct DLL_EXPORT VicCon3 : public CspecificVictoryConidtions // upgrade specific town
{
int3 posOfCity;
int councilNeededLevel; //0 - town; 1 - city; 2 - capitol
int fortNeededLevel;// 0 - fort; 1 - citadel; 2 - castle
};
struct DLL_EXPORT VicCon4 : public CspecificVictoryConidtions // build grail structure
{
bool anyLocation;
int3 whereBuildGrail;
};
struct DLL_EXPORT VicCon5 : public CspecificVictoryConidtions // defeat a specific hero
{
int3 locationOfHero;
};
struct DLL_EXPORT VicCon6 : public CspecificVictoryConidtions // capture a specific town
{
int3 locationOfTown;
};
struct DLL_EXPORT VicCon7 : public CspecificVictoryConidtions // defeat a specific monster
{
int3 locationOfMonster;
};
struct DLL_EXPORT VicCona : public CspecificVictoryConidtions //transport specific artifact
{
int artifactID;
int3 destinationPlace;
};
struct DLL_EXPORT Rumor
{
std::string name, text;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & name & text;
}
};
struct DLL_EXPORT DisposedHero
{
ui32 ID;
ui16 portrait; //0xFF - default
std::string name;
ui8 players; //who can hire this hero (bitfield)
template <typename Handler> void serialize(Handler &h, const int version)
{
h & ID & portrait & name & players;
}
};
class DLL_EXPORT CMapEvent
{
public:
std::string name, message;
si32 wood, mercury, ore, sulfur, crystal, gems, gold; //gained / taken resources
ui8 players; //affected players
ui8 humanAffected;
ui8 computerAffected;
ui32 firstOccurence;
ui32 nextOccurence; //after nextOccurance day event will occure; if it it 0, event occures only one time;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & name & message & wood & mercury & ore & sulfur & crystal & gems & gold
& players & humanAffected & computerAffected & firstOccurence & nextOccurence;
}
};
class DLL_EXPORT CMapHeader
{
public:
Eformat version; // version of map Eformat
bool areAnyPLayers; // if there are any playable players on map
int height, width;
bool twoLevel; // if map has underground level
std::string name; //name of map
std::string description; //and description
int difficulty; // 0 easy - 4 impossible
int levelLimit;
LossCondition lossCondition;
EvictoryConditions victoryCondition; //victory conditions
CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
PlayerInfo players[8]; // info about players
std::vector<int> teams; // teams[i] = team of player no i
int howManyTeams;
CMapHeader(unsigned char *map); //an argument is a reference to string described a map (unpacked)
};
class DLL_EXPORT CMapInfo : public CMapHeader
{
public:
std::string filename;
int playerAmnt, humenPlayers;
CMapInfo(std::string fname, unsigned char *map):CMapHeader(map),filename(fname)
{
playerAmnt=humenPlayers=0;
for (int i=0;i<PLAYER_LIMIT;i++)
{
if (players[i].canHumanPlay) {playerAmnt++;humenPlayers++;}
else if (players[i].canComputerPlay) {playerAmnt++;}
}
};
};
class DLL_EXPORT mapSorter
{
public:
ESortBy sortBy;
bool operator()(const CMapHeader & a, const CMapHeader& b)
{
switch (sortBy)
{
case _format:
return (a.version<b.version);
break;
case _loscon:
return (a.lossCondition.typeOfLossCon<b.lossCondition.typeOfLossCon);
break;
case _playerAm:
int playerAmntB,humenPlayersB,playerAmntA,humenPlayersA;
playerAmntB=humenPlayersB=playerAmntA=humenPlayersA=0;
for (int i=0;i<8;i++)
{
if (a.players[i].canHumanPlay) {playerAmntA++;humenPlayersA++;}
else if (a.players[i].canComputerPlay) {playerAmntA++;}
if (b.players[i].canHumanPlay) {playerAmntB++;humenPlayersB++;}
else if (b.players[i].canComputerPlay) {playerAmntB++;}
}
if (playerAmntB!=playerAmntA)
return (playerAmntA<playerAmntB);
else
return (humenPlayersA<humenPlayersB);
break;
case _size:
return (a.width<b.width);
break;
case _viccon:
return (a.victoryCondition<b.victoryCondition);
break;
case _name:
return (a.name<b.name);
break;
default:
return (a.name<b.name);
break;
}
};
mapSorter(ESortBy es):sortBy(es){};
};
struct DLL_EXPORT Mapa
{
Eformat version; // version of map Eformat
ui32 checksum;
int twoLevel; // if map has underground level
int difficulty; // 0 easy - 4 impossible
int levelLimit;
bool areAnyPLayers; // if there are any playable players on map
std::string name; //name of map
std::string description; //and description
int height, width;
TerrainTile*** terrain;
std::vector<Rumor> rumors;
std::vector<DisposedHero> disposedHeroes;
std::vector<CGHeroInstance*> predefinedHeroes;
std::vector<CGDefInfo *> defy; // list of .def files with definitions from .h3m (may be custom)
std::set<CGDefInfo *> defs; // other defInfos - for randomized objects, objects added or modified by scripts
PlayerInfo players[8]; // info about players
std::vector<int> teams; // teams[i] = team of player no i
LossCondition lossCondition;
EvictoryConditions victoryCondition; //victory conditions
CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
int howManyTeams;
std::vector<bool> allowedSpell; //allowedSpell[spell_ID] - if the spell is allowed
std::vector<bool> allowedArtifact; //allowedArtifact[artifact_ID] - if the artifact is allowed
std::vector<bool> allowedAbilities; //allowedAbilities[ability_ID] - if the ability is allowed
std::vector<bool> allowedHeroes; //allowedHeroes[hero_ID] - if the hero is allowed
std::vector<CMapEvent> events;
int3 grailPos;
int grailRadious;
std::vector<CGObjectInstance*> objects;
std::vector<CGHeroInstance*> heroes;
std::vector<CGTownInstance*> towns;
void initFromBytes(unsigned char * bufor); //creates map from decompressed .h3m data
void readEvents( unsigned char * bufor, int &i);
void readObjects( unsigned char * bufor, int &i);
void readDefInfo( unsigned char * bufor, int &i);
void readTerrain( unsigned char * bufor, int &i);
void readPredefinedHeroes( unsigned char * bufor, int &i);
void readHeader( unsigned char * bufor, int &i);
void readRumors( unsigned char * bufor, int &i);
void loadViCLossConditions( unsigned char * bufor, int &i);
void loadPlayerInfo( int &pom, unsigned char * bufor, int &i);
void loadHero( CGObjectInstance * &nobj, unsigned char * bufor, int &i);
void loadTown( CGObjectInstance * &nobj, unsigned char * bufor, int &i);
int loadSeerHut( unsigned char * bufor, int i, CGObjectInstance *& nobj);
void addBlockVisTiles(CGObjectInstance * obj);
void removeBlockVisTiles(CGObjectInstance * obj);
Mapa(std::string filename); //creates map structure from .h3m file
CGHeroInstance * getHero(int ID, int mode=0);
bool isInTheMap(int3 pos);
template <typename Handler> void serialize(Handler &h, const int version)
{
h & version & name & description & width & height & twoLevel & difficulty & levelLimit & rumors & defy & defs
& players & teams & lossCondition & victoryCondition & howManyTeams & allowedSpell & allowedAbilities
& allowedArtifact &allowedHeroes & events;
//TODO: viccondetails
if(h.saving)
{
//saving terrain
for (int i = 0; i < width ; i++)
for (int j = 0; j < height ; j++)
for (int k = 0; k <= twoLevel ; k++)
h & terrain[i][j][k];
}
else
{
//loading terrain
terrain = new TerrainTile**[width]; // allocate memory
for (int ii=0;ii<width;ii++)
{
terrain[ii] = new TerrainTile*[height]; // allocate memory
for(int jj=0;jj<height;jj++)
terrain[ii][jj] = new TerrainTile[twoLevel+1];
}
for (int i = 0; i < width ; i++)
for (int j = 0; j < height ; j++)
for (int k = 0; k <= twoLevel ; k++)
h & terrain[i][j][k];
}
//TODO: recreate blockvis maps
}
};
#endif // __MAP_H__

1824
nodrze.h

File diff suppressed because it is too large Load Diff

View File

@ -1,173 +1,172 @@
#ifndef CGAMEHANDLER_H
#define CGAMEHANDLER_H
#pragma once
#include "../global.h"
#include <set>
#include "../client/FunctionList.h"
#include "../CGameState.h"
#include "../lib/Connection.h"
#include "../lib/IGameCallback.h"
#include <boost/function.hpp>
#include <boost/thread.hpp>
class CVCMIServer;
class CGameState;
struct StartInfo;
class CCPPObjectScript;
class CScriptCallback;
struct BattleResult;
struct BattleAttack;
struct BattleStackAttacked;
template <typename T> struct CPack;
template <typename T> struct Query;
class CGHeroInstance;
extern std::map<ui32, CFunctionList<void(ui32)> > callbacks; //question id => callback functions - for selection dialogs
extern boost::mutex gsm;
struct PlayerStatus
{
bool makingTurn, engagedIntoBattle;
std::set<ui32> queries;
PlayerStatus():makingTurn(false),engagedIntoBattle(false){};
template <typename Handler> void serialize(Handler &h, const int version)
{
h & makingTurn & engagedIntoBattle & queries;
}
};
class PlayerStatuses
{
public:
std::map<ui8,PlayerStatus> players;
boost::mutex mx;
boost::condition_variable cv; //notifies when any changes are made
void addPlayer(ui8 player);
PlayerStatus operator[](ui8 player);
bool hasQueries(ui8 player);
bool checkFlag(ui8 player, bool PlayerStatus::*flag);
void setFlag(ui8 player, bool PlayerStatus::*flag, bool val);
void addQuery(ui8 player, ui32 id);
void removeQuery(ui8 player, ui32 id);
template <typename Handler> void serialize(Handler &h, const int version)
{
h & players;
}
};
class CGameHandler : public IGameCallback
{
static ui32 QID;
CGameState *gs;
//std::set<CCPPObjectScript *> cppscripts; //C++ scripts
//std::map<int, std::map<std::string, CObjectScript*> > objscr; //non-C++ scripts
CVCMIServer *s;
std::map<int,CConnection*> connections; //player color -> connection to clinet with interface of that player
PlayerStatuses states; //player color -> player state
std::set<CConnection*> conns;
void changeSecSkill(int ID, ui16 which, int val, bool abs=false);
void giveSpells(const CGTownInstance *t, const CGHeroInstance *h);
void moveStack(int stack, int dest);
void startBattle(CCreatureSet army1, CCreatureSet army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, boost::function<void(BattleResult*)> cb); //use hero=NULL for no hero
void prepareAttack(BattleAttack &bat, CStack *att, CStack *def); //if last parameter is true, attack is by shooting, if false it's a melee attack
void prepareAttacked(BattleStackAttacked &bsa, CStack *def);
void checkForBattleEnd( std::vector<CStack*> &stacks );
void setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army1, CCreatureSet &army2, CGHeroInstance * hero1, CGHeroInstance * hero2 );
public:
CGameHandler(void);
~CGameHandler(void);
//////////////////////////////////////////////////////////////////////////
//from IGameCallback
//get info
int getOwner(int heroID);
int getResource(int player, int which);
int getSelectedHero();
int getDate(int mode=0);
const CGObjectInstance* getObj(int objid);
const CGHeroInstance* getHero(int objid);
const CGTownInstance* getTown(int objid);
const CGHeroInstance* getSelectedHero(int player); //NULL if no hero is selected
int getCurrentPlayer();
//do sth
void changeSpells(int hid, bool give, const std::set<ui32> &spells);
void removeObject(int objid);
void setBlockVis(int objid, bool bv);
void setOwner(int objid, ui8 owner);
void setHoverName(int objid, MetaString * name);
void changePrimSkill(int ID, int which, int val, bool abs=false);
void showInfoDialog(InfoWindow *iw);
void showYesNoDialog(YesNoDialog *iw, const CFunctionList<void(ui32)> &callback);
void showSelectionDialog(SelectionDialog *iw, const CFunctionList<void(ui32)> &callback); //returns question id
void giveResource(int player, int which, int val);
void showCompInfo(ShowInInfobox * comp);
void heroVisitCastle(int obj, int heroID);
void stopHeroVisitCastle(int obj, int heroID);
void giveHeroArtifact(int artid, int hid, int position); //pos==-1 - first free slot in backpack; pos==-2 - default if available or backpack
void startBattleI(const CCreatureSet * army1, const CCreatureSet * army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, boost::function<void(BattleResult*)> cb); //use hero=NULL for no hero
void startBattleI(int heroID, CCreatureSet army, int3 tile, boost::function<void(BattleResult*)> cb); //for hero<=>neutral army
void setAmount(int objid, ui32 val);
void moveHero(int hid, int3 pos, bool instant);
//////////////////////////////////////////////////////////////////////////
void init(StartInfo *si, int Seed);
void handleConnection(std::set<int> players, CConnection &c);
template <typename Handler> void serialize(Handler &h, const int version)
{
h & QID & gs & states;
}
template <typename T> void applyAndAsk(Query<T> * sel, ui8 player, boost::function<void(ui32)> &callback)
{
gsm.lock();
sel->id = QID;
callbacks[QID] = callback;
states.addQuery(player,QID);
QID++;
sendAndApply(sel);
gsm.unlock();
}
template <typename T> void ask(Query<T> * sel, ui8 player, const CFunctionList<void(ui32)> &callback)
{
gsm.lock();
sel->id = QID;
callbacks[QID] = callback;
states.addQuery(player,QID);
sendToAllClients(sel);
QID++;
gsm.unlock();
}
template <typename T>void sendDataToClients(const T & data)
{
for(std::set<CConnection*>::iterator i=conns.begin(); i!=conns.end();i++)
{
(*i)->wmx->lock();
**i << data;
(*i)->wmx->unlock();
}
}
template <typename T>void sendToAllClients(CPack<T> * info)
{
for(std::set<CConnection*>::iterator i=conns.begin(); i!=conns.end();i++)
{
(*i)->wmx->lock();
**i << info->getType() << *info->This();
(*i)->wmx->unlock();
}
}
template <typename T>void sendAndApply(CPack<T> * info)
{
gs->apply(info);
sendToAllClients(info);
}
void run();
void newTurn();
friend class CVCMIServer;
friend class CScriptCallback;
};
#ifndef CGAMEHANDLER_H
#define CGAMEHANDLER_H
#include "../global.h"
#include <set>
#include "../client/FunctionList.h"
#include "../CGameState.h"
#include "../lib/Connection.h"
#include "../lib/IGameCallback.h"
#include <boost/function.hpp>
#include <boost/thread.hpp>
class CVCMIServer;
class CGameState;
struct StartInfo;
class CCPPObjectScript;
class CScriptCallback;
struct BattleResult;
struct BattleAttack;
struct BattleStackAttacked;
template <typename T> struct CPack;
template <typename T> struct Query;
class CGHeroInstance;
extern std::map<ui32, CFunctionList<void(ui32)> > callbacks; //question id => callback functions - for selection dialogs
extern boost::mutex gsm;
struct PlayerStatus
{
bool makingTurn, engagedIntoBattle;
std::set<ui32> queries;
PlayerStatus():makingTurn(false),engagedIntoBattle(false){};
template <typename Handler> void serialize(Handler &h, const int version)
{
h & makingTurn & engagedIntoBattle & queries;
}
};
class PlayerStatuses
{
public:
std::map<ui8,PlayerStatus> players;
boost::mutex mx;
boost::condition_variable cv; //notifies when any changes are made
void addPlayer(ui8 player);
PlayerStatus operator[](ui8 player);
bool hasQueries(ui8 player);
bool checkFlag(ui8 player, bool PlayerStatus::*flag);
void setFlag(ui8 player, bool PlayerStatus::*flag, bool val);
void addQuery(ui8 player, ui32 id);
void removeQuery(ui8 player, ui32 id);
template <typename Handler> void serialize(Handler &h, const int version)
{
h & players;
}
};
class CGameHandler : public IGameCallback
{
static ui32 QID;
CGameState *gs;
//std::set<CCPPObjectScript *> cppscripts; //C++ scripts
//std::map<int, std::map<std::string, CObjectScript*> > objscr; //non-C++ scripts
CVCMIServer *s;
std::map<int,CConnection*> connections; //player color -> connection to clinet with interface of that player
PlayerStatuses states; //player color -> player state
std::set<CConnection*> conns;
void changeSecSkill(int ID, ui16 which, int val, bool abs=false);
void giveSpells(const CGTownInstance *t, const CGHeroInstance *h);
void moveStack(int stack, int dest);
void startBattle(CCreatureSet army1, CCreatureSet army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, boost::function<void(BattleResult*)> cb); //use hero=NULL for no hero
void prepareAttack(BattleAttack &bat, CStack *att, CStack *def); //if last parameter is true, attack is by shooting, if false it's a melee attack
void prepareAttacked(BattleStackAttacked &bsa, CStack *def);
void checkForBattleEnd( std::vector<CStack*> &stacks );
void setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army1, CCreatureSet &army2, CGHeroInstance * hero1, CGHeroInstance * hero2 );
public:
CGameHandler(void);
~CGameHandler(void);
//////////////////////////////////////////////////////////////////////////
//from IGameCallback
//get info
int getOwner(int heroID);
int getResource(int player, int which);
int getSelectedHero();
int getDate(int mode=0);
const CGObjectInstance* getObj(int objid);
const CGHeroInstance* getHero(int objid);
const CGTownInstance* getTown(int objid);
const CGHeroInstance* getSelectedHero(int player); //NULL if no hero is selected
int getCurrentPlayer();
//do sth
void changeSpells(int hid, bool give, const std::set<ui32> &spells);
void removeObject(int objid);
void setBlockVis(int objid, bool bv);
void setOwner(int objid, ui8 owner);
void setHoverName(int objid, MetaString * name);
void changePrimSkill(int ID, int which, int val, bool abs=false);
void showInfoDialog(InfoWindow *iw);
void showYesNoDialog(YesNoDialog *iw, const CFunctionList<void(ui32)> &callback);
void showSelectionDialog(SelectionDialog *iw, const CFunctionList<void(ui32)> &callback); //returns question id
void giveResource(int player, int which, int val);
void showCompInfo(ShowInInfobox * comp);
void heroVisitCastle(int obj, int heroID);
void stopHeroVisitCastle(int obj, int heroID);
void giveHeroArtifact(int artid, int hid, int position); //pos==-1 - first free slot in backpack; pos==-2 - default if available or backpack
void startBattleI(const CCreatureSet * army1, const CCreatureSet * army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, boost::function<void(BattleResult*)> cb); //use hero=NULL for no hero
void startBattleI(int heroID, CCreatureSet army, int3 tile, boost::function<void(BattleResult*)> cb); //for hero<=>neutral army
void setAmount(int objid, ui32 val);
void moveHero(int hid, int3 pos, bool instant);
//////////////////////////////////////////////////////////////////////////
void init(StartInfo *si, int Seed);
void handleConnection(std::set<int> players, CConnection &c);
template <typename Handler> void serialize(Handler &h, const int version)
{
h & QID & gs & states;
}
template <typename T> void applyAndAsk(Query<T> * sel, ui8 player, boost::function<void(ui32)> &callback)
{
gsm.lock();
sel->id = QID;
callbacks[QID] = callback;
states.addQuery(player,QID);
QID++;
sendAndApply(sel);
gsm.unlock();
}
template <typename T> void ask(Query<T> * sel, ui8 player, const CFunctionList<void(ui32)> &callback)
{
gsm.lock();
sel->id = QID;
callbacks[QID] = callback;
states.addQuery(player,QID);
sendToAllClients(sel);
QID++;
gsm.unlock();
}
template <typename T>void sendDataToClients(const T & data)
{
for(std::set<CConnection*>::iterator i=conns.begin(); i!=conns.end();i++)
{
(*i)->wmx->lock();
**i << data;
(*i)->wmx->unlock();
}
}
template <typename T>void sendToAllClients(CPack<T> * info)
{
for(std::set<CConnection*>::iterator i=conns.begin(); i!=conns.end();i++)
{
(*i)->wmx->lock();
**i << info->getType() << *info->This();
(*i)->wmx->unlock();
}
}
template <typename T>void sendAndApply(CPack<T> * info)
{
gs->apply(info);
sendToAllClients(info);
}
void run();
void newTurn();
friend class CVCMIServer;
friend class CScriptCallback;
};
#endif //CGAMEHANDLER_H

View File

@ -1,32 +1,34 @@
#pragma once
#include "../global.h"
#include <set>
class CConnection;
namespace boost
{
namespace asio
{
class io_service;
namespace ip
{
class tcp;
}
template <typename Protocol> class socket_acceptor_service;
template <typename Protocol,typename SocketAcceptorService>
class basic_socket_acceptor;
}
};
class CVCMIServer
{
boost::asio::io_service *io;
boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > * acceptor;
std::map<int,CConnection*> connections;
std::set<CConnection*> conns;
public:
CVCMIServer();
~CVCMIServer();
void setUpConnection(CConnection *c, std::string mapname, si32 checksum);
void newGame(CConnection *c);
void start();
};
#ifndef __CVCMISERVER_H__
#define __CVCMISERVER_H__
#include "../global.h"
#include <set>
class CConnection;
namespace boost
{
namespace asio
{
class io_service;
namespace ip
{
class tcp;
}
template <typename Protocol> class socket_acceptor_service;
template <typename Protocol,typename SocketAcceptorService>
class basic_socket_acceptor;
}
};
class CVCMIServer
{
boost::asio::io_service *io;
boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > * acceptor;
std::map<int,CConnection*> connections;
std::set<CConnection*> conns;
public:
CVCMIServer();
~CVCMIServer();
void setUpConnection(CConnection *c, std::string mapname, si32 checksum);
void newGame(CConnection *c);
void start();
};
#endif // __CVCMISERVER_H__

View File

@ -0,0 +1,92 @@
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# NOCDDL
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
# build
build: .build-post
.build-pre:
# Add your pre 'build' code here...
.build-post: .build-impl
# Add your post 'build' code here...
# clean
clean: .clean-post
.clean-pre:
# Add your pre 'clean' code here...
.clean-post: .clean-impl
# Add your post 'clean' code here...
# clobber
clobber: .clobber-post
.clobber-pre:
# Add your pre 'clobber' code here...
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
# all
all: .all-post
.all-pre:
# Add your pre 'all' code here...
.all-post: .all-impl
# Add your post 'all' code here...
# help
help: .help-post
.help-pre:
# Add your pre 'help' code here...
.help-post: .help-impl
# Add your post 'help' code here...
# include project implementation makefile
include nbproject/Makefile-impl.mk

View File

@ -1,27 +1,27 @@
#ifndef _ZJEBANYNAGLOWEKWINDOWEGOVISUALAKTORENIKTNIEUZYWA_H
#define _ZJEBANYNAGLOWEKWINDOWEGOVISUALAKTORENIKTNIEUZYWA_H
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#ifdef _MSC_VER
#pragma once
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <cstdio>
#ifdef _WIN32
#include <tchar.h>
#else
#include "tchar_amigaos4.h"
#endif
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include "global.h"
// TODO: reference additional headers your program requires here
#endif //_ZJEBANYNAGLOWEKWINDOWEGOVISUALAKTORENIKTNIEUZYWA_H
#ifndef __STDAFX_H__
#define __STDAFX_H__
#ifndef __STDAFX_H__
#define __STDAFX_H__
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <cstdio>
#ifdef _WIN32
#include <tchar.h>
#else
#include "tchar_amigaos4.h"
#endif
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include "global.h"
// TODO: reference additional headers your program requires here
#endif // __STDAFX_H__
#endif // __STDAFX_H__