2007-01-13 02:40:33 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* 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. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
#include "session.h"
|
|
|
|
|
#include "game.h"
|
|
|
|
|
#include "guiinterface.h"
|
2007-01-21 00:14:35 +00:00
|
|
|
#include "tinyxml.h"
|
2007-01-21 01:06:38 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#include <direct.h>
|
|
|
|
|
#endif
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
2007-01-13 14:27:56 +00:00
|
|
|
Session::Session(GuiInterface* g) : actualGame(0), myGui(g)
|
2007-01-13 02:40:33 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Session an mainwindowimpl bergeben
|
2007-01-13 14:27:56 +00:00
|
|
|
myGui->setSession(this);
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-01-21 01:06:38 +00:00
|
|
|
// Konfiguration erstellen
|
2007-01-21 00:14:35 +00:00
|
|
|
|
2007-01-21 01:06:38 +00:00
|
|
|
string configFileName;
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
const char *appDataPath = getenv("AppData");
|
|
|
|
|
if (appDataPath)
|
|
|
|
|
{
|
|
|
|
|
configFileName = appDataPath;
|
|
|
|
|
configFileName += "\\pokerth\\";
|
|
|
|
|
mkdir(configFileName.c_str());
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
// hier Linux/Mac Code zur Basispfadbestimmung, z.B.
|
|
|
|
|
configFileName = "~/pokerth";
|
|
|
|
|
// wenn nicht existiert, erzeugen!
|
|
|
|
|
#endif
|
2007-01-13 02:40:33 +00:00
|
|
|
|
2007-01-21 01:06:38 +00:00
|
|
|
configFileName += "config.xml";
|
2007-01-13 02:40:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Session::~Session()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Session::startGame(int qP, int sC, int sB) {
|
|
|
|
|
|
2007-01-13 14:27:56 +00:00
|
|
|
actualGame = new Game(myGui, qP, sC, sB);
|
2007-01-13 02:40:33 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Session::deleteGame() {
|
|
|
|
|
|
|
|
|
|
delete actualGame;
|
|
|
|
|
actualGame = 0;
|
|
|
|
|
|
|
|
|
|
}
|