mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +02:00
* [new] sorting maps in map selection screen (still may be buggy)
* minor improvements
This commit is contained in:
parent
eb688cf1d3
commit
70156a179b
@ -26,12 +26,18 @@ template <class T=ttt> struct Button: public OverButton
|
|||||||
CGroup<T> * ourGroup;
|
CGroup<T> * ourGroup;
|
||||||
Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* gr=NULL, int id=-1)
|
Button( SDL_Rect Pos, T Fun,CDefHandler* Imgs, bool Sel=false, CGroup<T>* gr=NULL, int id=-1)
|
||||||
:fun(Fun),ourGroup(gr){type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;};
|
:fun(Fun),ourGroup(gr){type=0;imgs=Imgs;selectable=Sel;selected=false;state=0;pos=Pos;ID=id;};
|
||||||
Button(){};
|
Button(){ourGroup=NULL;};
|
||||||
bool selectable, selected;
|
bool selectable, selected;
|
||||||
bool highlightable, highlighted;
|
bool highlightable, highlighted;
|
||||||
virtual void hover(bool on=true);
|
virtual void hover(bool on=true);
|
||||||
virtual void select(bool on=true);
|
virtual void select(bool on=true);
|
||||||
};
|
};
|
||||||
|
template <class T=ttt> struct SetrButton: public Button<T>
|
||||||
|
{
|
||||||
|
int key, * poin;
|
||||||
|
virtual void press(bool down=true);
|
||||||
|
SetrButton(){type=0;selectable=selected=false;state=0;}
|
||||||
|
};
|
||||||
template<class T=CPreGame> class Slider
|
template<class T=CPreGame> class Slider
|
||||||
{ //
|
{ //
|
||||||
public:
|
public:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
#include "CMusicHandler.h"
|
#include "CMusicHandler.h"
|
||||||
|
|
||||||
void CMusicHandler::initMusics()
|
void CMusicHandler::initMusics()
|
||||||
|
BIN
CPreGame.cpp
BIN
CPreGame.cpp
Binary file not shown.
@ -16,9 +16,11 @@ struct RanSel
|
|||||||
size[4], twoLevel, showRand;
|
size[4], twoLevel, showRand;
|
||||||
CGroup<> *Ghorcpl, *Ghorcte, *Gconpl, *Gconte, *Gwater, *Gmonster, *Gsize;
|
CGroup<> *Ghorcpl, *Ghorcte, *Gconpl, *Gconte, *Gwater, *Gmonster, *Gsize;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MapSel
|
class MapSel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
ESortBy sortBy;
|
||||||
bool showed;
|
bool showed;
|
||||||
SDL_Surface * bg;
|
SDL_Surface * bg;
|
||||||
int selected;
|
int selected;
|
||||||
@ -29,7 +31,7 @@ public:
|
|||||||
int current;
|
int current;
|
||||||
std::vector<CMapInfo> ourMaps;
|
std::vector<CMapInfo> ourMaps;
|
||||||
IntBut<> small, medium, large, xlarge, all;
|
IntBut<> small, medium, large, xlarge, all;
|
||||||
Button<> nrplayer, mapsize, type, name, viccon, loscon;
|
SetrButton<> nrplayer, mapsize, type, name, viccon, loscon;
|
||||||
Slider<> *slid, *descslid;
|
Slider<> *slid, *descslid;
|
||||||
int sizeFilter;
|
int sizeFilter;
|
||||||
int whichWL(int nr);
|
int whichWL(int nr);
|
||||||
@ -110,6 +112,7 @@ public:
|
|||||||
void showAskBox (std::string data, void(*f1)(),void(*f2)());
|
void showAskBox (std::string data, void(*f1)(),void(*f2)());
|
||||||
void hideBox ();
|
void hideBox ();
|
||||||
void printMapsFrom(int from);
|
void printMapsFrom(int from);
|
||||||
|
void sortMaps();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //CPREGAME_H
|
#endif //CPREGAME_H
|
||||||
|
14
map.h
14
map.h
@ -242,7 +242,19 @@ public:
|
|||||||
return (a.lossCondition.typeOfLossCon<b.lossCondition.typeOfLossCon);
|
return (a.lossCondition.typeOfLossCon<b.lossCondition.typeOfLossCon);
|
||||||
break;
|
break;
|
||||||
case ESortBy::playerAm:
|
case ESortBy::playerAm:
|
||||||
//TODO
|
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;
|
break;
|
||||||
case ESortBy::size:
|
case ESortBy::size:
|
||||||
return (a.width<b.width);
|
return (a.width<b.width);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user