Commit 6cc2b90c by Anselme

fixed compilation errors on linux

parent 70b7ca14
......@@ -41,10 +41,10 @@ struct MapDiff{
friend sf::Packet& operator <<(sf::Packet& packet, const MapDiff& diff){
packet << diff.turn_id;
packet << diff.moves.size();
packet << sf::Uint32(diff.moves.size());
for (CrateMove m : diff.moves)
packet << m;
packet << diff.players.size();
packet << sf::Uint32(diff.players.size());
for(PlayerDiff p : diff.players)
packet << p;
return packet;
......@@ -52,7 +52,7 @@ struct MapDiff{
friend sf::Packet& operator >>(sf::Packet& packet, MapDiff& diff){
packet >> diff.turn_id;
int i, size;
sf::Uint32 i, size;
packet >> size;
for (i=0;i<size;i++)
{
......
......@@ -57,8 +57,7 @@ sf::Packet& operator <<(sf::Packet& packet, const MapKoban& map)
packet << map.m_width << map.m_height;
for(unsigned int i=0; i<map.m_tiles.size(); ++i)
packet << int(map.m_tiles[i]);
unsigned int nbCrates = map.m_crates.size();
packet << nbCrates;
packet << sf::Uint32(map.m_crates.size());
for(const Crate& c : map.m_crates)
packet << c.position.x << c.position.y;
return packet;
......@@ -70,7 +69,7 @@ sf::Packet& operator >>(sf::Packet& packet, MapKoban& map)
map.m_tiles = std::vector<int>(map.m_width*map.m_height);
for(unsigned int i=0; i<map.m_tiles.size(); ++i)
packet >> (int&)map.m_tiles[i];
std::vector<Crate>::size_type nbCrates;
sf::Uint32 nbCrates;
packet >> nbCrates;
for(unsigned int i=0; i<nbCrates; ++i)
{
......
......@@ -13,16 +13,16 @@ Server::Server(unsigned short port)
{
m_map = new MapInstance(this);
m_socket_handler = new SocketHandler(this,port);
new std::thread(updateSockets,this);
new std::thread(Server::updateSockets, m_socket_handler);
}
void Server::initMap(){
m_map->setMapData(MapKoban::getTestMap());
}
void Server::updateSockets(){
void Server::updateSockets(SocketHandler* socket_handler){
while(true)
m_socket_handler->update();
socket_handler->update();
}
/*
......
......@@ -29,7 +29,7 @@ public:
MapInstance* getMap(){return m_map;}
SocketHandler* getSocketHandler(){return m_socket_handler;}
void updateSockets();
static void updateSockets(SocketHandler* socket_handler);
// PlayerAction resolveMove(sf::Vector2i pos, Direction dir);
// void stackAction(PlayerDiff p);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment