mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
set handicap
This commit is contained in:
parent
5310f94e99
commit
dc54261574
@ -835,20 +835,32 @@ OptionsTab::HandicapWindow::HandicapWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
buttons.push_back(std::make_shared<CButton>(Point(159, 367), AnimationPath::builtin("IOKAY"), CButton::tooltip(), [this](){
|
buttons.push_back(std::make_shared<CButton>(Point(159, 367), AnimationPath::builtin("IOKAY"), CButton::tooltip(), [this](){
|
||||||
//for (const auto& player : textinputs)
|
for (const auto& player : textinputs)
|
||||||
// for (const auto& resource : player.second)
|
{
|
||||||
// continue;//todo
|
TResources resources = TResources();
|
||||||
|
int income = 100;
|
||||||
|
for (const auto& resource : player.second)
|
||||||
|
{
|
||||||
|
bool isIncome = resource.first.getNum() == EGameResID::COUNT - 1;
|
||||||
|
if(isIncome)
|
||||||
|
income = std::stoi(resource.second->getText());
|
||||||
|
else
|
||||||
|
resources[resource.first] = std::stoi(resource.second->getText());
|
||||||
|
}
|
||||||
|
CSH->setPlayerHandicap(player.first, PlayerSettings::Handicap{resources, income});
|
||||||
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}, EShortcut::GLOBAL_RETURN));
|
}, EShortcut::GLOBAL_RETURN));
|
||||||
|
|
||||||
updateShadow();
|
updateShadow();
|
||||||
center();
|
center();
|
||||||
|
|
||||||
TResources resourcesStart = TResources();
|
/*TResources resourcesStart = TResources();
|
||||||
resourcesStart[EGameResID::GOLD] = -500000;
|
resourcesStart[EGameResID::GOLD] = -500000;
|
||||||
int resourcesPercent = 120;
|
int resourcesPercent = 120;
|
||||||
//CSH->setPlayerHandicap(s->color, PlayerSettings::Handicap{resourcesStart, resourcesPercent});
|
//CSH->setPlayerHandicap(s->color, PlayerSettings::Handicap{resourcesStart, resourcesPercent});
|
||||||
CSH->setPlayerHandicap((PlayerColor)0, PlayerSettings::Handicap{resourcesStart, resourcesPercent});
|
CSH->setPlayerHandicap((PlayerColor)0, PlayerSettings::Handicap{resourcesStart, resourcesPercent});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OptionsTab::HandicapWindow::receiveEvent(const Point & position, int eventType) const
|
bool OptionsTab::HandicapWindow::receiveEvent(const Point & position, int eventType) const
|
||||||
|
Loading…
Reference in New Issue
Block a user