-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetwork.h
40 lines (32 loc) · 809 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
#ifndef NETWORK_H
#define NETWORK_H
#include <string>
#include <cstring>
#include <iostream>
#include <memory>
#include <sstream>
#include <unordered_map>
#include <enet/enet.h>
#include "EntityPlayer.h"
#include "PlayerMP.h"
#include "Chat.h"
#include "ChunkUtility.h"
class Network
{
public:
Network(const char* ip);
~Network(void);
void send(EntityPlayer, int);
void sendMessage(EntityPlayer, TimeChat);
void placeItem(std::shared_ptr<GroundItemStack>);
void pickupItem(std::shared_ptr<GroundItemStack>);
void recv(std::HashMap<glm::ivec2, std::shared_ptr<Chunk> >&, std::vector<std::shared_ptr<PlayerMP> >&, std::shared_ptr<EntityPlayer>, int, std::shared_ptr<Chat>);
bool getSuccess(void);
private:
ENetHost* client;
ENetPeer* server;
char tmp[1400];
bool success;
int pId;
};
#endif