1/***************************************************************************
2* KBlocks, a falling blocks game for KDE *
3* Copyright (C) 2010 Zhongjie Cai <squall.leonhart.cai@gmail.com> *
4* *
5* This program is free software; you can redistribute it and/or modify *
6* it under the terms of the GNU General Public License as published by *
7* the Free Software Foundation; either version 2 of the License, or *
8* (at your option) any later version. *
9***************************************************************************/
10#ifndef KBLOCKSPLAYNETWORK_H
11#define KBLOCKSPLAYNETWORK_H
12
13#include "KBlocksGameLogic.h"
14#include "GamePlayerInterface.h"
15#include "KBlocksNetPlayer.h"
16
17class KBlocksPlayNetwork
18{
19 public:
20 KBlocksPlayNetwork(int capacity, const string& serverIP, int localPort);
21 ~KBlocksPlayNetwork();
22
23 public:
24 bool addGamePlayer(GamePlayerInterface * p);
25 void clearGamePlayer();
26
27 void startGame();
28 void stopGame();
29
30 int execute();
31
32 void cancelExecute();
33
34 private:
35 string mServerIP;
36 int mLocalPort;
37
38 bool mRunning;
39
40 int mPlayerCount;
41 int mMaxCapacity;
42 KBlocksNetPlayer** maPlayerList;
43
44 KBlocksGameLogic* mpGameLogic;
45};
46
47#endif
48
49