Human_Player check before join Lobby, Sortable AvailablePlayer List in Lobby
This commit is contained in:
@@ -55,7 +55,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
|
||||
if(strcmp(argv[i], "--nowriteaccess") == 0) { noWriteAccess = 1; }
|
||||
}
|
||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||
configRev = 41;
|
||||
configRev = 42;
|
||||
|
||||
//standard defaults
|
||||
logOnOffDefault = "1";
|
||||
@@ -214,7 +214,7 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
|
||||
configList.push_back(ConfigInfo("InternetGamePassword", CONFIG_TYPE_STRING, ""));
|
||||
configList.push_back(ConfigInfo("IRCServerAddress", CONFIG_TYPE_STRING, "chat.freenode.net"));
|
||||
configList.push_back(ConfigInfo("IRCServerPort", CONFIG_TYPE_INT, "6667"));
|
||||
configList.push_back(ConfigInfo("IRCChannel", CONFIG_TYPE_STRING, "#pokerth"));
|
||||
configList.push_back(ConfigInfo("IRCChannel", CONFIG_TYPE_STRING, "#pokerth-lobby"));
|
||||
configList.push_back(ConfigInfo("IRCServerUseIpv6", CONFIG_TYPE_INT, "0"));
|
||||
configList.push_back(ConfigInfo("MyName", CONFIG_TYPE_STRING, "Human Player"));
|
||||
configList.push_back(ConfigInfo("MyAvatar", CONFIG_TYPE_STRING, ""));
|
||||
|
||||
@@ -13,18 +13,26 @@
|
||||
<string>Network Error</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label_Message" >
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_Message" />
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="lineEdit" />
|
||||
|
||||
@@ -33,6 +33,15 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="indentation" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Available Players</string>
|
||||
|
||||
@@ -68,6 +68,8 @@ void LobbyChat::playerJoined(QString playerName)
|
||||
{
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(myLobby->treeWidget_NickList, 0);
|
||||
item->setData(0, Qt::DisplayRole, playerName);
|
||||
|
||||
myLobby->treeWidget_NickList->sortItems(0, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void LobbyChat::playerLeft(QString playerName)
|
||||
@@ -75,6 +77,8 @@ void LobbyChat::playerLeft(QString playerName)
|
||||
QList<QTreeWidgetItem *> tmpList(myLobby->treeWidget_NickList->findItems(playerName, Qt::MatchExactly));
|
||||
if (!tmpList.empty())
|
||||
myLobby->treeWidget_NickList->takeTopLevelItem(myLobby->treeWidget_NickList->indexOfTopLevelItem(tmpList.front()));
|
||||
|
||||
myLobby->treeWidget_NickList->sortItems(0, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void LobbyChat::displayMessage(QString playerName, QString message) {
|
||||
|
||||
@@ -935,26 +935,42 @@ void mainWindowImpl::callJoinNetworkGameDialog() {
|
||||
|
||||
void mainWindowImpl::callGameLobbyDialog() {
|
||||
|
||||
//Avoid join Lobby with "Human Player" nick
|
||||
if(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()) == QString("Human Player")) {
|
||||
myChangeHumanPlayerNameDialog->label_Message->setText(tr("You cannot join Internet-Game-Lobby with \"Human Player\" as nickname.\nPlease choose another one."));
|
||||
myChangeHumanPlayerNameDialog->exec();
|
||||
|
||||
if(myChangeHumanPlayerNameDialog->result() == QDialog::Accepted) {
|
||||
joinGameLobby();
|
||||
}
|
||||
}
|
||||
else {
|
||||
joinGameLobby();
|
||||
}
|
||||
}
|
||||
|
||||
void mainWindowImpl::joinGameLobby() {
|
||||
|
||||
// Join Lobby
|
||||
mySession->terminateNetworkClient();
|
||||
if (myServerGuiInterface.get())
|
||||
myServerGuiInterface->getSession().terminateNetworkServer();
|
||||
|
||||
myGameLobbyDialog->setSession(&getSession());
|
||||
myStartNetworkGameDialog->setSession(&getSession());
|
||||
|
||||
myGameLobbyDialog->setSession(&getSession());
|
||||
myStartNetworkGameDialog->setSession(&getSession());
|
||||
|
||||
// Start client for dedicated server.
|
||||
mySession->startInternetClient();
|
||||
|
||||
|
||||
//Dialog mit Statusbalken
|
||||
myConnectToServerDialog->exec();
|
||||
|
||||
|
||||
if (myConnectToServerDialog->result() == QDialog::Rejected ) {
|
||||
mySession->terminateNetworkClient();
|
||||
}
|
||||
else
|
||||
{
|
||||
myGameLobbyDialog->exec();
|
||||
|
||||
|
||||
if (myGameLobbyDialog->result() == QDialog::Accepted)
|
||||
{
|
||||
//some gui modifications
|
||||
|
||||
@@ -183,6 +183,7 @@ public slots:
|
||||
void callCreateNetworkGameDialog();
|
||||
void callJoinNetworkGameDialog();
|
||||
void callGameLobbyDialog();
|
||||
void joinGameLobby();
|
||||
|
||||
void myBetRaise();
|
||||
void myFoldAllin();
|
||||
|
||||
Reference in New Issue
Block a user