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

Changes in CPreGame

* replaced tamplates callbacks with boost-function
* updates settings when selecting new map after changing sorting criteria
* if sorting not by name, name will be used as a secondary criteria
* when filter is applied a first available map is selected automatically
This commit is contained in:
Michał W. Urbańczyk 2008-08-05 13:56:16 +00:00
parent f203058270
commit b779b6c6ef
2 changed files with 162 additions and 115 deletions

View File

@ -30,6 +30,21 @@ bool isItIn(const SDL_Rect * rect, int x, int y);
namespace fs = boost::filesystem;
namespace s = CSDL_Ext;
HighButton::HighButton( SDL_Rect Pos, CDefHandler* Imgs, bool Sel, int id)
{
type=0;
imgs=Imgs;
selectable=Sel;
selected=false;
state=0;
pos=Pos;
ID=id;
highlightable=false;
};
HighButton::HighButton()
{
state=0;
}
void HighButton::show()
{
blitAt(imgs->ourImages[state].bitmap,pos.x,pos.y);
@ -44,8 +59,25 @@ void HighButton::press(bool down)
SDL_BlitSurface(imgs->ourImages[i].bitmap,NULL,screen,&pos);
updateRect(&pos);
}
Button::Button( SDL_Rect Pos, boost::function<void()> Fun,CDefHandler* Imgs, bool Sel, CGroup* gr, int id)
:HighButton(Pos,Imgs,Sel,id),ourGroup(gr),fun(Fun)
{
type=1;
};
Button::Button()
{
ourGroup=NULL;type=1;
};
template <class T> void SetrButton<T>::press(bool down)
SetrButton::SetrButton()
{
type=1;
selectable=false;
selected=false;
state=0;
highlightable=false;
}
void SetrButton::press(bool down)
{
#ifndef __GNUC__
if (!down && state==1)
@ -70,11 +102,11 @@ void HighButton::hover(bool on)
SDL_BlitSurface(imgs->ourImages[i].bitmap,NULL,screen,&pos);
updateRect(&pos);
}
template <class T> void Button<T>::hover(bool on)
void Button::hover(bool on)
{
HighButton::hover(on);
}
template <class T> void Button<T>::select(bool on)
void Button::select(bool on)
{
int i;
if (on) state=i=3;
@ -89,11 +121,7 @@ template <class T> void Button<T>::select(bool on)
}
}
//void Slider::clickDown(int x, int y, bool bzgl=true);
//void Slider::clickUp(int x, int y, bool bzgl=true);
//void Slider::mMove(int x, int y, bool bzgl=true);
template <> void Slider<CPreGame>::updateSlid()
void Slider::updateSlid()
{
float perc = ((float)whereAreWe)/((float)positionsAmnt-capacity);
float myh;
@ -114,20 +142,19 @@ template <> void Slider<CPreGame>::updateSlid()
updateRect(&pos);
}
template<> void Slider<CPreGame>::moveDown()
void Slider::moveDown()
{
if (whereAreWe<positionsAmnt-capacity)
(CPG->*fun)(++whereAreWe);
fun(++whereAreWe);
updateSlid();
}
template<> void Slider<CPreGame>::moveUp()
void Slider::moveUp()
{
if (whereAreWe>0)
(CPG->*fun)(--whereAreWe);
fun(--whereAreWe);
updateSlid();
}
//void Slider::moveByOne(bool up);
template<> Slider<CPreGame>::Slider(int x, int y, int h, int amnt, int cap, bool ver)
Slider::Slider(int x, int y, int h, int amnt, int cap, bool ver)
{
vertical=ver;
positionsAmnt = amnt;
@ -135,26 +162,26 @@ template<> Slider<CPreGame>::Slider(int x, int y, int h, int amnt, int cap, bool
if (ver)
{
pos = genRect(h,16,x,y);
down = Button<void(Slider::*)()>(genRect(16,16,x,y+h-16),&Slider::moveDown,CGI->spriteh->giveDef("SCNRBDN.DEF"),false);
up = Button<void(Slider::*)()>(genRect(16,16,x,y),&Slider::moveUp,CGI->spriteh->giveDef("SCNRBUP.DEF"),false);
slider = Button<void(Slider::*)()>(genRect(16,16,x,y+16),NULL,CGI->spriteh->giveDef("SCNRBSL.DEF"),false);
down = Button(genRect(16,16,x,y+h-16),boost::bind(&Slider::moveDown,this),CGI->spriteh->giveDef("SCNRBDN.DEF"),false);
up = Button(genRect(16,16,x,y),boost::bind(&Slider::moveUp,this),CGI->spriteh->giveDef("SCNRBUP.DEF"),false);
slider = Button(genRect(16,16,x,y+16),boost::function<void()>(),CGI->spriteh->giveDef("SCNRBSL.DEF"),false);
}
else
{
pos = genRect(16,h,x,y);
down = Button<void(Slider::*)()>(genRect(16,16,x+h-16,y),&Slider::moveDown,CGI->spriteh->giveDef("SCNRBRT.DEF"),false);
up = Button<void(Slider::*)()>(genRect(16,16,x,y),&Slider::moveUp,CGI->spriteh->giveDef("SCNRBLF.DEF"),false);
slider = Button<void(Slider::*)()>(genRect(16,16,x+16,y),NULL,CGI->spriteh->giveDef("SCNRBSL.DEF"),false);
down = Button(genRect(16,16,x+h-16,y),boost::bind(&Slider::moveDown,this),CGI->spriteh->giveDef("SCNRBRT.DEF"),false);
up = Button(genRect(16,16,x,y),boost::bind(&Slider::moveUp,this),CGI->spriteh->giveDef("SCNRBLF.DEF"),false);
slider = Button(genRect(16,16,x+16,y),boost::function<void()>(),CGI->spriteh->giveDef("SCNRBSL.DEF"),false);
}
moving = false;
whereAreWe=0;
}
template<>void Slider<CPreGame>::deactivate()
void Slider::deactivate()
{
CPG->interested.erase(std::find(CPG->interested.begin(),CPG->interested.end(),this));
}
template<>void Slider<CPreGame>::activate()
void Slider::activate()
{
SDL_FillRect(screen,&pos,0);
up.show();
@ -165,7 +192,7 @@ template<>void Slider<CPreGame>::activate()
CPG->interested.push_back(this);
}
template<>void Slider<CPreGame>::handleIt(SDL_Event sEvent)
void Slider::handleIt(SDL_Event sEvent)
{
if ((sEvent.type==SDL_MOUSEBUTTONDOWN) && (sEvent.button.button == SDL_BUTTON_LEFT))
{
@ -203,7 +230,7 @@ template<>void Slider<CPreGame>::handleIt(SDL_Event sEvent)
whereAreWe = pe*(positionsAmnt-capacity);
if (whereAreWe<0)whereAreWe=0;
updateSlid();
(CPG->*fun)(whereAreWe);
fun(whereAreWe);
}
}
else if ((sEvent.type==SDL_MOUSEBUTTONUP) && (sEvent.button.button == SDL_BUTTON_LEFT))
@ -211,11 +238,11 @@ template<>void Slider<CPreGame>::handleIt(SDL_Event sEvent)
if ((down.state==1) && isItIn(&down.pos,sEvent.motion.x,sEvent.motion.y))
{
(this->*down.fun)();
this->down.fun();
}
if ((up.state==1) && isItIn(&up.pos,sEvent.motion.x,sEvent.motion.y))
{
(this->*up.fun)();
this->up.fun();
}
if (down.state==1) down.press(false);
if (up.state==1) up.press(false);
@ -266,7 +293,7 @@ template<>void Slider<CPreGame>::handleIt(SDL_Event sEvent)
whereAreWe=ktory;
updateSlid();
}
(CPG->*fun)(whereAreWe);
fun(whereAreWe);
}
}
@ -305,6 +332,31 @@ template<>void Slider<CPreGame>::handleIt(SDL_Event sEvent)
}*/
}
IntBut::IntBut()
{
type=2;
fun=NULL;
highlightable=false;
}
void IntBut::set()
{
*what=key;
}
void CPoinGroup::setYour(IntSelBut * your)
{
*gdzie=your->key;
};
IntSelBut::IntSelBut( SDL_Rect Pos, boost::function<void()> Fun,CDefHandler* Imgs, bool Sel, CPoinGroup* gr, int My)
: Button(Pos,Fun,Imgs,Sel,gr),key(My)
{
ourPoinGroup=gr;
};
void IntSelBut::select(bool on)
{
Button::select(on);
ourPoinGroup->setYour(this);
CPG->printRating();
}
/********************************************************************************************/
void PreGameTab::show()
{
@ -621,8 +673,8 @@ void Options::init()
rCastle = CGI->bitmaph->loadBitmap("HPSRAND0.bmp");
nHero = CGI->bitmaph->loadBitmap("HPSRAND6.bmp");
nCastle = CGI->bitmaph->loadBitmap("HPSRAND5.bmp");
turnLength = new Slider<>(57,557,195,11,1,false);
turnLength->fun=&CPreGame::setTurnLength;
turnLength = new Slider(57,557,195,11,1,false);
turnLength->fun=boost::bind(&CPreGame::setTurnLength,CPG,_1);
flags.push_back(CGI->spriteh->giveDef("AOFLGBR.DEF"));
flags.push_back(CGI->spriteh->giveDef("AOFLGBB.DEF"));
@ -977,7 +1029,7 @@ void MapSel::init()
loscon.key=_loscon;
nrplayer.poin=mapsize.poin=type.poin=name.poin=viccon.poin=loscon.poin=(int*)(&sortBy);
nrplayer.fun=mapsize.fun=type.fun=name.fun=viccon.fun=loscon.fun=&CPreGame::sortMaps;
nrplayer.fun=mapsize.fun=type.fun=name.fun=viccon.fun=loscon.fun=boost::bind(&CPreGame::sortMaps,CPG);
Dtypes = CGI->spriteh->giveDef("SCSELC.DEF");
Dvic = CGI->spriteh->giveDef("SCNRVICT.DEF");
@ -1023,8 +1075,8 @@ void MapSel::init()
delete[] file2;
}
std::sort(ourMaps.begin(),ourMaps.end(),mapSorter(_name));
slid = new Slider<>(375,92,480,ourMaps.size(),18,true);
slid->fun = &CPreGame::printMapsFrom;
slid = new Slider(375,92,480,ourMaps.size(),18,true);
slid->fun = boost::bind(&CPreGame::printMapsFrom,CPG,_1);
}
void MapSel::moveByOne(bool up)
{
@ -1049,9 +1101,9 @@ void MapSel::moveByOne(bool up)
select(help);
slid->updateSlid();
}
void MapSel::select(int which, bool updateMapsList)
void MapSel::select(int which, bool updateMapsList, bool forceSettingsUpdate)
{
bool dontSaveSettings = ((selected!=which) || (CPG->ret.playerInfos.size()==0));
bool dontSaveSettings = ((selected!=which) || (CPG->ret.playerInfos.size()==0) || forceSettingsUpdate);
selected = which;
if(updateMapsList)
printMaps(slid->whereAreWe,18,0,true);
@ -1346,26 +1398,26 @@ void CPreGame::initScenSel()
SDL_SetColorKey(ourScenSel->randMap,SDL_SRCCOLORKEY,SDL_MapRGB(ourScenSel->randMap->format,0,255,255));
SDL_SetColorKey(ourScenSel->options,SDL_SRCCOLORKEY,SDL_MapRGB(ourScenSel->options->format,0,255,255));
ourScenSel->difficulty = new CPoinGroup<>();
ourScenSel->difficulty = new CPoinGroup();
ourScenSel->difficulty->type=1;
ourScenSel->selectedDiff=-77;
ourScenSel->difficulty->gdzie = &ourScenSel->selectedDiff;
ourScenSel->bEasy = IntSelBut<>(genRect(0,0,506,456),NULL,CGI->spriteh->giveDef("GSPBUT3.DEF"),true,ourScenSel->difficulty,0);
ourScenSel->bNormal = IntSelBut<>(genRect(0,0,538,456),NULL,CGI->spriteh->giveDef("GSPBUT4.DEF"),true,ourScenSel->difficulty,1);
ourScenSel->bHard = IntSelBut<>(genRect(0,0,570,456),NULL,CGI->spriteh->giveDef("GSPBUT5.DEF"),true,ourScenSel->difficulty,2);
ourScenSel->bExpert = IntSelBut<>(genRect(0,0,602,456),NULL,CGI->spriteh->giveDef("GSPBUT6.DEF"),true,ourScenSel->difficulty,3);
ourScenSel->bImpossible = IntSelBut<>(genRect(0,0,634,456),NULL,CGI->spriteh->giveDef("GSPBUT7.DEF"),true,ourScenSel->difficulty,4);
ourScenSel->bEasy = IntSelBut(genRect(0,0,506,456),NULL,CGI->spriteh->giveDef("GSPBUT3.DEF"),true,ourScenSel->difficulty,0);
ourScenSel->bNormal = IntSelBut(genRect(0,0,538,456),NULL,CGI->spriteh->giveDef("GSPBUT4.DEF"),true,ourScenSel->difficulty,1);
ourScenSel->bHard = IntSelBut(genRect(0,0,570,456),NULL,CGI->spriteh->giveDef("GSPBUT5.DEF"),true,ourScenSel->difficulty,2);
ourScenSel->bExpert = IntSelBut(genRect(0,0,602,456),NULL,CGI->spriteh->giveDef("GSPBUT6.DEF"),true,ourScenSel->difficulty,3);
ourScenSel->bImpossible = IntSelBut(genRect(0,0,634,456),NULL,CGI->spriteh->giveDef("GSPBUT7.DEF"),true,ourScenSel->difficulty,4);
ourScenSel->bBack = Button<>(genRect(0,0,584,535),&CPreGame::showNewMenu,CGI->spriteh->giveDef("SCNRBACK.DEF"));
ourScenSel->bBegin = Button<>(genRect(0,0,414,535),&CPreGame::begin,CGI->spriteh->giveDef("SCNRBEG.DEF"));
ourScenSel->bBack = Button(genRect(0,0,584,535),boost::bind(&CPreGame::showNewMenu,this),CGI->spriteh->giveDef("SCNRBACK.DEF"));
ourScenSel->bBegin = Button(genRect(0,0,414,535),boost::bind(&CPreGame::begin,this),CGI->spriteh->giveDef("SCNRBEG.DEF"));
ourScenSel->bScens = Button<>(genRect(0,0,414,81),&CPreGame::showScenList,CGI->spriteh->giveDef("GSPBUTT.DEF"));
ourScenSel->bScens = Button(genRect(0,0,414,81),boost::bind(&CPreGame::showScenList,this),CGI->spriteh->giveDef("GSPBUTT.DEF"));
for (int i=0; i<ourScenSel->bScens.imgs->ourImages.size(); i++)
CSDL_Ext::printAt(CGI->generaltexth->allTexts[500],25+i,2+i,GEOR13,zwykly,ourScenSel->bScens.imgs->ourImages[i].bitmap); //"Show Available Scenarios"
ourScenSel->bRandom = Button<>(genRect(0,0,414,105),&CPreGame::showScenList,CGI->spriteh->giveDef("GSPBUTT.DEF"));
ourScenSel->bRandom = Button(genRect(0,0,414,105),boost::bind(&CPreGame::showScenList,this),CGI->spriteh->giveDef("GSPBUTT.DEF"));
for (int i=0; i<ourScenSel->bRandom.imgs->ourImages.size(); i++)
CSDL_Ext::printAt(CGI->generaltexth->allTexts[740],25+i,2+i,GEOR13,zwykly,ourScenSel->bRandom.imgs->ourImages[i].bitmap);
ourScenSel->bOptions = Button<>(genRect(0,0,414,509),&CPreGame::showOptions,CGI->spriteh->giveDef("GSPBUTT.DEF"));
ourScenSel->bOptions = Button(genRect(0,0,414,509),boost::bind(&CPreGame::showOptions,this),CGI->spriteh->giveDef("GSPBUTT.DEF"));
for (int i=0; i<ourScenSel->bOptions.imgs->ourImages.size(); i++)
CSDL_Ext::printAt(CGI->generaltexth->allTexts[501],25+i,2+i,GEOR13,zwykly,ourScenSel->bOptions.imgs->ourImages[i].bitmap); //"Show Advanced Options"
@ -1640,8 +1692,8 @@ void CPreGame::showAskBox (std::string data, void(*f1)(),void(*f2)())
(*btnspos)[0].y+=pos.y;
(*btnspos)[1].x+=pos.x;
(*btnspos)[1].y+=pos.y;
btns.push_back(new Button<>((*btnspos)[0],&CPreGame::quit,ok,false, NULL,2));
btns.push_back(new Button<>((*btnspos)[1],(&CPreGame::hideBox),cancel,false, NULL,2));
btns.push_back(new Button((*btnspos)[0],boost::bind(&CPreGame::quit,this),ok,false, NULL,2));
btns.push_back(new Button((*btnspos)[1],boost::bind(&CPreGame::hideBox,this),cancel,false, NULL,2));
delete cmh;
delete przyciski;
delete btnspos;
@ -1693,7 +1745,7 @@ void CPreGame::scenHandleEv(SDL_Event& sEvent)
if (isItIn(&btns[i]->pos,sEvent.motion.x,sEvent.motion.y))
{
btns[i]->press(true);
ourScenSel->pressed=(Button<>*)btns[i];
ourScenSel->pressed=(Button*)btns[i];
}
}
if ((currentTab==&ourScenSel->mapsel) && (sEvent.button.y>121) &&(sEvent.button.y<570)
@ -1706,7 +1758,7 @@ void CPreGame::scenHandleEv(SDL_Event& sEvent)
}
else if ((sEvent.type==SDL_MOUSEBUTTONUP) && (sEvent.button.button == SDL_BUTTON_LEFT))
{
Button<> * prnr=ourScenSel->pressed;
Button * prnr=ourScenSel->pressed;
if (ourScenSel->pressed && ourScenSel->pressed->state==1)
{
ourScenSel->pressed->press(false);
@ -1718,17 +1770,18 @@ void CPreGame::scenHandleEv(SDL_Event& sEvent)
{
if (btns[i]->selectable)
btns[i]->select(true);
if (btns[i]->type==1 && ((Button<>*)btns[i])->fun)
(this->*(((Button<>*)btns[i])->fun))();
if (btns[i]->type==1 && ((Button*)btns[i])->fun)
((Button*)btns[i])->fun();
int zz = btns.size();
if (i>=zz)
break;
if (btns[i]==prnr && btns[i]->type==2)
{
((IntBut<> *)(btns[i]))->set();
((IntBut*)(btns[i]))->set();
ourScenSel->mapsel.slid->whereAreWe=0;
ourScenSel->mapsel.slid->updateSlid();
ourScenSel->mapsel.slid->positionsAmnt=ourScenSel->mapsel.countWL();
ourScenSel->mapsel.select(ourScenSel->mapsel.whichWL(0));
ourScenSel->mapsel.printMaps(0);
}
}
@ -1954,7 +2007,7 @@ StartInfo CPreGame::runLoop()
for (int i=0;i<btns.size(); i++)
{
if (isItIn(&btns[i]->pos,sEvent.motion.x,sEvent.motion.y))
(this->*(((Button<>*)btns[i])->fun))();
((Button*)btns[i])->fun();
else
{
btns[i]->press(false);
@ -2070,8 +2123,10 @@ void CPreGame::quitAskBox()
}
void CPreGame::sortMaps()
{
std::sort(ourScenSel->mapsel.ourMaps.begin(),ourScenSel->mapsel.ourMaps.end(),mapSorter(ourScenSel->mapsel.sortBy));
ourScenSel->mapsel.select(0);
std::sort(ourScenSel->mapsel.ourMaps.begin(),ourScenSel->mapsel.ourMaps.end(),mapSorter(_name));
if(ourScenSel->mapsel.sortBy != _name)
std::stable_sort(ourScenSel->mapsel.ourMaps.begin(),ourScenSel->mapsel.ourMaps.end(),mapSorter(ourScenSel->mapsel.sortBy));
ourScenSel->mapsel.select(ourScenSel->mapsel.whichWL(0),false,true);
printMapsFrom(0);
}
void CPreGame::setTurnLength(int on)

View File

@ -10,14 +10,15 @@
#include "CMessage.h"
#include "map.h"
#include "hch/CMusicHandler.h"
#include <boost/function.hpp>
#include <boost/bind.hpp>
class CPreGame;
extern class CPreGame *CPG;
typedef void(CPreGame::*ttt)();
template <class T=ttt> class CGroup;
template <class T=ttt> class CPoinGroup ;
class CGroup;
class CPoinGroup ;
class IntSelBut;
struct HighButton
{
@ -26,9 +27,8 @@ struct HighButton
SDL_Rect pos;
CDefHandler* imgs;
int state;
HighButton( SDL_Rect Pos, CDefHandler* Imgs, bool Sel=false, int id=-1)
{type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;highlightable=false;};
HighButton(){state=0;}
HighButton( SDL_Rect Pos, CDefHandler* Imgs, bool Sel=false, int id=-1);
HighButton();
bool selectable, selected;
bool highlightable, highlighted;
virtual void show();
@ -36,33 +36,33 @@ struct HighButton
virtual void hover(bool on=true)=0;
virtual void select(bool on=true)=0;
};
template <class T=ttt> struct Button: public HighButton
struct Button: public HighButton
{
CGroup<T> * ourGroup;
Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* gr=NULL, int id=-1)
:HighButton(Pos,Imgs,Sel,id),ourGroup(gr),fun(Fun){type=1;};
Button(){ourGroup=NULL;type=1;};
T fun;
CGroup *ourGroup;
Button( SDL_Rect Pos, boost::function<void()> Fun,CDefHandler* Imgs, bool Sel=false, CGroup* gr=NULL, int id=-1);
Button();
boost::function<void()> fun;
virtual void hover(bool on=true);
virtual void select(bool on=true);
};
template <class T=ttt> struct SetrButton: public Button<T>
struct SetrButton: public Button
{
int key, * poin;
virtual void press(bool down=true);
SetrButton(){int type=1;bool selectable=false;bool selected=false;int state=0;bool highlightable=false;}
SetrButton();
};
template<class T=CPreGame> class Slider
{ //
class Slider
{
public:
bool vertical; // false means horizontal
SDL_Rect pos; // position
Button<void(Slider::*)()> up, down, //or left/right
Button up, down, //or left/right
slider;
int positionsAmnt, capacity;// capacity - amount of positions dispplayed at once
int whereAreWe; // first displayed thing
bool moving;
void(T::*fun)(int);
boost::function<void(int)> fun;
void clickDown(int x, int y, bool bzgl=true);
void clickUp(int x, int y, bool bzgl=true);
void mMove(int x, int y, bool bzgl=true);
@ -73,47 +73,39 @@ public:
Slider(int x, int y, int h, int amnt, int cap, bool ver);
void updateSlid();
void handleIt(SDL_Event sev);
};
//template<class T=void(CPreGame::*)(int)>
template<class T=ttt> struct IntBut: public Button<T>
struct IntBut: public Button
{
public:
int key;
int * what;
IntBut(){int type=2;int fun=NULL;bool highlightable=false;};
void set(){*what=key;};
IntBut();
void set();
};
template<class T=ttt> struct IntSelBut: public Button<T>
class CGroup
{
public:
CPoinGroup<T> * ourPoinGroup;
int key;
IntSelBut(){};
IntSelBut( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CPoinGroup<T>* gr=NULL, int My=-1)
: Button<T>(Pos,Fun,Imgs,Sel,gr),key(My){ourPoinGroup=gr;};
void select(bool on=true) {(*this).Button<T>::select(on);ourPoinGroup->setYour(this);
#if !defined(__amigaos4__) && !defined(__unix__)
CPG->printRating();
#else
#warning not compile here
#endif
}
};
template <class T> class CPoinGroup :public CGroup<T>
{
public:
int * gdzie; //where (po polsku, bo by by³o s³owo kluczowe :/)
void setYour(IntSelBut<T> * your){*gdzie=your->key;};
};
template <class T> class CGroup
{
public:
Button<T> * selected;
Button * selected;
int type; // 1=sinsel
CGroup():selected(NULL),type(0){};
};
class CPoinGroup :public CGroup
{
public:
int * gdzie; //where (po polsku, bo by by³o s³owo kluczowe :/)
void setYour(IntSelBut * your);
};
struct IntSelBut: public Button
{
public:
CPoinGroup * ourPoinGroup;
int key;
IntSelBut(){};
IntSelBut( SDL_Rect Pos, boost::function<void()> Fun,CDefHandler* Imgs, bool Sel=false, CPoinGroup* gr=NULL, int My=-1);
void select(bool on=true);
};
class PreGameTab
{
public:
@ -125,9 +117,9 @@ public:
};
class RanSel : public PreGameTab
{
Button<> horcpl[9], horcte[9], conpl[9], conte[8], water[4], monster[4], //last is random
Button horcpl[9], horcte[9], conpl[9], conte[8], water[4], monster[4], //last is random
size[4], twoLevel, showRand;
CGroup<> *Ghorcpl, *Ghorcte, *Gconpl, *Gconte, *Gwater, *Gmonster, *Gsize;
CGroup *Ghorcpl, *Ghorcte, *Gconpl, *Gconte, *Gwater, *Gmonster, *Gsize;
};
class Options : public PreGameTab
{
@ -166,7 +158,7 @@ class Options : public PreGameTab
};
public:
std::set<int> usedHeroes;
Slider<> * turnLength;
Slider * turnLength;
SDL_Surface * bg,
* rHero, * rCastle, * nHero, * nCastle;
std::vector<SDL_Surface*> bgs;
@ -197,9 +189,9 @@ public:
std::vector<SDL_Surface*> scenImgs;
//int current;
std::vector<CMapInfo> ourMaps;
IntBut<> small, medium, large, xlarge, all;
SetrButton<> nrplayer, mapsize, type, name, viccon, loscon;
Slider<> *slid, *descslid;
IntBut small, medium, large, xlarge, all;
SetrButton nrplayer, mapsize, type, name, viccon, loscon;
Slider *slid, *descslid;
int sizeFilter;
int whichWL(int nr);
int countWL();
@ -208,7 +200,7 @@ public:
void init();
std::string gdiff(std::string ss);
void printMaps(int from,int to=18, int at=0, bool abs=false);
void select(int which, bool updateMapsList=true);
void select(int which, bool updateMapsList=true, bool forceSettingsUpdate=false);
void moveByOne(bool up);
void printSelectedInfo();
void printFlags();
@ -222,10 +214,10 @@ public:
//RanSel ransel;
MapSel mapsel;
SDL_Surface * background, *scenInf, *scenList, *randMap, *options ;
Button<> bScens, bOptions, bRandom, bBegin, bBack;
IntSelBut<> bEasy, bNormal, bHard, bExpert, bImpossible;
Button<> * pressed;
CPoinGroup<> * difficulty;
Button bScens, bOptions, bRandom, bBegin, bBack;
IntSelBut bEasy, bNormal, bHard, bExpert, bImpossible;
Button * pressed;
CPoinGroup * difficulty;
std::vector<Mapa> maps;
int selectedDiff;
void initRanSel();
@ -244,7 +236,7 @@ public:
StartInfo ret;
bool run;
bool first; //hasn't we showed the scensel
std::vector<Slider<> *> interested;
std::vector<Slider *> interested;
CMusicHandler * mush;
std::vector<HighButton *> btns;
CPreGameTextHandler * preth ;