adding multiplayer
This commit is contained in:
@@ -9,12 +9,14 @@
|
||||
* =============================================================================
|
||||
* */
|
||||
#ifndef TRANSACTIONS_H
|
||||
#define TRANSACTIONS_H
|
||||
|
||||
#define ENTITY_ACTION_MOVE_UP 1
|
||||
#define ENTITY_ACTION_MOVE_DOWN 2
|
||||
#define ENTITY_ACTION_MOVE_LEFT 3
|
||||
#define ENTITY_ACTION_MOVE_RIGHT 4
|
||||
#define ENTITY_ACTION_MOVE 1
|
||||
|
||||
#define SERVER_PACKET 1
|
||||
#define USER_PACKET 2
|
||||
#define RELAY_PACKET 3
|
||||
#define ADMIN_PACKET 4
|
||||
|
||||
typedef struct {
|
||||
int packetTpye, size;
|
||||
@@ -24,13 +26,49 @@ typedef struct {
|
||||
typedef struct {
|
||||
int id;
|
||||
int action;
|
||||
int userId;
|
||||
int entityId;
|
||||
int argsize;
|
||||
void* userArg;
|
||||
}action;
|
||||
}user_transaction;
|
||||
|
||||
int CreateTransaction(action* act);
|
||||
int GetTransaction(action* act);
|
||||
int ProssesTransaction(action* act);
|
||||
#define SERVER_T_CONNECT 0b0001
|
||||
#define SERVER_T_DISCONNECT 0b0010
|
||||
#define SERVER_T_RECONNECT 0b0011
|
||||
#define SERVER_T_RELAY 0b0100
|
||||
#define SERVER_T_KICK 0b0101
|
||||
#define SERVER_T_REQUEST 0b0110
|
||||
|
||||
#define SERVER_T_USER_FLAG 0b00010000
|
||||
#define SERVER_T_ADMIN_FLAG 0b00100000
|
||||
#define SERVER_T_SERVER_FLAG 0b01000000
|
||||
#define SERVER_T_RELAY_FLAG 0b10000000
|
||||
|
||||
#define SERVER_T_GET_PLAYER_DATA 1
|
||||
#define SERVER_T_SET_PLAYER_ID 2
|
||||
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int action;
|
||||
int userId;
|
||||
unsigned int ipaddress;
|
||||
int argsize;
|
||||
void* serverArg;
|
||||
|
||||
}server_transaction;
|
||||
|
||||
int GetTransaction(user_transaction* tract);
|
||||
int ProssesTransaction(user_transaction* tract);
|
||||
|
||||
int SendServerTransaction(server_transaction* tract, int serverFD);
|
||||
int SendUserTransaction(user_transaction* tract, int serverFD);
|
||||
|
||||
int RecvServerTransaction(server_transaction* tract, int serverFD);
|
||||
int RecvUserTransaction(user_transaction* tract, int serverFD);
|
||||
|
||||
void FreeUserTransaction(user_transaction* ut);
|
||||
void FreeServerTransaction(server_transaction* st);
|
||||
|
||||
#define TRANSACTIONS_H
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user