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

Support for Tree of knowledge and minor changes.

This commit is contained in:
Michał W. Urbańczyk 2008-08-22 12:21:09 +00:00
parent 1c7e3718a7
commit 0607ec70cf
16 changed files with 256 additions and 81 deletions

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "CConsoleHandler.h"
#include "CAdvmapInterface.h"
#include "CCastleInterface.h"
#include "CPlayerInterface.h"
#include "SDL.h"
#include "SDL_thread.h"
@ -48,6 +49,23 @@ int internalFunc(void * callback)
if(pom==std::string("die, fool"))
exit(0);
if(cn==std::string("activate"))
{
int what;
readed >> what;
switch (what)
{
case 0:
LOCPLINT->curint->activate();
break;
case 1:
LOCPLINT->adventureInt->activate();
break;
case 2:
LOCPLINT->castleInt->activate();
break;
}
}
else if(pom==std::string("get txt"))
{
boost::filesystem::create_directory("Extracted_txts");

View File

@ -44,33 +44,35 @@ public:
bool human;
int playerID, serialID;
virtual void init(ICallback * CB){};
virtual void yourTurn(){};
virtual void heroKilled(const CGHeroInstance*){};
virtual void buildChanged(const CGTownInstance *town, int buildingID, int what){}; //what: 1 - built, 2 - demolished
virtual void garrisonChanged(const CGObjectInstance * obj){};
virtual void heroCreated(const CGHeroInstance*){};
virtual void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val){};
virtual void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback)=0; //pskill is gained primary skill, interface has to choose one of given skills and call callback with selection id
virtual void heroInGarrisonChange(const CGTownInstance *town){};
virtual void heroKilled(const CGHeroInstance*){};
virtual void heroMoved(const HeroMoveDetails & details){};
virtual void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val){};
virtual void heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town){};
virtual void tileRevealed(int3 pos){};
virtual void tileHidden(int3 pos){};
virtual void init(ICallback * CB){};
virtual void receivedResource(int type, int val){};
virtual void showInfoDialog(std::string &text, const std::vector<Component*> &components){};
virtual void showSelDialog(std::string &text, const std::vector<Component*> &components, ui32 askID){};
virtual void garrisonChanged(const CGObjectInstance * obj){};
virtual void buildChanged(const CGTownInstance *town, int buildingID, int what){}; //what: 1 - built, 2 - demolished
virtual void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback)=0; //pskill is gained primary skill, interface has to choose one of given skills and call callback with selection id
virtual void heroInGarrisonChange(const CGTownInstance *town){};
virtual void showYesNoDialog(std::string &text, const std::vector<Component*> &components, ui32 askID){};
virtual void tileHidden(int3 pos){};
virtual void tileRevealed(int3 pos){};
virtual void yourTurn(){};
//battle call-ins
//virtual void actionFinished(BattleAction action){};//occurs AFTER every action taken by any stack or by the hero
//virtual void actionStarted(BattleAction action){};//occurs BEFORE every action taken by any stack or by the hero
virtual BattleAction activeStack(int stackID)=0; //called when it's turn of that stack
virtual void battleAttack(BattleAttack *ba){};
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 battleStackKilled(int ID, int dmg, int killed, int IDby, bool byShooting)=0;
virtual void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving)=0;
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 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 actionStarted(BattleAction action){};//occurs BEFORE every action taken by any stack or by the hero
//virtual void actionFinished(BattleAction action){};//occurs AFTER every action taken by any stack or by the hero
virtual BattleAction activeStack(int stackID)=0; //called when it's turn of that stack
virtual void battleEnd(BattleResult *br){};
virtual void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving)=0;
virtual void battleAttack(BattleAttack *ba){};
virtual void battleStackKilled(int ID, int dmg, int killed, int IDby, bool byShooting)=0;
//
};

View File

@ -930,7 +930,7 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
CGHeroInstance * vhi = (map->heroes[i]);
if(!vhi->type)
vhi->type = VLC->heroh->heroes[vhi->subID];
//vhi->subID = vhi->type->ID;
if (vhi->level<1)
{
vhi->exp=40+ran()%50;
@ -958,6 +958,8 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
if (vhi->portrait < 0)
vhi->portrait = vhi->type->ID;
vhi->artifWorn[16] = 3;
//initial army
if (!vhi->army.slots.size()) //standard army
{

121
CLua.cpp
View File

@ -200,12 +200,12 @@ void CVisitableOPH::newObject(int objid)
case 100:
pom = 5;
break;
case 102:
typeOfTree[objid] = rand()%3;
return;
default:
#ifndef __GNUC__
throw new std::exception("Unsupported ID in CVisitableOPH::hoverText");
#else
throw new std::exception();
#endif
std::cout << "Unsupported ID in CVisitableOPH::hoverText" << std::endl;
return;
}
hovername << std::pair<ui8,ui32>(3,os->ID) << " " << std::pair<ui8,ui32>(2,pom);
cb->setHoverName(objid,&hovername);
@ -223,12 +223,14 @@ void CVisitableOPH::newObject(int objid)
void CVisitableOPH::onHeroVisit(int objid, int heroID)
{
DEFOS;
if (visitors.find(objid)!=visitors.end())
{
if(visitors[objid].find(heroID)==visitors[objid].end())
{
onNAHeroVisit(objid,heroID, false);
visitors[objid].insert(heroID);
if(os->ID != 102)
visitors[objid].insert(heroID);
}
else
{
@ -247,29 +249,35 @@ void CVisitableOPH::onHeroVisit(int objid, int heroID)
void CVisitableOPH::onNAHeroVisit(int objid, int heroID, bool alreadyVisited)
{
const CGObjectInstance *os = cb->getObj(objid);
int w=0, ot=0, vvv=1;
int id=0, subid=0, ot=0, val=1;
switch(os->ID)
{
case 51:
w=0;
subid=0;
ot=80;
break;
case 23:
w=1;
subid=1;
ot=39;
break;
case 61:
w=2;
subid=2;
ot=100;
break;
case 32:
w=3;
subid=3;
ot=59;
break;
case 100:
w=4;
id=5;
ot=143;
vvv=1000;
val=1000;
break;
case 102:
id = 5;
subid = 1;
ot = 146;
val = 1;
break;
}
if (!alreadyVisited)
@ -281,22 +289,71 @@ void CVisitableOPH::onNAHeroVisit(int objid, int heroID, bool alreadyVisited)
case 61:
case 32:
{
cb->changePrimSkill(heroID,w,vvv);
cb->changePrimSkill(heroID,subid,val);
InfoWindow iw;
iw.components.push_back(Component(0,w,vvv,0));
iw.components.push_back(Component(0,subid,val,0));
iw.text << std::pair<ui8,ui32>(11,ot);
iw.player = cb->getHeroOwner(heroID);
cb->showInfoDialog(&iw);
break;
}
case 100: //give 1000 exp
case 100: //give exp
{
InfoWindow iw;
iw.components.push_back(Component(0,4,vvv,0));
iw.components.push_back(Component(id,subid,val,0));
iw.player = cb->getHeroOwner(heroID);
iw.text << std::pair<ui8,ui32>(11,ot);
cb->showInfoDialog(&iw);
cb->changePrimSkill(heroID,w,vvv);
cb->changePrimSkill(heroID,4,val);
break;
}
case 102:
{
const CGHeroInstance *h = cb->getHero(heroID);
val = VLC->heroh->reqExp(h->level) + VLC->heroh->reqExp(h->level+val);
if(!typeOfTree[objid])
{
visitors[objid].insert(heroID);
InfoWindow iw;
iw.components.push_back(Component(id,subid,1,0));
iw.player = cb->getHeroOwner(heroID);
iw.text << std::pair<ui8,ui32>(11,148);
cb->showInfoDialog(&iw);
cb->changePrimSkill(heroID,4,val);
break;
}
else
{
int res, resval;
if(typeOfTree[objid]==1)
{
res = 6;
resval = 2000;
ot = 149;
}
else
{
res = 5;
resval = 10;
ot = 151;
}
if(cb->getResource(h->tempOwner,res) < resval) //not enough resources
{
ot++;
InfoWindow iw;
iw.player = h->tempOwner;
iw.text << std::pair<ui8,ui32>(11,ot);
cb->showInfoDialog(&iw);
return;
}
YesNoDialog sd;
sd.player = cb->getHeroOwner(heroID);
sd.text << std::pair<ui8,ui32>(11,ot);
sd.components.push_back(Component(id,subid,val,0));
cb->showYesNoDialog(&sd,CFunctionList<void(ui32)>(boost::bind(&CVisitableOPH::treeSelected,this,objid,heroID,res,resval,val,_1)));
}
break;
}
}
@ -313,15 +370,25 @@ void CVisitableOPH::onNAHeroVisit(int objid, int heroID, bool alreadyVisited)
std::vector<int> CVisitableOPH::yourObjects()
{
std::vector<int> ret(5);
ret.push_back(51);
ret.push_back(23);
ret.push_back(61);
ret.push_back(32);
ret.push_back(100);
std::vector<int> ret;
ret.push_back(51);//camp
ret.push_back(23);//tower
ret.push_back(61);//axis
ret.push_back(32);//garden
ret.push_back(100);//stone
ret.push_back(102);//tree
return ret;
}
void CVisitableOPH::treeSelected( int objid, int heroID, int resType, int resVal, int expVal, ui32 result )
{
if(result==0) //player agreed to give res for exp
{
cb->giveResource(cb->getHeroOwner(heroID),resType,-resVal); //take resource
cb->changePrimSkill(heroID,4,expVal); //give exp
visitors[objid].insert(heroID); //set state to visited
}
}
void CVisitableOPW::onNAHeroVisit(int objid, int heroID, bool alreadyVisited)
{
DEFOS;
@ -621,7 +688,7 @@ void CPickable::chosen(ui32 which, int heroid, int val)
std::vector<int> CPickable::yourObjects() //returns IDs of objects which are handled by script
{
std::vector<int> ret(3);
std::vector<int> ret;
ret.push_back(79); //resource
ret.push_back(5); //artifact
ret.push_back(101); //treasure chest / commander stone
@ -684,7 +751,7 @@ void CHeroScript::onHeroVisit(int objid, int heroID)
}
std::vector<int> CHeroScript::yourObjects() //returns IDs of objects which are handled by script
{
std::vector<int> ret(1);
std::vector<int> ret;
ret.push_back(34); //hero
return ret;
}
@ -743,7 +810,7 @@ void CMonsterS::onHeroVisit(int objid, int heroID)
}
std::vector<int> CMonsterS::yourObjects() //returns IDs of objects which are handled by script
{
std::vector<int> ret(1);
std::vector<int> ret;
ret.push_back(54); //monster
return ret;
}

3
CLua.h
View File

@ -1,5 +1,6 @@
#pragma once
#include "global.h"
#include "client/FunctionList.h"
#ifndef _MSC_VER
extern "C" {
@ -102,11 +103,13 @@ class CVisitableOPH : public CCPPObjectScript //once per hero
{
public:
CVisitableOPH(CScriptCallback * CB):CCPPObjectScript(CB){};
std::map<int, int> typeOfTree; //0 - level for free; 1 - 2000 gold; 2 - 10 gems
std::map<int,std::set<int> > visitors;
void onNAHeroVisit(int objid, int heroID, bool alreadyVisited);
void newObject(int objid);
void onHeroVisit(int objid, int heroID);
void treeSelected(int objid, int heroID, int resType, int resVal, int expVal, ui32 result);
std::vector<int> yourObjects(); //returns IDs of objects which are handled by script
};

View File

@ -605,7 +605,14 @@ void SComponent::init(Etype Type, int Subtype, int Val)
case experience:
description = CGI->generaltexth->allTexts[241];
oss << Val ;
subtitle = oss.str();
if(Subtype && Val==1)
{
subtitle = CGI->generaltexth->allTexts[442];
}
else
{
subtitle = oss.str();
}
break;
}
type = Type;
@ -622,8 +629,8 @@ SComponent::SComponent(Etype Type, int Subtype, int Val)
SComponent::SComponent(const Component &c)
{
if(c.id==0 && c.subtype==4)
init(experience,0,c.val);
if(c.id==5)
init(experience,c.subtype,c.val);
else
init((Etype)c.id,c.subtype,c.val);
@ -2202,6 +2209,29 @@ void CPlayerInterface::showYesNoDialog(std::string &text, const std::vector<SCom
temp->activate();
LOCPLINT->objsToBlit.push_back(temp);
}
void CPlayerInterface::showYesNoDialog( std::string &text, const std::vector<Component*> &components, ui32 askID )
{
boost::unique_lock<boost::mutex> un(*pim);
curint->deactivate(); //dezaktywacja starego interfejsu
std::vector<SComponent*> intComps;
for(int i=0;i<components.size();i++)
intComps.push_back(new SComponent(*components[i])); //will be deleted by CSelWindow::close
std::vector<std::pair<std::string,CFunctionList<void()> > > pom;
pom.push_back(std::pair<std::string,CFunctionList<void()> >("IOKAY.DEF",0));
pom.push_back(std::pair<std::string,CFunctionList<void()> >("ICANCEL.DEF",0));
CInfoWindow * temp = new CInfoWindow(text,playerID,32,intComps,pom);
temp->buttons[0]->callback += boost::bind(&IActivable::activate,curint);
temp->buttons[1]->callback += boost::bind(&IActivable::activate,curint);
temp->buttons[0]->callback += boost::bind(&CCallback::selectionMade,cb,0,askID);
temp->buttons[1]->callback += boost::bind(&CCallback::selectionMade,cb,1,askID);
temp->delComps = true;
temp->activate();
LOCPLINT->objsToBlit.push_back(temp);
}
void CPlayerInterface::removeObjToBlit(IShowable* obj)
{
objsToBlit.erase

View File

@ -333,33 +333,35 @@ public:
std::vector<IShowable*> objsToBlit;
//overloaded funcs from CGameInterface
void yourTurn();
void heroMoved(const HeroMoveDetails & details);
void tileRevealed(int3 pos);
void tileHidden(int3 pos);
void heroKilled(const CGHeroInstance* hero);
void buildChanged(const CGTownInstance *town, int buildingID, int what); //what: 1 - built, 2 - demolished
void garrisonChanged(const CGObjectInstance * obj);
void heroCreated(const CGHeroInstance* hero);
void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
void heroInGarrisonChange(const CGTownInstance *town);
void heroKilled(const CGHeroInstance* hero);
void heroMoved(const HeroMoveDetails & details);
void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val);
void heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town);
void receivedResource(int type, int val);
void showInfoDialog(std::string &text, const std::vector<Component*> &components);
void showSelDialog(std::string &text, const std::vector<Component*> &components, ui32 askID);
void heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town);
void garrisonChanged(const CGObjectInstance * obj);
void buildChanged(const CGTownInstance *town, int buildingID, int what); //what: 1 - built, 2 - demolished
void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
void heroInGarrisonChange(const CGTownInstance *town);
void showYesNoDialog(std::string &text, const std::vector<Component*> &components, ui32 askID);
void tileHidden(int3 pos);
void tileRevealed(int3 pos);
void yourTurn();
//for battles
//void actionFinished(BattleAction action);//occurs AFTER every action taken by any stack or by the hero
//void actionStarted(BattleAction action);//occurs BEFORE every action taken by any stack or by the hero
BattleAction activeStack(int stackID); //called when it's turn of that stack
void battleAttack(BattleAttack *ba);
void battleEnd(BattleResult *br);
void battleNewRound(int round); //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
void battleStackIsShooting(int ID, int dest); //called when stack with id ID is shooting to hex dest
void battleStackKilled(int ID, int dmg, int killed, int IDby, bool byShooting);
void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving);
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
void battlefieldPrepared(int battlefieldType, std::vector<CObstacle*> obstacles); //called when battlefield is prepared, prior the battle beginning
void battleNewRound(int round); //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
//void actionStarted(BattleAction action);//occurs BEFORE every action taken by any stack or by the hero
//void actionFinished(BattleAction action);//occurs AFTER every action taken by any stack or by the hero
BattleAction activeStack(int stackID); //called when it's turn of that stack
void battleEnd(BattleResult *br);
void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving);
void battleAttack(BattleAttack *ba);
void battleStackKilled(int ID, int dmg, int killed, int IDby, bool byShooting);
void battleStackIsShooting(int ID, int dest); //called when stack with id ID is shooting to hex dest
//-------------//

View File

@ -1,11 +1,11 @@
0.61 -> 0.62
General:
* threading and minor changes.
* restructured to the server-client model
* support for heroes starting in town garrisons
* upgrading creatures
* working gaining levels for heroes (including dialog with skill selection)
* added fast graphical cursor
* showing creature amount in the CCreInfoWindow
* added graphical cursor
* showing creature amount in the creature info window
Castles:
* icon in infobox showing that there is hero in town garrison
@ -42,6 +42,9 @@ PreGame:
* when filter is applied a first available map is selected automatically
* slider position updated after sorting in pregame
Objects:
* support for the Tree of knowledge
0.6 -> 0.61 (Jun 15 2008)
Improvements:
* improved attacking in the battles

View File

@ -413,6 +413,18 @@ void CClient::process(int what)
playerint[sd.player]->showSelDialog(str,comps,sd.id);
break;
}
case 2002:
{
YesNoDialog ynd;
*serv >> ynd;
std::cout << "Showing yes/no dialog " <<std::endl;
std::vector<Component*> comps;
for(int i=0;i<ynd.components.size();i++)
comps.push_back(&ynd.components[i]);
std::string str = toString(ynd.text);
playerint[ynd.player]->showYesNoDialog(str,comps,ynd.id);
break;
}
case 3000:
{
BattleStart bs;

View File

@ -13,6 +13,10 @@ public:
{
funcs.push_back(first);
}
CFunctionList(boost::function<Signature> &first)
{
funcs.push_back(first);
}
CFunctionList & operator+=(const boost::function<Signature> &first)
{
funcs.push_back(first);
@ -33,4 +37,11 @@ public:
for(int i=0;i<funcs2.size(); i++)
funcs2[i]();
}
template <typename Arg>
void operator()(const Arg & a) const
{
std::vector<boost::function<Signature> > funcs2 = funcs; //backup
for(int i=0;i<funcs2.size(); i++)
funcs2[i](a);
}
};

View File

@ -42,7 +42,7 @@ unsigned char * CLodHandler::giveFile(std::string defName, int * length)
{
unsigned char * outp = new unsigned char[ourEntry->realSize];
char name[30];memset(name,0,30);
strcat(name,"Sprites/");
strcat(name,"Data/");
strcat(name,(char*)ourEntry->name);
FILE * f = fopen(name,"rb");
int result = fread(outp,1,ourEntry->realSize,f);

View File

@ -246,7 +246,7 @@ struct MetaString : public CPack<MetaString> //2001 helper for object scrips
};
struct Component : public CPack<Component> //2002 helper for object scrips informations
{
ui16 id, subtype; //ids: 0 - primskill; 1 - secskill; 2 - resource; 3 - creature; 4 - artifact; 5 - experience
ui16 id, subtype; //ids: 0 - primskill; 1 - secskill; 2 - resource; 3 - creature; 4 - artifact; 5 - experience (sub==0 exp points; sub==1 levels)
si32 val; // + give; - take
si16 when; // 0 - now; +x - within x days; -x - per x days
@ -325,6 +325,20 @@ struct SelectionDialog : public Query<SelectionDialog>//2001
}
};
struct YesNoDialog : public Query<YesNoDialog>//2002
{
MetaString text;
std::vector<Component> components;
ui8 player;
YesNoDialog(){type = 2002;};
template <typename Handler> void serialize(Handler &h, const int version)
{
h & id & text & components & player;
}
};
struct BattleInfo;
struct BattleStart : public CPack<BattleStart>//3000
{

View File

@ -38,7 +38,7 @@ ui32 CGameHandler::QID = 1;
CondSh<bool> battleMadeAction;
CondSh<BattleResult *> battleResult(NULL);
std::map<ui32, boost::function<void(ui32)> > callbacks; //question id => callback function - for selection dialogs
std::map<ui32, CFunctionList<void(ui32)> > callbacks; //question id => callback function - for selection dialogs
class CMP_stack
{
@ -789,7 +789,7 @@ upgend:
ui32 qid, answer;
c >> qid >> answer;
gsm.lock();
boost::function<void(ui32)> callb = callbacks[qid];
CFunctionList<void(ui32)> callb = callbacks[qid];
callbacks.erase(qid);
gsm.unlock();
callb(answer);

View File

@ -1,6 +1,7 @@
#pragma once
#include "../global.h"
#include <set>
#include "../client/FunctionList.h"
#include "../CGameState.h"
#include "../lib/Connection.h"
#include <boost/function.hpp>
@ -13,7 +14,7 @@ class CScriptCallback;
template <typename T> struct CPack;
template <typename T> struct Query;
class CGHeroInstance;
extern std::map<ui32, boost::function<void(ui32)> > callbacks; //question id => callback function - for selection dialogs
extern std::map<ui32, CFunctionList<void(ui32)> > callbacks; //question id => callback functions - for selection dialogs
extern boost::mutex gsm;
struct PlayerStatus
@ -70,7 +71,7 @@ public:
sendAndApply(sel);
gsm.unlock();
}
template <typename T> void ask(Query<T> * sel, ui8 player, boost::function<void(ui32)> &callback)
template <typename T> void ask(Query<T> * sel, ui8 player, const CFunctionList<void(ui32)> &callback)
{
gsm.lock();
sel->id = QID;

View File

@ -68,12 +68,19 @@ int CScriptCallback::getHeroOwner(int heroID)
{
return gh->gs->map->objects[heroID]->tempOwner;
}
int CScriptCallback::getResource(int player, int which)
{
return gh->gs->players[player].resources[which];
}
void CScriptCallback::showInfoDialog(InfoWindow *iw)
{
gh->sendToAllClients(iw);
}
void CScriptCallback::showSelectionDialog(SelectionDialog *iw, boost::function<void(ui32)> &callback)
void CScriptCallback::showYesNoDialog( YesNoDialog *iw, const CFunctionList<void(ui32)> &callback )
{
gh->ask(iw,iw->player,callback);
}
void CScriptCallback::showSelectionDialog(SelectionDialog *iw, const CFunctionList<void(ui32)> &callback)
{
gh->ask(iw,iw->player,callback);
}

View File

@ -1,7 +1,7 @@
#pragma once
#include "../global.h"
#include <vector>
#include <boost/function.hpp>
#include "../client/FunctionList.h"
class CVCMIServer;
class CGameHandler;
class SComponent;
@ -18,6 +18,7 @@ struct MetaString;
struct InfoWindow;
struct ShowInInfobox;
struct SelectionDialog;
struct YesNoDialog;
class CScriptCallback
{
CScriptCallback(void);
@ -28,6 +29,7 @@ public:
//get info
static int3 getPos(CGObjectInstance * ob);
int getHeroOwner(int heroID);
int getResource(int player, int which);
int getSelectedHero();
int getDate(int mode=0);
const CGObjectInstance* getObj(int objid);
@ -41,7 +43,8 @@ public:
void setHoverName(int objid, MetaString * name);
void changePrimSkill(int ID, int which, int val, bool abs=false);
void showInfoDialog(InfoWindow *iw);
void showSelectionDialog(SelectionDialog *iw, boost::function<void(ui32)> &callback); //returns question id
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);