diff --git a/docs/net_protocol.txt b/docs/net_protocol.txt index d2e9da9d..3c98204a 100644 --- a/docs/net_protocol.txt +++ b/docs/net_protocol.txt @@ -88,6 +88,8 @@ Reason: 0x02 - Server full 0x03 - Game is already running 0x04 - Invalid Password + 0x05 - Player Name already in use + 0x06 - Invalid Player Name 0xFF - Other cause diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index 5644d2cc..ff306729 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -26,6 +26,7 @@ #define MODUS 0711 #ifdef _WIN32 +#include #include #endif @@ -42,21 +43,29 @@ ConfigFile::ConfigFile() if (appDataPath && appDataPath[0] != 0) { configFileName = appDataPath; } - else { - configFileName = getcwd(); - //Testen ob das Verzeichnis beschreibbar ist + else { + const int MaxPathSize = 1024; + char curDir[MaxPathSize + 1]; + curDir[0] = 0; + _getcwd(curDir, MaxPathSize); + curDir[MaxPathSize] = 0; + configFileName = curDir; + // Testen ob das Verzeichnis beschreibbar ist ofstream tmpFile; -         const char *tmpFileName = "pokerth_test.tmp"; -         tmpFile.open(tmpFileName); + const char *tmpFileName = "pokerth_test.tmp"; + tmpFile.open((configFileName + "\\" + tmpFileName).c_str()); if (tmpFile) { // Erfolgreich, Verzeichnis beschreibbar. // Datei wieder loeschen. tmpFile.close(); - remove(tmpFileName); + remove((configFileName + "\\" + tmpFileName).c_str()); } else { // Fehlgeschlagen, Verzeichnis nicht beschreibbar - configFileName = "C:\\Windows\\Temp\\"; + curDir[0] = 0; + GetTempPathA(MaxPathSize, curDir); + curDir[MaxPathSize] = 0; + configFileName = curDir; } } //Programmordner erstellen diff --git a/src/gui/qt/guiwrapper.h b/src/gui/qt/guiwrapper.h index 36c72a43..46aa4681 100644 --- a/src/gui/qt/guiwrapper.h +++ b/src/gui/qt/guiwrapper.h @@ -1,113 +1,113 @@ -/*************************************************************************** - * Copyright (C) 2006 by FThauer FHammer * - * f.thauer@web.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef GUIWRAPPER_H -#define GUIWRAPPER_H - -#include - -#include "log.h" -#include "mainwindowimpl.h" -#include "connecttoserverdialogimpl.h" -#include "qthelper.h" -#include "configfile.h" - -#include -#include - -#include "handinterface.h" -#include "session.h" -#include "game.h" - - -class GuiWrapper : public GuiInterface -{ -public: - GuiWrapper(); - - ~GuiWrapper(); - - void setGame(Game*); - void setHand(HandInterface*); - void setSession(Session*); - - int getMaxQuantityPlayers() const; - - void refreshSet() const; - void refreshCash() const; - void refreshAction(int =-1, int =-1) const; - void refreshChangePlayer() const; - void refreshPot() const; - void refreshGroupbox(int =-1, int =-1) const; - void refreshAll() const; - void refreshPlayerName() const; - - void dealHoleCards() const; - void dealFlopCards() const; - void dealTurnCard() const; - void dealRiverCard() const; - - void highlightRoundLabel(std::string round) const; - - void nextPlayerAnimation() const; - - void preflopAnimation1() const; - void preflopAnimation2() const; - - void flopAnimation1() const; - void flopAnimation2() const; - - void turnAnimation1() const; - void turnAnimation2() const; - - void riverAnimation1() const; - void riverAnimation2() const; - - void postRiverAnimation1() const; - void postRiverRunAnimation1() const; - - void flipHolecardsAllIn() const; - - void nextRoundCleanGui() const; - - void meInAction() const; - - void logPlayerActionMsg(std::string playerName, int action, int setValue) ; - void logNewGameHandMsg(int gameID, int handID) ; - - std::string stringToUtf8(const std::string &); - - void SignalNetClientConnect(int actionID); - void SignalNetClientGameInfo(int actionID); - void SignalNetClientError(int errorID, int osErrorID); - - void SignalNetServerSuccess(int actionID); - void SignalNetServerError(int errorID, int osErrorID); +/*************************************************************************** + * Copyright (C) 2006 by FThauer FHammer * + * f.thauer@web.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef GUIWRAPPER_H +#define GUIWRAPPER_H + +#include + +#include "log.h" +#include "mainwindowimpl.h" +#include "connecttoserverdialogimpl.h" +#include "qthelper.h" +#include "configfile.h" + +#include +#include + +#include "handinterface.h" +#include "session.h" +#include "game.h" + + +class GuiWrapper : public GuiInterface +{ +public: + GuiWrapper(); + + ~GuiWrapper(); + + void setGame(Game*); + void setHand(HandInterface*); + void setSession(Session*); + + int getMaxQuantityPlayers() const; + + void refreshSet() const; + void refreshCash() const; + void refreshAction(int =-1, int =-1) const; + void refreshChangePlayer() const; + void refreshPot() const; + void refreshGroupbox(int =-1, int =-1) const; + void refreshAll() const; + void refreshPlayerName() const; + + void dealHoleCards() const; + void dealFlopCards() const; + void dealTurnCard() const; + void dealRiverCard() const; + + void highlightRoundLabel(std::string round) const; + + void nextPlayerAnimation() const; + + void preflopAnimation1() const; + void preflopAnimation2() const; + + void flopAnimation1() const; + void flopAnimation2() const; + + void turnAnimation1() const; + void turnAnimation2() const; + + void riverAnimation1() const; + void riverAnimation2() const; + + void postRiverAnimation1() const; + void postRiverRunAnimation1() const; + + void flipHolecardsAllIn() const; + + void nextRoundCleanGui() const; + + void meInAction() const; + + void logPlayerActionMsg(std::string playerName, int action, int setValue) ; + void logNewGameHandMsg(int gameID, int handID) ; + + std::string stringToUtf8(const std::string &); + + void SignalNetClientConnect(int actionID); + void SignalNetClientGameInfo(int actionID); + void SignalNetClientError(int errorID, int osErrorID); + + void SignalNetServerSuccess(int actionID); + void SignalNetServerError(int errorID, int osErrorID); void SignalNetServerPlayerJoined(const std::string &playerName); - -private: - - Log *myLog; - mainWindowImpl *myW; - ConfigFile *myConfig; - QtHelper *myQtHelper; - -}; - -#endif + +private: + + Log *myLog; + mainWindowImpl *myW; + ConfigFile *myConfig; + QtHelper *myQtHelper; + +}; + +#endif