OpenTTD Source  20241121-master-g67a0fccfad
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 <http://www.gnu.org/licenses/>.
6  */
7 
12 #include "../../stdafx.h"
13 #include "../../debug.h"
14 #include "os_abstraction.h"
15 #include "packet.h"
16 
17 #include "../../safeguards.h"
18 
19 
25 {
26 /* Let's load the network in windows */
27 #ifdef _WIN32
28  {
29  WSADATA wsa;
30  Debug(net, 5, "Loading windows socket library");
31  if (WSAStartup(MAKEWORD(2, 0), &wsa) != 0) {
32  Debug(net, 0, "WSAStartup failed, network unavailable");
33  return false;
34  }
35  }
36 #endif /* _WIN32 */
37 
38  return true;
39 }
40 
45 {
46 #if defined(_WIN32)
47  WSACleanup();
48 #endif
49 }
void NetworkCoreShutdown()
Shuts down the network core (as that is needed for some platforms.
Definition: core.cpp:44
bool NetworkCoreInitialize()
Initializes the network core (as that is needed for some platforms.
Definition: core.cpp:24
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Definition: debug.h:37
Network stuff has many things that needs to be included and/or implemented by default.
Basic functions to create, fill and read packets.