mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
* Addition of the basic Games Launcher - used to organise networked games with peers.
* New external interface for launcher (rsiface/rsgame.h) * changed pqiservice type Ids from int -> uint32_t. * added NO_DELETE option to pqistreamer. * added HASHDATA flag for BinInterfaces git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@301 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ad8562467f
commit
0712590a99
@ -282,12 +282,15 @@ virtual int notifyEvent(NetInterface *ni, int event) { return 0; }
|
||||
/********************** Binary INTERFACE ****************************
|
||||
* This defines the binary interface used by Network/loopback/file
|
||||
* interfaces
|
||||
*
|
||||
* Flags are passed to BinInterfaces, and serialisers
|
||||
*/
|
||||
|
||||
#define BIN_FLAGS_NO_CLOSE 0x0001
|
||||
#define BIN_FLAGS_READABLE 0x0002
|
||||
#define BIN_FLAGS_WRITEABLE 0x0004
|
||||
#define BIN_FLAGS_NO_DELETE 0x0008
|
||||
#define BIN_FLAGS_HASHDATA 0x0010
|
||||
|
||||
class BinInterface
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ int p3ServiceServer::addService(pqiService *ts)
|
||||
pqioutput(PQL_DEBUG_BASIC, pqiservicezone,
|
||||
"p3ServiceServer::addService()");
|
||||
|
||||
std::map<int, pqiService *>::iterator it;
|
||||
std::map<uint32_t, pqiService *>::iterator it;
|
||||
it = services.find(ts -> getType());
|
||||
if (it != services.end())
|
||||
{
|
||||
@ -74,7 +74,7 @@ int p3ServiceServer::incoming(RsRawItem *item)
|
||||
pqioutput(PQL_DEBUG_BASIC, pqiservicezone, out.str());
|
||||
}
|
||||
|
||||
std::map<int, pqiService *>::iterator it;
|
||||
std::map<uint32_t, pqiService *>::iterator it;
|
||||
it = services.find(item -> PacketId() & 0xffffff00);
|
||||
if (it == services.end())
|
||||
{
|
||||
@ -117,7 +117,7 @@ RsRawItem *p3ServiceServer::outgoing()
|
||||
rrit = services.begin();
|
||||
}
|
||||
|
||||
std::map<int, pqiService *>::iterator sit = rrit;
|
||||
std::map<uint32_t, pqiService *>::iterator sit = rrit;
|
||||
// run to the end.
|
||||
RsRawItem *item;
|
||||
|
||||
@ -162,7 +162,7 @@ int p3ServiceServer::tick()
|
||||
pqioutput(PQL_DEBUG_ALL, pqiservicezone,
|
||||
"p3ServiceServer::tick()");
|
||||
|
||||
std::map<int, pqiService *>::iterator it;
|
||||
std::map<uint32_t, pqiService *>::iterator it;
|
||||
|
||||
// from the beginning to where we started.
|
||||
for(it = services.begin();it != services.end(); it++)
|
||||
|
@ -65,12 +65,12 @@ virtual ~pqiService() { return; }
|
||||
virtual int receive(RsRawItem *) = 0;
|
||||
virtual RsRawItem * send() = 0;
|
||||
|
||||
int getType() { return type; }
|
||||
uint32_t getType() { return type; }
|
||||
|
||||
virtual int tick() { return 0; }
|
||||
|
||||
private:
|
||||
int type;
|
||||
uint32_t type;
|
||||
};
|
||||
|
||||
#include <map>
|
||||
@ -90,8 +90,8 @@ int tick();
|
||||
|
||||
private:
|
||||
|
||||
std::map<int, pqiService *> services;
|
||||
std::map<int, pqiService *>::iterator rrit;
|
||||
std::map<uint32_t, pqiService *> services;
|
||||
std::map<uint32_t, pqiService *>::iterator rrit;
|
||||
|
||||
};
|
||||
|
||||
|
@ -294,7 +294,10 @@ int pqistreamer::queue_outpqi(RsItem *pqi)
|
||||
{
|
||||
out_data.push_back(ptr);
|
||||
}
|
||||
delete pqi;
|
||||
if (!(bio_flags & BIN_FLAGS_NO_DELETE))
|
||||
{
|
||||
delete pqi;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -310,7 +313,10 @@ int pqistreamer::queue_outpqi(RsItem *pqi)
|
||||
pqi -> print(out);
|
||||
pqioutput(PQL_ALERT, pqistreamerzone, out.str());
|
||||
|
||||
delete pqi;
|
||||
if (!(bio_flags & BIN_FLAGS_NO_DELETE))
|
||||
{
|
||||
delete pqi;
|
||||
}
|
||||
return 1; // keep error internal.
|
||||
}
|
||||
|
||||
|
113
libretroshare/src/rsiface/rsgame.h
Normal file
113
libretroshare/src/rsiface/rsgame.h
Normal file
@ -0,0 +1,113 @@
|
||||
#ifndef RS_GAME_GUI_INTERFACE_H
|
||||
#define RS_GAME_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rsgame.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "rstypes.h"
|
||||
|
||||
|
||||
class RsGameLauncher;
|
||||
|
||||
/* declare single RsIface for everyone to use! */
|
||||
|
||||
extern RsGameLauncher *rsGameLauncher;
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
|
||||
class RsGameInfo
|
||||
{
|
||||
public:
|
||||
|
||||
std::string gameId;
|
||||
std::string serverId;
|
||||
|
||||
std::string gameType;
|
||||
std::string gameName;
|
||||
std::string serverName;
|
||||
std::string status;
|
||||
uint16_t numPlayers;
|
||||
|
||||
};
|
||||
|
||||
class RsGamePeer
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
bool invite;
|
||||
bool interested;
|
||||
bool play;
|
||||
};
|
||||
|
||||
class RsGameDetail
|
||||
{
|
||||
public:
|
||||
std::string gameId;
|
||||
std::string gameType;
|
||||
std::string gameName;
|
||||
|
||||
bool areServer; /* are we the server? */
|
||||
std::string serverId; /* if not, who is? */
|
||||
std::string serverName;
|
||||
|
||||
std::string status;
|
||||
|
||||
uint16_t numPlayers;
|
||||
std::map<std::string, RsGamePeer> gamers;
|
||||
|
||||
};
|
||||
|
||||
class RsGameLauncher
|
||||
{
|
||||
public:
|
||||
|
||||
/* server commands */
|
||||
virtual std::string createGame(uint32_t gameType, std::string name) = 0;
|
||||
virtual bool deleteGame(std::string gameId) = 0;
|
||||
virtual bool inviteGame(std::string gameId) = 0;
|
||||
virtual bool playGame(std::string gameId) = 0;
|
||||
//virtual bool quitGame(std::string gameId) = 0;
|
||||
|
||||
virtual bool invitePeer(std::string gameId, std::string peerId) = 0;
|
||||
virtual bool uninvitePeer(std::string gameId, std::string peerId) = 0;
|
||||
virtual bool confirmPeer(std::string gameId, std::string peerId,
|
||||
int16_t pos = -1) = 0;
|
||||
virtual bool unconfirmPeer(std::string gameId, std::string peerId) = 0;
|
||||
|
||||
/* client commands */
|
||||
virtual bool interestedPeer(std::string gameId) = 0;
|
||||
virtual bool uninterestedPeer(std::string gameId) = 0;
|
||||
|
||||
/* get details */
|
||||
virtual bool getGameList(std::list<RsGameInfo> &gameList) = 0;
|
||||
virtual bool getGameDetail(std::string gameId, RsGameDetail &detail) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -9,7 +9,7 @@ OBJ = pqistrings.o \
|
||||
p3face-network.o \
|
||||
p3face-startup.o \
|
||||
rstypes.o \
|
||||
rsiface.o \
|
||||
rsiface.o
|
||||
|
||||
TESTS =
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "services/p3disc.h"
|
||||
#include "services/p3msgservice.h"
|
||||
#include "services/p3chatservice.h"
|
||||
#include "services/p3gamelauncher.h"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
@ -52,6 +53,7 @@
|
||||
|
||||
#include "pqi/pqidebug.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "rsiface/rsgame.h"
|
||||
|
||||
const int p3facestartupzone = 47238;
|
||||
|
||||
@ -496,10 +498,15 @@ int RsServer::StartupRetroShare(RsInit *config)
|
||||
ad = new p3disc(sslr);
|
||||
msgSrv = new p3MsgService();
|
||||
chatSrv = new p3ChatService();
|
||||
p3GameLauncher *gameLauncher = new p3GameLauncher();
|
||||
|
||||
pqih -> addService(ad);
|
||||
pqih -> addService(msgSrv);
|
||||
pqih -> addService(chatSrv);
|
||||
pqih -> addService(gameLauncher);
|
||||
|
||||
/* setup the gui */
|
||||
rsGameLauncher = gameLauncher;
|
||||
|
||||
/* put a welcome message in! */
|
||||
if (config->firsttime_run)
|
||||
|
85
libretroshare/src/serialiser/rsgameitems.h
Normal file
85
libretroshare/src/serialiser/rsgameitems.h
Normal file
@ -0,0 +1,85 @@
|
||||
#ifndef RS_GAME_ITEMS_H
|
||||
#define RS_GAME_ITEMS_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/serialiser: rsgameitems.h
|
||||
*
|
||||
* RetroShare Serialiser.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
class RsGameItem: public RsItem
|
||||
{
|
||||
public:
|
||||
RsGameItem()
|
||||
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GAME_LAUNCHER,
|
||||
RS_PKT_SUBTYPE_DEFAULT)
|
||||
{ return; }
|
||||
virtual ~RsGameItem() { return; }
|
||||
virtual void clear() { return; }
|
||||
std::ostream &print(std::ostream &out, uint16_t indent = 0)
|
||||
{ return out; }
|
||||
|
||||
uint32_t serviceId;
|
||||
std::string gameId;
|
||||
std::string gameComment;
|
||||
|
||||
uint16_t numPlayers;
|
||||
std::list<std::string> players;
|
||||
uint32_t msg; /* RS_GAME_MSG_XXX */
|
||||
|
||||
};
|
||||
|
||||
class RsGameSerialiser: public RsSerialType
|
||||
{
|
||||
public:
|
||||
RsGameSerialiser()
|
||||
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GAME_LAUNCHER)
|
||||
{ return; }
|
||||
virtual ~RsGameSerialiser()
|
||||
{ return; }
|
||||
|
||||
virtual uint32_t size(RsItem *);
|
||||
virtual bool serialise (RsItem *item, void *data, uint32_t *size);
|
||||
virtual RsItem * deserialise(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
virtual uint32_t sizeItem(RsGameItem *);
|
||||
virtual bool serialiseItem (RsGameItem *item, void *data, uint32_t *size);
|
||||
virtual RsGameItem *deserialiseItem(void *data, uint32_t *size);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
#endif /* RS_GAME_ITEMS_H */
|
||||
|
||||
|
@ -54,6 +54,20 @@ const uint16_t RS_SERVICE_TYPE_MSG = 0x0014;
|
||||
const uint16_t RS_SERVICE_TYPE_CHANNEL_MSG = 0x0015;
|
||||
const uint16_t RS_SERVICE_TYPE_PROXY_MSG = 0x0016;
|
||||
|
||||
|
||||
const uint16_t RS_SERVICE_TYPE_GAME_LAUNCHER = 0x1000;
|
||||
|
||||
/* Example Games */
|
||||
/* Board Games */
|
||||
const uint16_t RS_SERVICE_TYPE_GAME_QTCHESS = 0x1001;
|
||||
const uint16_t RS_SERVICE_TYPE_GAME_QGO = 0x1002;
|
||||
|
||||
/* Card Games */
|
||||
const uint16_t RS_SERVICE_TYPE_GAME_BIGTWO = 0x1003;
|
||||
const uint16_t RS_SERVICE_TYPE_GAME_POKER = 0x1004;
|
||||
|
||||
|
||||
|
||||
/* Combined Cache/Service ids */
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ RS_TOP_DIR = ..
|
||||
include $(RS_TOP_DIR)/scripts/config.mk
|
||||
###############################################################
|
||||
|
||||
RSOBJ = p3service.o p3disc.o p3chatservice.o p3msgservice.o
|
||||
RSOBJ = p3service.o p3disc.o p3chatservice.o p3msgservice.o p3gamelauncher.o
|
||||
|
||||
#TESTOBJ =
|
||||
|
||||
|
1050
libretroshare/src/services/p3gamelauncher.cc
Normal file
1050
libretroshare/src/services/p3gamelauncher.cc
Normal file
File diff suppressed because it is too large
Load Diff
147
libretroshare/src/services/p3gamelauncher.h
Normal file
147
libretroshare/src/services/p3gamelauncher.h
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* libretroshare/src/services: p3gamelauncher.h
|
||||
*
|
||||
* Services for RetroShare.
|
||||
*
|
||||
* Copyright 2004-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SERVICE_GAME_LAUNCHER_HEADER
|
||||
#define SERVICE_GAME_LAUNCHER_HEADER
|
||||
|
||||
/*
|
||||
* A central point to setup games between peers.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "services/p3service.h"
|
||||
#include "serialiser/rsgameitems.h"
|
||||
#include "rsiface/rsgame.h"
|
||||
|
||||
class gameAvail
|
||||
{
|
||||
uint32_t serviceId;
|
||||
std::string gameName;
|
||||
uint16_t minPlayers;
|
||||
uint16_t maxPlayers;
|
||||
};
|
||||
|
||||
class gameStatus
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t serviceId;
|
||||
std::string gameId;
|
||||
std::string gameName;
|
||||
|
||||
bool areServer; /* are we the server? */
|
||||
std::string serverId; /* if not, who is? */
|
||||
|
||||
uint16_t numPlayers;
|
||||
std::list<std::string> allowedPeers; /* who can play ( controlled by server) */
|
||||
std::list<std::string> interestedPeers; /* who wants to play ( controlled by server) */
|
||||
std::list<std::string> peerIds; /* in order of turns */
|
||||
|
||||
uint32_t state;
|
||||
};
|
||||
|
||||
class p3GameService;
|
||||
|
||||
/* We're going to add the external Interface - directly on here! */
|
||||
|
||||
class p3GameLauncher: public p3Service, public RsGameLauncher
|
||||
{
|
||||
public:
|
||||
p3GameLauncher();
|
||||
|
||||
/***** EXTERNAL RsGameLauncher Interface *******/
|
||||
/* server commands */
|
||||
virtual std::string createGame(uint32_t gameType, std::string name);
|
||||
virtual bool deleteGame(std::string gameId);
|
||||
virtual bool inviteGame(std::string gameId);
|
||||
virtual bool playGame(std::string gameId);
|
||||
//virtual bool quitGame(std::string gameId);
|
||||
|
||||
virtual bool invitePeer(std::string gameId, std::string peerId);
|
||||
virtual bool uninvitePeer(std::string gameId, std::string peerId);
|
||||
virtual bool confirmPeer(std::string gameId, std::string peerId,
|
||||
int16_t pos = -1);
|
||||
virtual bool unconfirmPeer(std::string gameId, std::string peerId);
|
||||
|
||||
/* client commands */
|
||||
virtual bool interestedPeer(std::string gameId);
|
||||
virtual bool uninterestedPeer(std::string gameId);
|
||||
|
||||
/* get details */
|
||||
virtual bool getGameList(std::list<RsGameInfo> &gameList);
|
||||
virtual bool getGameDetail(std::string gameId, RsGameDetail &detail);
|
||||
/***** EXTERNAL RsGameLauncher Interface *******/
|
||||
|
||||
/* support functions */
|
||||
private:
|
||||
std::string newGame(uint16_t srvId, std::string name);
|
||||
bool confirmGame(std::string gameId);
|
||||
bool quitGame(std::string gameId);
|
||||
bool inviteResponse(std::string gameId, bool interested);
|
||||
|
||||
|
||||
/* p3Service Overloaded */
|
||||
virtual int tick();
|
||||
virtual int status();
|
||||
|
||||
/* add in the Game */
|
||||
int addGameService(p3GameService *game);
|
||||
/* notify gameService/peers */
|
||||
|
||||
//int getGameList(std::list<gameAvail> &games);
|
||||
//int getGamesCurrent(std::list<std::string> &games);
|
||||
//int getGameDetails(std::string gid, gameStatus &status);
|
||||
|
||||
/**** GUI Interface ****/
|
||||
|
||||
bool resumeGame(std::string gameId);
|
||||
|
||||
/**** Network Interface ****/
|
||||
int checkIncoming();
|
||||
int handleIncoming(RsGameItem *gi);
|
||||
|
||||
int handleClientStart(RsGameItem *gi); /* START msg */
|
||||
int handleClientInvited(RsGameItem *gi); /* REJECT msg */
|
||||
int handleClientReady(RsGameItem *gi); /* CONFIRM / REJECT / PLAY msg */
|
||||
int handleClientActive(RsGameItem *gi); /* PAUSE / QUIT msg */
|
||||
|
||||
int handleServerSetup(RsGameItem *gi); /* INTERESTED / REJECT msg */
|
||||
int handleServerActive(RsGameItem *gi); /* PAUSE / QUIT msg */
|
||||
|
||||
int sendRejectMsg(RsGameItem *gi); /* --- error msg */
|
||||
void cleanupGame(std::string gameId); /* remove from list */
|
||||
bool checkGameProperties(uint16_t serviceId, uint16_t players);
|
||||
|
||||
std::map<uint16_t, p3GameService *> gameList;
|
||||
std::map<std::string, gameStatus> gamesCurrent;
|
||||
|
||||
std::string mOwnId;
|
||||
};
|
||||
|
||||
#endif // SERVICE_GAME_LAUNCHER_HEADER
|
90
libretroshare/src/services/p3gameservice.h
Normal file
90
libretroshare/src/services/p3gameservice.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* libretroshare/src/services: p3gameservice.h
|
||||
*
|
||||
* Services for RetroShare.
|
||||
*
|
||||
* Copyright 2004-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef P3_SERVICE_GAME_HEADER
|
||||
#define P3_SERVICE_GAME_HEADER
|
||||
|
||||
/*
|
||||
* A central point to setup games between peers.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "services/p3service.h"
|
||||
|
||||
class StoredGame
|
||||
{
|
||||
public:
|
||||
std::string gameId;
|
||||
time_t startTime;
|
||||
std::list<std::string> peerIds; /* in order of turns */
|
||||
};
|
||||
|
||||
class p3GameLauncher;
|
||||
class p3Service;
|
||||
|
||||
class p3GameService
|
||||
{
|
||||
public:
|
||||
|
||||
p3GameService(uint16_t sId, std::string name, uint16_t min, uint16_t max, p3GameLauncher *l)
|
||||
:serviceId(sId), gameName(name), minPlayers(min), maxPlayers(max),
|
||||
service(NULL), launcher(l)
|
||||
{ return; }
|
||||
|
||||
virtual ~p3GameService()
|
||||
{ return; }
|
||||
|
||||
/*************** Game Interface ******************/
|
||||
/* saved games */
|
||||
virtual void getSavedGames(std::list<StoredGame> &gList);
|
||||
|
||||
/* start a game */
|
||||
virtual void startGame(StoredGame &newGame, bool resume);
|
||||
virtual void quitGame(std::string gameId);
|
||||
virtual void deleteGame(std::string gameId);
|
||||
/*************** Game Interface ******************/
|
||||
|
||||
/* details for the Launcher */
|
||||
uint16_t getServiceId() { return serviceId; }
|
||||
std::string getGameName() { return gameName; }
|
||||
uint16_t getMinPlayers() { return minPlayers; }
|
||||
uint16_t getMaxPlayers() { return maxPlayers; }
|
||||
p3GameLauncher *getLauncher() { return launcher; }
|
||||
|
||||
private:
|
||||
|
||||
uint16_t serviceId;
|
||||
std::string gameName;
|
||||
uint16_t minPlayers, maxPlayers;
|
||||
|
||||
p3Service *service;
|
||||
p3GameLauncher *launcher;
|
||||
};
|
||||
|
||||
#endif // P3_SERVICE_GAME_HEADER
|
Loading…
Reference in New Issue
Block a user