src/network/core/core.cpp
author celestar
Mon, 19 Mar 2007 12:38:16 +0000
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6447 3b71e57fd22b
permissions -rw-r--r--
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
5774
9df45c532d5d (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$ */
9df45c532d5d (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
6447
3b71e57fd22b (svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents: 6151
diff changeset
     3
/**
3b71e57fd22b (svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents: 6151
diff changeset
     4
 * @file core.cpp Functions used to initialize/shut down the core network
3b71e57fd22b (svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents: 6151
diff changeset
     5
 */
3b71e57fd22b (svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents: 6151
diff changeset
     6
5774
9df45c532d5d (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
#ifdef ENABLE_NETWORK
9df45c532d5d (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
     8
9df45c532d5d (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
     9
#include "../../stdafx.h"
5777
6f220a5cb864 (svn r7833) -Fix (r7829): forgot to add debug.h to the includes.
rubidium
parents: 5775
diff changeset
    10
#include "../../debug.h"
5774
9df45c532d5d (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
    11
#include "os_abstraction.h"
6121
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    12
#include "core.h"
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    13
#include "packet.h"
5774
9df45c532d5d (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
    14
9df45c532d5d (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__
9df45c532d5d (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 */
9df45c532d5d (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;
9df45c532d5d (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
9df45c532d5d (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
9df45c532d5d (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
/**
9df45c532d5d (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
6115
c5bde03ec914 (svn r8445) -Cleanup: remove some @params from comments as the parameters did not exist anymore and add comments to several variables/functions.
rubidium
parents: 5835
diff changeset
    22
 * @return true if the core has been initialized, false otherwise
5774
9df45c532d5d (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
 */
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6447
diff changeset
    24
bool NetworkCoreInitialize()
5774
9df45c532d5d (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
{
9df45c532d5d (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__)
9df45c532d5d (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
	/*
9df45c532d5d (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_
9df45c532d5d (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.
9df45c532d5d (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
	 */
9df45c532d5d (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");
9df45c532d5d (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);
9df45c532d5d (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) {
9df45c532d5d (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");
5775
016a737acde3 (svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents: 5774
diff changeset
    35
		return false;
5774
9df45c532d5d (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
	}
9df45c532d5d (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
9df45c532d5d (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__)
9df45c532d5d (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) */
9df45c532d5d (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();
9df45c532d5d (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) {
9df45c532d5d (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);
9df45c532d5d (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) {
9df45c532d5d (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) {
9df45c532d5d (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;
9df45c532d5d (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) {
5775
016a737acde3 (svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents: 5774
diff changeset
    47
					/* free ressources... */
5774
9df45c532d5d (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");
5775
016a737acde3 (svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents: 5774
diff changeset
    49
					return false;
5774
9df45c532d5d (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
				}
9df45c532d5d (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
			}
9df45c532d5d (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
		}
9df45c532d5d (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
	}
9df45c532d5d (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__
9df45c532d5d (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__
9df45c532d5d (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
9df45c532d5d (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 */
9df45c532d5d (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
9df45c532d5d (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
	{
9df45c532d5d (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;
9df45c532d5d (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");
9df45c532d5d (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) {
9df45c532d5d (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");
5775
016a737acde3 (svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents: 5774
diff changeset
    64
			return false;
5774
9df45c532d5d (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
		}
9df45c532d5d (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
	}
9df45c532d5d (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 */
5775
016a737acde3 (svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents: 5774
diff changeset
    68
016a737acde3 (svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
rubidium
parents: 5774
diff changeset
    69
	return true;
5774
9df45c532d5d (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
}
9df45c532d5d (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
9df45c532d5d (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
/**
9df45c532d5d (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
9df45c532d5d (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
 */
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6447
diff changeset
    75
void NetworkCoreShutdown()
5774
9df45c532d5d (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
{
9df45c532d5d (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__)
5779
d94be8c0cf86 (svn r7836) -Codechange: some constness for network/core.
rubidium
parents: 5777
diff changeset
    78
	/* free allocated resources */
5774
9df45c532d5d (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__)
9df45c532d5d (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
9df45c532d5d (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);
9df45c532d5d (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);
9df45c532d5d (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
9df45c532d5d (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
9df45c532d5d (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);
9df45c532d5d (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
9df45c532d5d (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
9df45c532d5d (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)
9df45c532d5d (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();
9df45c532d5d (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
9df45c532d5d (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
}
9df45c532d5d (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
6121
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    93
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    94
/**
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    95
 * Serializes the GRFIdentifier (GRF ID and MD5 checksum) to the packet
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    96
 * @param p   the packet to write the data to
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    97
 * @param grf the GRFIdentifier to serialize
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    98
 */
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
    99
void NetworkSocketHandler::Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf)
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   100
{
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   101
	uint j;
6151
4b5e33f35bbe (svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents: 6121
diff changeset
   102
	p->Send_uint32(grf->grfid);
6121
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   103
	for (j = 0; j < sizeof(grf->md5sum); j++) {
6151
4b5e33f35bbe (svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents: 6121
diff changeset
   104
		p->Send_uint8 (grf->md5sum[j]);
6121
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   105
	}
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   106
}
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   107
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   108
/**
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   109
 * Deserializes the GRFIdentifier (GRF ID and MD5 checksum) from the packet
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   110
 * @param p   the packet to read the data from
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   111
 * @param grf the GRFIdentifier to deserialize
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   112
 */
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   113
void NetworkSocketHandler::Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf)
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   114
{
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   115
	uint j;
6151
4b5e33f35bbe (svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents: 6121
diff changeset
   116
	grf->grfid = p->Recv_uint32();
6121
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   117
	for (j = 0; j < sizeof(grf->md5sum); j++) {
6151
4b5e33f35bbe (svn r8523) -Codechange: move all the Network(Recv|Send)_(uintXX|string) functions to Packet.
rubidium
parents: 6121
diff changeset
   118
		grf->md5sum[j] = p->Recv_uint8();
6121
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   119
	}
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   120
}
f254b194347f (svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
rubidium
parents: 6115
diff changeset
   121
5774
9df45c532d5d (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 */