mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +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;
|
||||
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;};
|
||||
Button(){};
|
||||
Button(){ourGroup=NULL;};
|
||||
bool selectable, selected;
|
||||
bool highlightable, highlighted;
|
||||
virtual void hover(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
|
||||
{ //
|
||||
public:
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "stdafx.h"
|
||||
#include "CMusicHandler.h"
|
||||
|
||||
void CMusicHandler::initMusics()
|
||||
|
BIN
CPreGame.cpp
BIN
CPreGame.cpp
Binary file not shown.
@ -16,9 +16,11 @@ struct RanSel
|
||||
size[4], twoLevel, showRand;
|
||||
CGroup<> *Ghorcpl, *Ghorcte, *Gconpl, *Gconte, *Gwater, *Gmonster, *Gsize;
|
||||
};
|
||||
|
||||
class MapSel
|
||||
{
|
||||
public:
|
||||
ESortBy sortBy;
|
||||
bool showed;
|
||||
SDL_Surface * bg;
|
||||
int selected;
|
||||
@ -29,7 +31,7 @@ public:
|
||||
int current;
|
||||
std::vector<CMapInfo> ourMaps;
|
||||
IntBut<> small, medium, large, xlarge, all;
|
||||
Button<> nrplayer, mapsize, type, name, viccon, loscon;
|
||||
SetrButton<> nrplayer, mapsize, type, name, viccon, loscon;
|
||||
Slider<> *slid, *descslid;
|
||||
int sizeFilter;
|
||||
int whichWL(int nr);
|
||||
@ -110,6 +112,7 @@ public:
|
||||
void showAskBox (std::string data, void(*f1)(),void(*f2)());
|
||||
void hideBox ();
|
||||
void printMapsFrom(int from);
|
||||
void sortMaps();
|
||||
};
|
||||
|
||||
#endif //CPREGAME_H
|
||||
|
14
map.h
14
map.h
@ -242,7 +242,19 @@ public:
|
||||
return (a.lossCondition.typeOfLossCon<b.lossCondition.typeOfLossCon);
|
||||
break;
|
||||
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;
|
||||
case ESortBy::size:
|
||||
return (a.width<b.width);
|
||||
|
Loading…
Reference in New Issue
Block a user