playernicks for local game enabled
This commit is contained in:
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
virtual HandInterface* createHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC) =0;
|
||||
virtual BoardInterface* createBoard() =0;
|
||||
virtual PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) =0;
|
||||
virtual PlayerInterface* createPlayer(BoardInterface *b, int id, std::string name, int sC, bool aS, int mB) =0;
|
||||
virtual PreflopInterface* createPreflop(HandInterface* hi, int id, int qP, int dP, int sB) =0;
|
||||
virtual FlopInterface* createFlop(HandInterface* hi, int id, int qP, int dP, int sB) =0;
|
||||
virtual TurnInterface* createTurn(HandInterface* hi, int id, int qP, int dP, int sB) =0;
|
||||
|
||||
@@ -35,7 +35,7 @@ HandInterface* LocalEngineFactory::createHand(EngineFactory *f, GuiInterface *g,
|
||||
|
||||
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
|
||||
|
||||
PlayerInterface* LocalEngineFactory::createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) { return new LocalPlayer(b, id, sC, aS, mB); }
|
||||
PlayerInterface* LocalEngineFactory::createPlayer(BoardInterface *b, int id, std::string name, int sC, bool aS, int mB) { return new LocalPlayer(b, id, name, sC, aS, mB); }
|
||||
|
||||
PreflopInterface* LocalEngineFactory::createPreflop(HandInterface* hi, int id, int qP, int dP, int sB) { return new LocalPreflop(hi, id, qP, dP, sB); }
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
HandInterface* createHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int qP, int dP, int sB,int sC);
|
||||
BoardInterface* createBoard();
|
||||
PlayerInterface* createPlayer(BoardInterface *b, int id, int sC, bool aS, int mB);
|
||||
PlayerInterface* createPlayer(BoardInterface *b, int id, std::string name, int sC, bool aS, int mB);
|
||||
PreflopInterface* createPreflop(HandInterface* hi, int id, int qP, int dP, int sB);
|
||||
FlopInterface* createFlop(HandInterface* hi, int id, int qP, int dP, int sB);
|
||||
TurnInterface* createTurn(HandInterface* hi, int id, int qP, int dP, int sB);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
LocalPlayer::LocalPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) : PlayerInterface(), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myDude(0), myCardsValueInt(0), myCash(sC), mySet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), myAverageSets(0)
|
||||
LocalPlayer::LocalPlayer(BoardInterface *b, int id, std::string name, int sC, bool aS, int mB) : PlayerInterface(), actualHand(0), actualBoard(b), myCardsValue(0), myID(id), myName(name), myDude(0), myCardsValueInt(0), myCash(sC), mySet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), myAverageSets(0)
|
||||
{
|
||||
|
||||
Tools myTool;
|
||||
@@ -32,10 +32,10 @@ LocalPlayer::LocalPlayer(BoardInterface *b, int id, int sC, bool aS, int mB) : P
|
||||
// cout << "Spieler: " << myID << " Dude: " << myDude << " Cash: " << myCash << " ActiveStatus: " << myActiveStatus << " Button: " << myButton << endl;
|
||||
|
||||
myCardsValue = new CardsValue;
|
||||
|
||||
/*
|
||||
ostringstream temp;
|
||||
temp << "Player " << myID;
|
||||
myName = temp.str();
|
||||
myName = temp.str();*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class BoardInterface;
|
||||
|
||||
class LocalPlayer : public PlayerInterface{
|
||||
public:
|
||||
LocalPlayer(BoardInterface*, int, int, bool, int);
|
||||
LocalPlayer(BoardInterface*, int, std::string, int, bool, int);
|
||||
|
||||
~LocalPlayer();
|
||||
|
||||
@@ -99,8 +99,9 @@ private:
|
||||
|
||||
// Konstanten
|
||||
int myID;
|
||||
int myDude;
|
||||
std::string myName;
|
||||
int myDude;
|
||||
|
||||
|
||||
// Laufvariablen
|
||||
int myCards[2];
|
||||
|
||||
+4
-1
@@ -55,7 +55,10 @@ Game::Game(GuiInterface* g, int qP, int sC, int sB) : myGui(g), actualHand(0), a
|
||||
// Player erstellen
|
||||
PlayerInterface *tempPlayer;
|
||||
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
|
||||
tempPlayer = myFactory->createPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0);
|
||||
|
||||
// cout << myGui->getPlayerName(i) << "\n";
|
||||
|
||||
tempPlayer = myFactory->createPlayer(actualBoard, i, myGui->getPlayerName(i), startCash, startQuantityPlayers > i, 0);
|
||||
playerArray[i] = tempPlayer;
|
||||
}
|
||||
actualBoard->setPlayer(playerArray);
|
||||
|
||||
@@ -33,12 +33,16 @@ public:
|
||||
virtual ~GuiInterface();
|
||||
|
||||
|
||||
//wird nach Einbau der EngineInterfaces umbenannt in setGameInterface und cp.
|
||||
//set
|
||||
virtual void setGame(Game*) =0;
|
||||
virtual void setHand(HandInterface*) =0;
|
||||
virtual void setSession(Session*) =0;
|
||||
//
|
||||
|
||||
//get
|
||||
virtual int getMaxQuantityPlayers() const=0;
|
||||
virtual std::string getPlayerName(int) const=0;
|
||||
|
||||
|
||||
|
||||
//refresh-Funktionen
|
||||
virtual void refreshSet() const=0;
|
||||
@@ -89,8 +93,6 @@ public:
|
||||
virtual void meInAction() const=0;
|
||||
|
||||
|
||||
|
||||
|
||||
//log.cpp
|
||||
virtual void showPlayerActionLogMsg(std::string playName, int action, int setValue) const=0;
|
||||
|
||||
|
||||
@@ -52,10 +52,10 @@ QString ConfigFile::readConfig(QString varName, QString defaultvalue)
|
||||
stream << "gamespeed=4\n";
|
||||
stream << "showgamesettingsdialogonnewgame=1\n";
|
||||
stream << "myname=Human Player\n";
|
||||
stream << "oppponent1name=Player 1\n";
|
||||
stream << "oppponent2name=Player 2\n";
|
||||
stream << "oppponent3name=Player 3\n";
|
||||
stream << "oppponent4name=Player 4\n";
|
||||
stream << "opponent1name=Player 1\n";
|
||||
stream << "opponent2name=Player 2\n";
|
||||
stream << "opponent3name=Player 3\n";
|
||||
stream << "opponent4name=Player 4\n";
|
||||
configFile.close();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ QString ConfigFile::readConfig(QString varName, QString defaultvalue)
|
||||
if (foundvarname == 0) {
|
||||
|
||||
QDir configDir;
|
||||
configDir.setPath(QDir::home().absPath()+"/.pokerth/config/");
|
||||
configDir.setPath(QDir::home().absPath()+"/.pokerth/");
|
||||
|
||||
QFile configFile (configDir.absPath()+"/pokerth.conf");
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ GuiWrapper::GuiWrapper() : myLog(0), myW(0)
|
||||
myW = new mainWindowImpl;
|
||||
myW->show();
|
||||
|
||||
|
||||
myLog = new Log(myW);
|
||||
|
||||
myConfig = new ConfigFile;
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,15 @@ void GuiWrapper::setHand(HandInterface *lh) { myW->setHand(lh); }
|
||||
void GuiWrapper::setSession(Session *s) { myW->setSession(s); }
|
||||
|
||||
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
|
||||
std::string GuiWrapper::getPlayerName(int id) const {
|
||||
|
||||
if(id==0) {
|
||||
return myConfig->readConfig("myname", "Human Player").toStdString() ;
|
||||
}
|
||||
else { return myConfig->readConfig("opponent"+QString::number(id)+"name", "Player "+QString::number(id)).toStdString() ; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GuiWrapper::refreshSet() const { myW->refreshSet(); }
|
||||
void GuiWrapper::refreshChangePlayer() const { myW->refreshChangePlayer(); }
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "log.h"
|
||||
#include "mainwindowimpl.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
@@ -44,6 +45,7 @@ public:
|
||||
void setSession(Session*);
|
||||
|
||||
int getMaxQuantityPlayers() const;
|
||||
std::string getPlayerName(int) const;
|
||||
|
||||
void refreshSet() const;
|
||||
void refreshChangePlayer() const;
|
||||
@@ -87,6 +89,7 @@ private:
|
||||
|
||||
Log *myLog;
|
||||
mainWindowImpl *myW;
|
||||
ConfigFile *myConfig;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -320,6 +320,7 @@ void mainWindowImpl::refreshButton() {
|
||||
|
||||
void mainWindowImpl::refreshPlayerName() {
|
||||
|
||||
// cout << "refresh" << endl;
|
||||
int i;
|
||||
for (i=1; i<maxQuantityPlayers; i++) { groupBoxArray[i]->setTitle(QString::fromStdString(actualHand->getPlayerArray()[i]->getMyName()));
|
||||
}
|
||||
|
||||
@@ -179,6 +179,14 @@
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<tabstops>
|
||||
<tabstop>spinBox_quantityPlayers</tabstop>
|
||||
<tabstop>spinBox_startCash</tabstop>
|
||||
<tabstop>spinBox_smallBlind</tabstop>
|
||||
<tabstop>spinBox_gameSpeed</tabstop>
|
||||
<tabstop>buttonOk</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
@@ -188,8 +196,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>129</x>
|
||||
<y>176</y>
|
||||
<x>120</x>
|
||||
<y>201</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>137</x>
|
||||
@@ -204,8 +212,8 @@
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>222</x>
|
||||
<y>176</y>
|
||||
<x>201</x>
|
||||
<y>201</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>137</x>
|
||||
|
||||
@@ -328,6 +328,20 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>listWidget</tabstop>
|
||||
<tabstop>spinBox_quantityPlayers</tabstop>
|
||||
<tabstop>spinBox_startCash</tabstop>
|
||||
<tabstop>spinBox_smallBlind</tabstop>
|
||||
<tabstop>spinBox_gameSpeed</tabstop>
|
||||
<tabstop>checkBox_showGameSettingsDialogOnNewGame</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>lineEdit_humanPlayerName</tabstop>
|
||||
<tabstop>lineEdit_Opponent1Name</tabstop>
|
||||
<tabstop>lineEdit_Opponent2Name</tabstop>
|
||||
<tabstop>lineEdit_Opponent3Name</tabstop>
|
||||
<tabstop>lineEdit_Opponent4Name</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -35,10 +35,10 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name)
|
||||
|
||||
//Player Nicks
|
||||
lineEdit_humanPlayerName->setText(config.readConfig("myname", "Human Player"));
|
||||
lineEdit_Opponent1Name->setText(config.readConfig("oppponent1name", "Player 1"));
|
||||
lineEdit_Opponent2Name->setText(config.readConfig("oppponent2name", "Player 2"));
|
||||
lineEdit_Opponent3Name->setText(config.readConfig("oppponent3name", "Player 3"));
|
||||
lineEdit_Opponent4Name->setText(config.readConfig("oppponent4name", "Player 4"));
|
||||
lineEdit_Opponent1Name->setText(config.readConfig("opponent1name", "Player 1"));
|
||||
lineEdit_Opponent2Name->setText(config.readConfig("opponent2name", "Player 2"));
|
||||
lineEdit_Opponent3Name->setText(config.readConfig("opponent3name", "Player 3"));
|
||||
lineEdit_Opponent4Name->setText(config.readConfig("opponent4name", "Player 4"));
|
||||
|
||||
//Game Settings
|
||||
spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
||||
@@ -60,10 +60,10 @@ void settingsDialogImpl::accept() {
|
||||
|
||||
//Player Nicks
|
||||
config.writeConfig("myname", lineEdit_humanPlayerName->text());
|
||||
config.writeConfig("oppponent1name", lineEdit_Opponent1Name->text());
|
||||
config.writeConfig("oppponent2name", lineEdit_Opponent2Name->text());
|
||||
config.writeConfig("oppponent3name", lineEdit_Opponent3Name->text());
|
||||
config.writeConfig("oppponent4name", lineEdit_Opponent4Name->text());
|
||||
config.writeConfig("opponent1name", lineEdit_Opponent1Name->text());
|
||||
config.writeConfig("opponent2name", lineEdit_Opponent2Name->text());
|
||||
config.writeConfig("opponent3name", lineEdit_Opponent3Name->text());
|
||||
config.writeConfig("opponent4name", lineEdit_Opponent4Name->text());
|
||||
|
||||
//Game Settings
|
||||
config.writeConfig("numberofplayers", QString::number(spinBox_quantityPlayers->value(),10));
|
||||
|
||||
Reference in New Issue
Block a user