mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge pull request #1849 from Nordsoft91/editor-1537
Allow single player on map and fix player params initialization
This commit is contained in:
commit
6518e04cd6
@ -301,6 +301,13 @@ void MainWindow::initializeMap(bool isNew)
|
||||
ui->actionMapSettings->setEnabled(true);
|
||||
ui->actionPlayers_settings->setEnabled(true);
|
||||
|
||||
//set minimal players count
|
||||
if(isNew)
|
||||
{
|
||||
controller.map()->players[0].canComputerPlay = true;
|
||||
controller.map()->players[0].canHumanPlay = true;
|
||||
}
|
||||
|
||||
onPlayersChanged();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ PlayerSettings::PlayerSettings(MapController & ctrl, QWidget *parent) :
|
||||
show();
|
||||
|
||||
int players = 0;
|
||||
const int minAllowedPlayers = 2;
|
||||
const int minAllowedPlayers = 1;
|
||||
for(auto & p : controller.map()->players)
|
||||
{
|
||||
if(p.canAnyonePlay())
|
||||
@ -49,7 +49,7 @@ PlayerSettings::~PlayerSettings()
|
||||
|
||||
void PlayerSettings::on_playersCount_currentIndexChanged(int index)
|
||||
{
|
||||
const auto selectedPlayerCount = index + 2;
|
||||
const auto selectedPlayerCount = index + 1;
|
||||
assert(selectedPlayerCount <= controller.map()->players.size());
|
||||
|
||||
for(int i = 0; i < selectedPlayerCount; ++i)
|
||||
|
@ -33,8 +33,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>634</width>
|
||||
<height>201</height>
|
||||
<width>628</width>
|
||||
<height>187</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@ -67,8 +67,13 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="playersCount">
|
||||
<property name="currentText">
|
||||
<string notr="true">2</string>
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">2</string>
|
||||
|
Loading…
Reference in New Issue
Block a user