shithub: choc

Download patch

ref: c1a25efc7ecc82eb644203092a81c659aa523092
parent: 93ac1b74ab0f082a3ee8f1efc0ccd7f47bac3802
author: Simon Howard <[email protected]>
date: Sun Jan 1 19:00:08 EST 2006

Neater prefixes: NET_Client -> NET_CL_. NET_Server -> NET_SV_.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 239

--- a/src/d_net.c
+++ b/src/d_net.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: d_net.c 238 2006-01-01 23:54:31Z fraggle $
+// $Id: d_net.c 239 2006-01-02 00:00:08Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.12  2006/01/02 00:00:08  fraggle
+// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
+//
 // Revision 1.11  2006/01/01 23:54:31  fraggle
 // Client disconnect code
 //
@@ -70,7 +73,7 @@
 //-----------------------------------------------------------------------------
 
 
-static const char rcsid[] = "$Id: d_net.c 238 2006-01-01 23:54:31Z fraggle $";
+static const char rcsid[] = "$Id: d_net.c 239 2006-01-02 00:00:08Z fraggle $";
 
 
 #include "m_menu.h"
@@ -425,8 +428,8 @@
     
     // Temporary hack - hook new client/server code into Doom
 
-    NET_ClientRun();
-    NET_ServerRun();
+    NET_CL_Run();
+    NET_SV_Run();
     
     // check time
     nowtime = I_GetTime ()/ticdup;
@@ -621,13 +624,13 @@
     if (M_CheckParm("-server") > 0)
     {
         net_addr_t *addr;
-        NET_ServerInit();
+        NET_SV_Init();
 
         addr = net_loop_client_module.ResolveAddress("");
 
         printf("address resolved: %p\n", addr);
 
-        if (NET_ClientConnect(addr))
+        if (NET_CL_Connect(addr))
         {
             printf("connected to local server\n");
         }
@@ -687,7 +690,7 @@
     if (debugfile)
 	fclose (debugfile);
 
-    NET_ClientDisconnect();
+    NET_CL_Disconnect();
 
     if (!netgame || !usergame || consoleplayer == -1 || demoplayback)
 	return;
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_client.c 238 2006-01-01 23:54:31Z fraggle $
+// $Id: net_client.c 239 2006-01-02 00:00:08Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.5  2006/01/02 00:00:08  fraggle
+// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
+//
 // Revision 1.4  2006/01/01 23:54:31  fraggle
 // Client disconnect code
 //
@@ -82,7 +85,7 @@
 
 // data received while we are waiting for the game to start
 
-static void ClientParseWaitingData(net_packet_t *packet)
+static void NET_CL_ParseWaitingData(net_packet_t *packet)
 {
     unsigned int num_players;
     unsigned int is_controller;
@@ -101,7 +104,7 @@
 
 // Received an ACK
 
-static void ClientParseACK(net_packet_t *packet)
+static void NET_CL_ParseACK(net_packet_t *packet)
 {
     net_packet_t *reply;
 
@@ -122,7 +125,7 @@
 
 // parse a DISCONNECT packet
 
-static void ClientParseDisconnect(net_packet_t *packet)
+static void NET_CL_ParseDisconnect(net_packet_t *packet)
 {
     net_packet_t *reply;
 
@@ -144,7 +147,7 @@
 
 // parse a DISCONNECT_ACK packet
 
-static void ClientParseDisconnectACK(net_packet_t *packet)
+static void NET_CL_ParseDisconnectACK(net_packet_t *packet)
 {
     if (client_state == CLIENT_STATE_DISCONNECTING)
     {
@@ -158,7 +161,7 @@
 
 // parse a received packet
 
-static void ClientParsePacket(net_packet_t *packet)
+static void NET_CL_ParsePacket(net_packet_t *packet)
 {
     unsigned int packet_type;
 
@@ -173,12 +176,12 @@
 
             // received an acknowledgement to the SYN we sent
 
-            ClientParseACK(packet);
+            NET_CL_ParseACK(packet);
             break;
 
         case NET_PACKET_TYPE_WAITING_DATA:
 
-            ClientParseWaitingData(packet);
+            NET_CL_ParseWaitingData(packet);
             break;
 
         case NET_PACKET_TYPE_GAMESTART:
@@ -188,11 +191,11 @@
             break;
 
         case NET_PACKET_TYPE_DISCONNECT:
-            ClientParseDisconnect(packet);
+            NET_CL_ParseDisconnect(packet);
             break;
 
         case NET_PACKET_TYPE_DISCONNECT_ACK:
-            ClientParseDisconnectACK(packet);
+            NET_CL_ParseDisconnectACK(packet);
             break;
 
         default:
@@ -202,7 +205,7 @@
 
 // called when we are in the "connecting" state
 
-static void ClientConnecting(void)
+static void NET_CL_Connecting(void)
 {
     net_packet_t *packet;
 
@@ -235,7 +238,7 @@
 // Called when we are in the "disconnecting" state, disconnecting from
 // the server.
 
-static void ClientDisconnecting(void)
+static void NET_CL_Disconnecting(void)
 {
     net_packet_t *packet;
 
@@ -264,7 +267,7 @@
 // "Run" the client code: check for new packets, send packets as
 // needed
 
-void NET_ClientRun(void)
+void NET_CL_Run(void)
 {
     net_addr_t *addr;
     net_packet_t *packet;
@@ -280,7 +283,7 @@
 
         if (addr == server_addr)
         {
-            ClientParsePacket(packet);
+            NET_CL_ParsePacket(packet);
         }
 
         NET_FreePacket(packet);
@@ -291,10 +294,10 @@
     switch (client_state)
     {
         case CLIENT_STATE_CONNECTING:
-            ClientConnecting();
+            NET_CL_Connecting();
             break;
         case CLIENT_STATE_DISCONNECTING:
-            ClientDisconnecting();
+            NET_CL_Disconnecting();
             break;
         default:
             break;
@@ -303,7 +306,7 @@
 
 // connect to a server
 
-boolean NET_ClientConnect(net_addr_t *addr)
+boolean NET_CL_Connect(net_addr_t *addr)
 {
     int start_time;
 
@@ -343,12 +346,12 @@
 
         // run client code
 
-        NET_ClientRun();
+        NET_CL_Run();
         
         // run the server, just incase we are doing a loopback
         // connect
 
-        NET_ServerRun();
+        NET_SV_Run();
 
         // Don't hog the CPU
 
@@ -371,7 +374,7 @@
 
 // disconnect from the server
 
-void NET_ClientDisconnect(void)
+void NET_CL_Disconnect(void)
 {
     int start_time;
 
@@ -398,12 +401,12 @@
             
             client_state = CLIENT_STATE_DISCONNECTED;
 
-            fprintf(stderr, "NET_ClientDisconnect: Timeout while disconnecting from server\n");
+            fprintf(stderr, "NET_CL_Disconnect: Timeout while disconnecting from server\n");
             break;
         }
 
-        NET_ClientRun();
-        NET_ServerRun();
+        NET_CL_Run();
+        NET_SV_Run();
 
         I_Sleep(10);
     }
--- a/src/net_client.h
+++ b/src/net_client.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_client.h 238 2006-01-01 23:54:31Z fraggle $
+// $Id: net_client.h 239 2006-01-02 00:00:08Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.5  2006/01/02 00:00:08  fraggle
+// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
+//
 // Revision 1.4  2006/01/01 23:54:31  fraggle
 // Client disconnect code
 //
@@ -45,9 +48,9 @@
 
 #include "net_defs.h"
 
-boolean NET_ClientConnect(net_addr_t *addr);
-void NET_ClientDisconnect(void);
-void NET_ClientRun(void);
+boolean NET_CL_Connect(net_addr_t *addr);
+void NET_CL_Disconnect(void);
+void NET_CL_Run(void);
 
 #endif /* #ifndef NET_CLIENT_H */
 
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_server.c 238 2006-01-01 23:54:31Z fraggle $
+// $Id: net_server.c 239 2006-01-02 00:00:08Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.5  2006/01/02 00:00:08  fraggle
+// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
+//
 // Revision 1.4  2006/01/01 23:54:31  fraggle
 // Client disconnect code
 //
@@ -100,7 +103,7 @@
 
 // returns the number of clients connected
 
-static int ServerNumClients(void)
+static int NET_SV_NumClients(void)
 {
     int count;
     int i;
@@ -120,7 +123,7 @@
 
 // returns a pointer to the client which controls the server
 
-static net_client_t *ServerController(void)
+static net_client_t *NET_SV_Controller(void)
 {
     int i;
 
@@ -139,7 +142,7 @@
 
 // Given an address, find the corresponding client
 
-static net_client_t *ServerFindClient(net_addr_t *addr)
+static net_client_t *NET_SV_FindClient(net_addr_t *addr)
 {
     int i;
 
@@ -158,7 +161,7 @@
 
 // parse a SYN from a client(initiating a connection)
 
-static void ServerParseSYN(net_packet_t *packet, 
+static void NET_SV_ParseSYN(net_packet_t *packet, 
                            net_client_t *client,
                            net_addr_t *addr)
 {
@@ -216,7 +219,7 @@
 
 // parse an ACK packet from a client
 
-static void ServerParseACK(net_packet_t *packet, net_client_t *client)
+static void NET_SV_ParseACK(net_packet_t *packet, net_client_t *client)
 {
     if (client == NULL)
     {
@@ -235,7 +238,7 @@
     }
 }
 
-static void ServerParseDisconnect(net_packet_t *packet, net_client_t *client)
+static void NET_SV_ParseDisconnect(net_packet_t *packet, net_client_t *client)
 {
     net_packet_t *reply;
 
@@ -270,7 +273,7 @@
 
 // Process a packet received by the server
 
-static void ServerPacket(net_packet_t *packet, net_addr_t *addr)
+static void NET_SV_Packet(net_packet_t *packet, net_addr_t *addr)
 {
     net_client_t *client;
     unsigned int packet_type;
@@ -277,7 +280,7 @@
 
     // Find which client this packet came from
 
-    client = ServerFindClient(addr);
+    client = NET_SV_FindClient(addr);
 
     // Read the packet type
 
@@ -291,10 +294,10 @@
     switch (packet_type)
     {
         case NET_PACKET_TYPE_SYN:
-            ServerParseSYN(packet, client, addr);
+            NET_SV_ParseSYN(packet, client, addr);
             break;
         case NET_PACKET_TYPE_ACK:
-            ServerParseACK(packet, client);
+            NET_SV_ParseACK(packet, client);
             break;
         case NET_PACKET_TYPE_GAMESTART:
             break;
@@ -301,7 +304,7 @@
         case NET_PACKET_TYPE_GAMEDATA:
             break;
         case NET_PACKET_TYPE_DISCONNECT:
-            ServerParseDisconnect(packet, client);
+            NET_SV_ParseDisconnect(packet, client);
             break;
         default:
             // unknown packet type
@@ -312,7 +315,7 @@
     // If this address is not in the list of clients, be sure to
     // free it back.
 
-    if (ServerFindClient(addr) == NULL)
+    if (NET_SV_FindClient(addr) == NULL)
     {
         NET_FreeAddress(addr);
     }
@@ -319,7 +322,7 @@
 }
 
 
-static void ServerSendWaitingData(net_client_t *client)
+static void NET_SV_SendWaitingData(net_client_t *client)
 {
     net_packet_t *packet;
 
@@ -330,11 +333,11 @@
 
     // include the number of clients waiting
 
-    NET_WriteInt8(packet, ServerNumClients());
+    NET_WriteInt8(packet, NET_SV_NumClients());
 
     // indicate whether the client is the controller
 
-    NET_WriteInt8(packet, ServerController() == client);
+    NET_WriteInt8(packet, NET_SV_Controller() == client);
     
     // send packet to client and free
 
@@ -348,7 +351,7 @@
 
 // Perform any needed action on a client
 
-static void ServerRunClient(net_client_t *client)
+static void NET_SV_RunClient(net_client_t *client)
 {
     net_packet_t *packet;
 
@@ -391,13 +394,13 @@
         if (client->last_send_time < 0 
          || I_GetTimeMS() - client->last_send_time > 1000)
         {
-            ServerSendWaitingData(client);
+            NET_SV_SendWaitingData(client);
         }
     }
 
     // Client has disconnected.  
     //
-    // See ServerParseDisconnect() above.
+    // See NET_SV_ParseDisconnect() above.
 
     if (client->state == CLIENT_STATE_DISCONNECTED)
     {
@@ -413,7 +416,7 @@
 
 // Initialise server and wait for connections
 
-void NET_ServerInit(void)
+void NET_SV_Init(void)
 {
     int i;
 
@@ -436,7 +439,7 @@
 // Run server code to check for new packets/send packets as the server
 // requires
 
-void NET_ServerRun(void)
+void NET_SV_Run(void)
 {
     net_addr_t *addr;
     net_packet_t *packet;
@@ -449,7 +452,7 @@
 
     while (NET_RecvPacket(server_context, &addr, &packet)) 
     {
-        ServerPacket(packet, addr);
+        NET_SV_Packet(packet, addr);
     }
 
     // "Run" any clients that may have things to do, independent of responses
@@ -459,7 +462,7 @@
     {
         if (clients[i].active)
         {
-            ServerRunClient(&clients[i]);
+            NET_SV_RunClient(&clients[i]);
         }
     }
 }
--- a/src/net_server.h
+++ b/src/net_server.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_server.h 232 2005-12-29 17:48:25Z fraggle $
+// $Id: net_server.h 239 2006-01-02 00:00:08Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.2  2006/01/02 00:00:08  fraggle
+// Neater prefixes: NET_Client -> NET_CL_.  NET_Server -> NET_SV_.
+//
 // Revision 1.1  2005/12/29 17:48:25  fraggle
 // Add initial client/server connect code.  Reorganise sources list in
 // Makefile.am.
@@ -34,11 +37,11 @@
 
 // initialise server and wait for connections
 
-void NET_ServerInit(void);
+void NET_SV_Init(void);
 
 // run server: check for new packets received etc.
 
-void NET_ServerRun(void);
+void NET_SV_Run(void);
 
 #endif /* #ifndef NET_SERVER_H */