-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNetwork.h
54 lines (42 loc) · 966 Bytes
/
Network.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef NETWORK_H
#define NETWORK_H
#include <iostream>
#include "SDL/SDL.h"
#include "SDL/SDL_net.h"
#include "Nacao.h"
#include "Unidade.h"
#define MAXLEN 10240
#define MAXFILA 24
using namespace std;
class Nacao;
class Unidade;
class Network
{
public:
char *ipServidor;
short porta;
char backspace;
//Flag de atuação...
bool host;
char msg[MAXLEN],animacao[6];
int loop;
int ultimoFila, primeiroFila;
char mensagens[MAXFILA][32];
Unidade* unidadeSelecionada;
Unidade* unidadeAlvo;
TCPsocket conexao;
SDLNet_SocketSet socketSet;
Network();
void initializeNetwork();
void lerComando();
bool lerTCP(int, char*);
bool escreveTCP(int);
bool escreveTCPString(string);
bool enviaJogoInicial(int, int);
bool recebeJogoInicial(int&, int&);
void pushMovimento(int, int, char);
bool recebeJogada(Nacao*);
bool enviaJogada();
void selecionarUnidadeNacao(Nacao, int , int );
};
#endif