FS2_Open
Open source remastering of the Freespace 2 engine
multi_ping.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _MULTIPLAYER_PING_HEADER_FILE
13 #define _MULTIPLAYER_PING_HEADER_FILE
14 
15 // ------------------------------------------------------------------------------------
16 // MULTIPLAYER PING DEFINES/VARS
17 //
18 
19 struct header;
20 struct net_addr;
21 struct net_player;
22 
23 // the max ping we'll store to calculate the average
24 #define MAX_PINGS 10
25 
26 typedef struct ping_struct {
27  float ping_start; // time the current ping was sent out, or -1 if none
28  float ping_times[MAX_PINGS]; // ping times for calculating the average
29  int num_pings; // # of pings in the ping_times array
30  int ping_add; // where to add the next ping
31 
32  int ping_avg; // in ms, this is the only thing we should be concerned with
33 } ping_struct;
34 
35 
36 // ------------------------------------------------------------------------------------
37 // MULTIPLAYER PING FUNCTIONS
38 //
39 
40 // initialize all player ping times
42 
43 // initialize the given ping struct
45 
46 // start a ping - call this when sending a ping packet
48 
49 // evaluate a pong return on the given struct
51 
52 // send a ping to a specific player
54 
55 // send a ping to the specified address
57 
58 // send a ping to all players
59 void multi_ping_send_all();
60 
61 #endif
void multi_ping_reset_players()
Definition: multi_ping.cpp:30
void multi_ping_send(net_player *p)
Definition: multi_ping.cpp:100
float ping_times[MAX_PINGS]
Definition: multi_ping.h:28
int ping_avg
Definition: multi_ping.h:32
void multi_ping_eval_pong(ping_struct *ps)
Definition: multi_ping.cpp:57
void multi_ping_send_all()
Definition: multi_ping.cpp:114
float ping_start
Definition: multi_ping.h:27
int ping_add
Definition: multi_ping.h:30
int num_pings
Definition: multi_ping.h:29
#define MAX_PINGS
Definition: multi_ping.h:24
struct ping_struct ping_struct
void multi_ping_start(ping_struct *ps)
Definition: multi_ping.cpp:94
Definition: multi.h:385
GLfloat GLfloat p
Definition: Glext.h:8373
void multi_ping_reset(ping_struct *ps)
Definition: multi_ping.cpp:41
GLenum const GLvoid * addr
Definition: Glext.h:9092