author | rubidium |
Thu, 01 Feb 2007 23:26:44 +0000 | |
changeset 5900 | 135d10dd7219 |
parent 5870 | 5056f5b1d16a |
child 6121 | 2aae24b0881f |
permissions | -rw-r--r-- |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
2 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
3 |
#ifdef ENABLE_NETWORK |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
4 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
5 |
#include "../../stdafx.h" |
5526
befe0373e6ae
(svn r7833) -Fix (r7829): forgot to add debug.h to the includes.
rubidium
parents:
5524
diff
changeset
|
6 |
#include "../../debug.h" |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
7 |
#include "os_abstraction.h" |
5870
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
8 |
#include "core.h" |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
9 |
#include "packet.h" |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
10 |
|
5864
a95a2849b0e1
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5584
diff
changeset
|
11 |
/** |
a95a2849b0e1
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5584
diff
changeset
|
12 |
* @file core.cpp Functions used to initialize/shut down the core network |
a95a2849b0e1
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5584
diff
changeset
|
13 |
*/ |
a95a2849b0e1
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5584
diff
changeset
|
14 |
|
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
15 |
#ifdef __MORPHOS__ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
16 |
/* the library base is required here */ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
17 |
struct Library *SocketBase = NULL; |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
18 |
#endif |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
19 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
20 |
/** |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
21 |
* Initializes the network core (as that is needed for some platforms |
5864
a95a2849b0e1
(svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents:
5584
diff
changeset
|
22 |
* @return true if the core has been initialized, false otherwise |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
23 |
*/ |
5524
93460e0fed07
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5523
diff
changeset
|
24 |
bool NetworkCoreInitialize(void) |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
25 |
{ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
26 |
#if defined(__MORPHOS__) || defined(__AMIGA__) |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
27 |
/* |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
28 |
* IMPORTANT NOTE: SocketBase needs to be initialized before we use _any_ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
29 |
* network related function, else: crash. |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
30 |
*/ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
31 |
DEBUG(net, 3, "[core] loading bsd socket library"); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
32 |
SocketBase = OpenLibrary("bsdsocket.library", 4); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
33 |
if (SocketBase == NULL) { |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
34 |
DEBUG(net, 0, "[core] can't open bsdsocket.library version 4, network unavailable"); |
5524
93460e0fed07
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5523
diff
changeset
|
35 |
return false; |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
36 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
37 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
38 |
#if defined(__AMIGA__) |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
39 |
/* for usleep() implementation (only required for legacy AmigaOS builds) */ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
40 |
TimerPort = CreateMsgPort(); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
41 |
if (TimerPort != NULL) { |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
42 |
TimerRequest = (struct timerequest*)CreateIORequest(TimerPort, sizeof(struct timerequest); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
43 |
if (TimerRequest != NULL) { |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
44 |
if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest*)TimerRequest, 0) == 0) { |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
45 |
TimerBase = TimerRequest->tr_node.io_Device; |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
46 |
if (TimerBase == NULL) { |
5524
93460e0fed07
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5523
diff
changeset
|
47 |
/* free ressources... */ |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
48 |
DEBUG(net, 0, "[core] can't initialize timer, network unavailable"); |
5524
93460e0fed07
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5523
diff
changeset
|
49 |
return false; |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
50 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
51 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
52 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
53 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
54 |
#endif // __AMIGA__ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
55 |
#endif // __MORPHOS__ / __AMIGA__ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
56 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
57 |
/* Let's load the network in windows */ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
58 |
#ifdef WIN32 |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
59 |
{ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
60 |
WSADATA wsa; |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
61 |
DEBUG(net, 3, "[core] loading windows socket library"); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
62 |
if (WSAStartup(MAKEWORD(2, 0), &wsa) != 0) { |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
63 |
DEBUG(net, 0, "[core] WSAStartup failed, network unavailable"); |
5524
93460e0fed07
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5523
diff
changeset
|
64 |
return false; |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
65 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
66 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
67 |
#endif /* WIN32 */ |
5524
93460e0fed07
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5523
diff
changeset
|
68 |
|
93460e0fed07
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents:
5523
diff
changeset
|
69 |
return true; |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
70 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
71 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
72 |
/** |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
73 |
* Shuts down the network core (as that is needed for some platforms |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
74 |
*/ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
75 |
void NetworkCoreShutdown(void) |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
76 |
{ |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
77 |
#if defined(__MORPHOS__) || defined(__AMIGA__) |
5528
45a70016d39a
(svn r7836) -Codechange: some constness for network/core.
rubidium
parents:
5526
diff
changeset
|
78 |
/* free allocated resources */ |
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
79 |
#if defined(__AMIGA__) |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
80 |
if (TimerBase != NULL) CloseDevice((struct IORequest*)TimerRequest); // XXX This smells wrong |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
81 |
if (TimerRequest != NULL) DeleteIORequest(TimerRequest); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
82 |
if (TimerPort != NULL) DeleteMsgPort(TimerPort); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
83 |
#endif |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
84 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
85 |
if (SocketBase != NULL) CloseLibrary(SocketBase); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
86 |
#endif |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
87 |
|
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
88 |
#if defined(WIN32) |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
89 |
WSACleanup(); |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
90 |
#endif |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
91 |
} |
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
92 |
|
5870
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
93 |
|
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
94 |
/** |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
95 |
* Serializes the GRFIdentifier (GRF ID and MD5 checksum) to the packet |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
96 |
* @param p the packet to write the data to |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
97 |
* @param grf the GRFIdentifier to serialize |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
98 |
*/ |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
99 |
void NetworkSocketHandler::Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf) |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
100 |
{ |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
101 |
uint j; |
5900
135d10dd7219
(svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents:
5870
diff
changeset
|
102 |
p->Send_uint32(grf->grfid); |
5870
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
103 |
for (j = 0; j < sizeof(grf->md5sum); j++) { |
5900
135d10dd7219
(svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents:
5870
diff
changeset
|
104 |
p->Send_uint8 (grf->md5sum[j]); |
5870
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
105 |
} |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
106 |
} |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
107 |
|
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
108 |
/** |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
109 |
* Deserializes the GRFIdentifier (GRF ID and MD5 checksum) from the packet |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
110 |
* @param p the packet to read the data from |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
111 |
* @param grf the GRFIdentifier to deserialize |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
112 |
*/ |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
113 |
void NetworkSocketHandler::Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf) |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
114 |
{ |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
115 |
uint j; |
5900
135d10dd7219
(svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents:
5870
diff
changeset
|
116 |
grf->grfid = p->Recv_uint32(); |
5870
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
117 |
for (j = 0; j < sizeof(grf->md5sum); j++) { |
5900
135d10dd7219
(svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents:
5870
diff
changeset
|
118 |
grf->md5sum[j] = p->Recv_uint8(); |
5870
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
119 |
} |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
120 |
} |
5056f5b1d16a
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents:
5864
diff
changeset
|
121 |
|
5523
623a8856e35b
(svn r7829) -Codechange: move the network (core) initialization/shutdown functions into network/core, so the can be reused in the masterserver_updater.
rubidium
parents:
diff
changeset
|
122 |
#endif /* ENABLE_NETWORK */ |