mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Merge remote-tracking branch 'origin/develop' into fix_rmg_teams
# Conflicts: # Mods/vcmi/config/vcmi/rmg/heroes3/newcomers.JSON # Mods/vcmi/config/vcmi/rmg/heroes3/southOfHell.JSON # Mods/vcmi/config/vcmi/rmg/symmetric/2sm0k.JSON # Mods/vcmi/config/vcmi/rmg/symmetric/2sm2i(2).JSON # Mods/vcmi/config/vcmi/rmg/symmetric/3sb0b.JSON # Mods/vcmi/config/vcmi/rmg/symmetric/3sb0c.JSON # Mods/vcmi/config/vcmi/rmg/symmetric/5sb0a.JSON # Mods/vcmi/config/vcmi/rmg/symmetric/5sb0b.JSON # Mods/vcmi/config/vcmi/rmg/symmetric/7sb0b.JSON # Mods/vcmi/config/vcmi/rmg/symmetric/7sb0c.JSON # client/lobby/RandomMapTab.cpp
This commit is contained in:
@@ -107,7 +107,7 @@ RandomMapTab::RandomMapTab():
|
||||
//new callbacks available only from mod
|
||||
addCallback("teamAlignments", [&](int)
|
||||
{
|
||||
GH.windows().createAndPushWindow<TeamAlignmentsWidget>(*this);
|
||||
GH.windows().createAndPushWindow<TeamAlignments>(*this);
|
||||
});
|
||||
|
||||
for(auto road : VLC->roadTypeHandler->objects)
|
||||
@@ -424,6 +424,18 @@ void TeamAlignmentsWidget::checkTeamCount()
|
||||
}
|
||||
}
|
||||
|
||||
TeamAlignments::TeamAlignments(RandomMapTab & randomMapTab)
|
||||
: CWindowObject(BORDERED)
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
widget = std::make_shared<TeamAlignmentsWidget>(randomMapTab);
|
||||
pos = widget->pos;
|
||||
|
||||
updateShadow();
|
||||
center();
|
||||
}
|
||||
|
||||
TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
|
||||
InterfaceObjectConfigurable()
|
||||
{
|
||||
@@ -438,8 +450,8 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
|
||||
|
||||
pos.w = variables["windowSize"]["x"].Integer() + totalPlayers * variables["cellMargin"]["x"].Integer();
|
||||
pos.h = variables["windowSize"]["y"].Integer() + totalPlayers * variables["cellMargin"]["y"].Integer();
|
||||
variables["backgroundRect"]["x"].Integer() = pos.x;
|
||||
variables["backgroundRect"]["y"].Integer() = pos.y;
|
||||
variables["backgroundRect"]["x"].Integer() = 0;
|
||||
variables["backgroundRect"]["y"].Integer() = 0;
|
||||
variables["backgroundRect"]["w"].Integer() = pos.w;
|
||||
variables["backgroundRect"]["h"].Integer() = pos.h;
|
||||
variables["okButtonPosition"]["x"].Integer() = variables["buttonsOffset"]["ok"]["x"].Integer();
|
||||
@@ -454,14 +466,15 @@ TeamAlignmentsWidget::TeamAlignmentsWidget(RandomMapTab & randomMapTab):
|
||||
randomMapTab.obtainMapGenOptions().setPlayerTeam(PlayerColor(plId), TeamID(players[plId]->getSelected()));
|
||||
}
|
||||
randomMapTab.updateMapInfoByHost();
|
||||
assert(GH.windows().isTopWindow(this));
|
||||
GH.windows().popWindows(1);
|
||||
|
||||
for(auto & window : GH.windows().findWindows<TeamAlignments>())
|
||||
GH.windows().popWindow(window);
|
||||
});
|
||||
|
||||
addCallback("cancel", [&](int)
|
||||
{
|
||||
assert(GH.windows().isTopWindow(this));
|
||||
GH.windows().popWindows(1);
|
||||
for(auto & window : GH.windows().findWindows<TeamAlignments>())
|
||||
GH.windows().popWindow(window);
|
||||
});
|
||||
|
||||
build(config);
|
||||
|
||||
Reference in New Issue
Block a user