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

set handicap

This commit is contained in:
Laserlicht 2024-07-24 22:37:59 +02:00
parent 5310f94e99
commit dc54261574

View File

@ -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