mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Allow single player on map and fix player params initialization
This commit is contained in:
parent
4d6b88f10d
commit
eedd7979aa
@ -301,6 +301,13 @@ void MainWindow::initializeMap(bool isNew)
|
|||||||
ui->actionMapSettings->setEnabled(true);
|
ui->actionMapSettings->setEnabled(true);
|
||||||
ui->actionPlayers_settings->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();
|
onPlayersChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ PlayerSettings::PlayerSettings(MapController & ctrl, QWidget *parent) :
|
|||||||
show();
|
show();
|
||||||
|
|
||||||
int players = 0;
|
int players = 0;
|
||||||
const int minAllowedPlayers = 2;
|
const int minAllowedPlayers = 1;
|
||||||
for(auto & p : controller.map()->players)
|
for(auto & p : controller.map()->players)
|
||||||
{
|
{
|
||||||
if(p.canAnyonePlay())
|
if(p.canAnyonePlay())
|
||||||
@ -49,7 +49,7 @@ PlayerSettings::~PlayerSettings()
|
|||||||
|
|
||||||
void PlayerSettings::on_playersCount_currentIndexChanged(int index)
|
void PlayerSettings::on_playersCount_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
const auto selectedPlayerCount = index + 2;
|
const auto selectedPlayerCount = index + 1;
|
||||||
assert(selectedPlayerCount <= controller.map()->players.size());
|
assert(selectedPlayerCount <= controller.map()->players.size());
|
||||||
|
|
||||||
for(int i = 0; i < selectedPlayerCount; ++i)
|
for(int i = 0; i < selectedPlayerCount; ++i)
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>634</width>
|
<width>628</width>
|
||||||
<height>201</height>
|
<height>187</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@ -67,8 +67,13 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="playersCount">
|
<widget class="QComboBox" name="playersCount">
|
||||||
<property name="currentText">
|
<property name="currentText">
|
||||||
<string notr="true">2</string>
|
<string notr="true">1</string>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">2</string>
|
<string notr="true">2</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user