mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
drawing
This commit is contained in:
parent
c40c747ccf
commit
481cd89dc8
@ -448,14 +448,37 @@ void OptionsTab::SelectionWindow::apply()
|
||||
{
|
||||
close();
|
||||
|
||||
CSH->setPlayerOption(LobbyChangePlayerOption::TOWN, 1, color);
|
||||
setSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsTab::SelectionWindow::setSelection()
|
||||
{
|
||||
int selectedFractionPos = -1;
|
||||
for(int i = 0; i<factions.size(); i++)
|
||||
if(factions[i] == selectedFraction)
|
||||
selectedFractionPos = i;
|
||||
|
||||
int initialFractionPos = -1;
|
||||
for(int i = 0; i<factions.size(); i++)
|
||||
if(factions[i] == initialFraction)
|
||||
initialFractionPos = i;
|
||||
|
||||
int deltatown = selectedFractionPos - initialFractionPos;
|
||||
|
||||
if(deltatown != 0)
|
||||
for(int i = 0; i<abs(deltatown); i++)
|
||||
CSH->setPlayerOption(LobbyChangePlayerOption::TOWN, deltatown > 0 ? 1 : -1, color);
|
||||
}
|
||||
|
||||
void OptionsTab::SelectionWindow::redraw()
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
components.clear();
|
||||
|
||||
GH.windows().totalRedraw();
|
||||
|
||||
genContentTitle();
|
||||
genContentCastles();
|
||||
genContentHeroes();
|
||||
|
@ -123,6 +123,7 @@ public:
|
||||
|
||||
void apply();
|
||||
void redraw();
|
||||
void setSelection();
|
||||
FactionID getElementCastle(const Point & cursorPosition);
|
||||
HeroTypeID getElementHero(const Point & cursorPosition);
|
||||
int getElementBonus(const Point & cursorPosition);
|
||||
|
Loading…
x
Reference in New Issue
Block a user