summaryrefslogtreecommitdiff
path: root/connection.h
blob: cba503144fb4f06083a8ee6a1d9127338b9c5690 (plain)
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
#ifndef CONNECTION_H
#define CONNECTION_H

#include "vector.h"

#include <boost/shared_ptr.hpp>
#include <boost/asio.hpp>

#include <set>

class Connection {
	private:
		static uint32_t next_id;
		uint32_t id;
		boost::asio::io_service& io_service;

	public:
		typedef boost::shared_ptr<Connection> p;

		boost::asio::ip::tcp::socket socket;

		Connection(boost::asio::io_service& io_service_);

		float distance(float px, float pz);
		std::set<std::pair<int64_t, int64_t> > check_chunks();

		/* data */
		Vector3 pos;
		std::set<std::pair<int64_t, int64_t> > chunk_indices;
		uint32_t get_id();
};

#endif