OpenTTD Source 20260109-master-g241b5fcdfe
core.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#include "../../stdafx.h"
11#include "../../debug.h"
12#include "os_abstraction.h"
13#include "packet.h"
14
15#include "../../safeguards.h"
16
17
23{
24/* Let's load the network in windows */
25#ifdef _WIN32
26 {
27 WSADATA wsa;
28 Debug(net, 5, "Loading windows socket library");
29 if (WSAStartup(MAKEWORD(2, 0), &wsa) != 0) {
30 Debug(net, 0, "WSAStartup failed, network unavailable");
31 return false;
32 }
33 }
34#endif /* _WIN32 */
35
36 return true;
37}
38
43{
44#if defined(_WIN32)
45 WSACleanup();
46#endif
47}
void NetworkCoreShutdown()
Shuts down the network core (as that is needed for some platforms.
Definition core.cpp:42
bool NetworkCoreInitialize()
Initializes the network core (as that is needed for some platforms.
Definition core.cpp:22
#define Debug(category, level, format_string,...)
Output a line of debugging information.
Definition debug.h:37
Includes and/or implementations for the network stuff.
Basic functions to create, fill and read packets.