From 50a1e2b2fe3c207c7227df4941f2f66990db0c2c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 4 Aug 2008 18:24:36 +0000 Subject: network protocol version 5, netserver per-client updates, zone change protocol --- src/core/netserver.h | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'src/core/netserver.h') diff --git a/src/core/netserver.h b/src/core/netserver.h index 2340a5d..4dcae69 100644 --- a/src/core/netserver.h +++ b/src/core/netserver.h @@ -48,49 +48,43 @@ public: /*----- mutators -------------------------------------------------- */ + /// run a network server frame + void frame(float timestamp, float previoustimestamp); + /// receive data from clients void receive(); - /// transmit data to clients - void transmit(); - /// broadcast a message void broadcast_message(const char *channel, std::string const & message, Player *ignore_player=0); - /// send a message to a single client + /// send a message to a client void send_message(NetClient *client, const char *channel, std::string const & message); - /// disconnect a single client + /// disconnect a client void send_disconnect(NetClient *client); - /// broadcast a server frame message - void broadcast_frame(float timestamp, float previoustimestamp); - - /// broadcast a delete entity event - void broadcast_entity_delete(Entity *entity); + /// find the client corresponding to a player + NetClient *find_client(Player const *player); - /// broadcast a create entity event - void broadcast_entity_create(Entity *entity); +protected: + /// send a server frame marker + void send_frame_marker(NetClient *client, float timestamp, float previoustimestamp); - /// send a create entity event to a single player + /// send a create entity event void send_entity_create(NetClient *client, Entity *entity); - - /// send a zone update event to a single player - void send_zone_update(NetClient *client, Zone *zone); + + /// broadcast a delete entity event + void send_entity_delete(NetClient *client, Entity *entity); /// broadcast a update entity event - void broadcast_entity_update(Entity *entity); + void send_entity_update(NetClient *client, Entity *entity); - /// broadcast updated player information, if necessary - void broadcast_player_update(); + /// send a zone update event + void send_zone_update(NetClient *client, Zone *zone); - /// send an update player information message to a single client + /// send an update player information message void send_player_update(NetClient *client); - /// find the client corresponding to a player - NetClient *find_client(Player const *player); - -protected: /// set the error state void abort(); @@ -106,6 +100,9 @@ protected: /// parse incoming client messages void parse_incoming_message(NetClient *client, const std::string & message); + /// send a server frame to a single client + void client_frame(NetClient *client, float timestamp, float previoustimestamp); + private: bool netserver_error; int netserver_fd; -- cgit v1.2.3