mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
42 lines
826 B
C++
42 lines
826 B
C++
|
#include "StdInc.h"
|
||
|
#include "playerparams.h"
|
||
|
#include "ui_playerparams.h"
|
||
|
|
||
|
PlayerParams::PlayerParams(const CMapHeader & mapHeader, int playerId, QWidget *parent) :
|
||
|
QWidget(parent),
|
||
|
ui(new Ui::PlayerParams)
|
||
|
{
|
||
|
ui->setupUi(this);
|
||
|
|
||
|
playerColor = playerId;
|
||
|
assert(mapHeader.players.size() > playerColor);
|
||
|
playerInfo = mapHeader.players[playerColor];
|
||
|
|
||
|
if(playerInfo.canComputerPlay)
|
||
|
ui->radioCpu->setChecked(true);
|
||
|
if(playerInfo.canHumanPlay)
|
||
|
ui->radioHuman->setChecked(true);
|
||
|
|
||
|
ui->playerColor->setTitle(QString("PlayerID: %1").arg(playerId));
|
||
|
show();
|
||
|
}
|
||
|
|
||
|
PlayerParams::~PlayerParams()
|
||
|
{
|
||
|
delete ui;
|
||
|
}
|
||
|
|
||
|
void PlayerParams::on_radioHuman_toggled(bool checked)
|
||
|
{
|
||
|
if(checked)
|
||
|
playerInfo.canHumanPlay = true;
|
||
|
}
|
||
|
|
||
|
|
||
|
void PlayerParams::on_radioCpu_toggled(bool checked)
|
||
|
{
|
||
|
if(checked)
|
||
|
playerInfo.canHumanPlay = false;
|
||
|
}
|
||
|
|