Changeset edfd1d0 in network-game for common/Common.h


Ignore:
Timestamp:
Dec 25, 2012, 6:27:14 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
4c202e0
Parents:
baaf6c8
Message:

Moved the Player class to the common directory, added a position to Player, added a new message type for sending player info, and made the server broadcast player positions everytime it receives and replies to a message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Common.h

    rbaaf6c8 redfd1d0  
    22#define _COMMON_H
    33
    4 void set_nonblock(int sock)
     4#include <fcntl.h>
     5#include <assert.h>
     6
     7void set_nonblock(int sock);
     8
     9typedef struct
    510{
    6    #ifdef WIN32
    7       unsigned long mode = 1;
    8       ioctlsocket(sock, FIONBIO, &mode);
    9    #else
    10       int flags;
    11       flags = fcntl(sock, F_GETFL,0);
    12       assert(flags != -1);
    13       fcntl(sock, F_SETFL, flags | O_NONBLOCK);
    14    #endif
    15 }
     11   int x;
     12   int y;
     13} PLAYER_POS;
    1614
    1715#endif
Note: See TracChangeset for help on using the changeset viewer.