From f7be55eb9d38e2e65b133277bc80ccb116d7acd6 Mon Sep 17 00:00:00 2001 From: zsilencer Date: Wed, 8 Jul 2015 21:35:37 -0600 Subject: [PATCH] fix cmake compile errors fix cmake compile errors --- projects/openrct2.vcxproj | 6 +++--- src/network/network.cpp | 13 ++++--------- src/network/network.h | 16 +++++----------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 090335e301..4aa7770319 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -344,7 +344,7 @@ Disabled true 1Byte - _CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_CURL_STATICLIB;%(PreprocessorDefinitions) MultiThreaded true $(IntDir)fake\%(RelativeDir) @@ -375,7 +375,7 @@ xcopy /YS "$(SolutionDir)\..\Data" "$(TargetDir)\Data" false - _CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;CURL_STATICLIB;%(PreprocessorDefinitions) $(IntDir)fake\%(RelativeDir) true Speed @@ -415,7 +415,7 @@ xcopy /YS "$(SolutionDir)\..\Data" "$(TargetDir)\Data" false - _CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;ENABLE_TESTS;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;CURL_STATICLIB;ENABLE_TESTS;%(PreprocessorDefinitions) $(IntDir)fake\%(RelativeDir) true diff --git a/src/network/network.cpp b/src/network/network.cpp index f3db7eaab8..e935e4513f 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -22,16 +22,15 @@ #include #include +#include "network.h" extern "C" { #include "../addresses.h" -#include "../common.h" #include "../game.h" #include "../localisation/date.h" #include "../localisation/localisation.h" #include "../management/news_item.h" #include "../scenario.h" } -#include "network.h" #pragma comment(lib, "Ws2_32.lib") @@ -51,21 +50,17 @@ struct GameCommand } }; -static network_packet* _packetQueue = NULL; static int _wsaInitialised = 0; static WSADATA _wsaData; static SOCKET _listeningSocket = INVALID_SOCKET; static SOCKET _serverSocket = INVALID_SOCKET; static SOCKET _clientSocket = INVALID_SOCKET; -static network_packet _inboundPacket; static std::vector _chunkBuffer; static NetworkConnection _serverConnection; static std::list> _clientConnectionList; static std::multiset _gameCommandQueue; static void network_process_packet(NetworkPacket& packet); -static int network_send_packet(network_packet *packet); -static void network_send_queued_packets(); NetworkPacket::NetworkPacket() { @@ -76,12 +71,12 @@ NetworkPacket::NetworkPacket() std::unique_ptr NetworkPacket::AllocatePacket() { - return std::move(std::make_unique()); + return std::move(std::unique_ptr(new NetworkPacket)); // change to make_unique in c++14 } std::unique_ptr NetworkPacket::DuplicatePacket(NetworkPacket& packet) { - return std::move(std::make_unique(packet)); + return std::move(std::unique_ptr(new NetworkPacket(packet))); // change to make_unique in c++14 } uint8* NetworkPacket::GetData() @@ -300,7 +295,7 @@ void network_end_server() void network_add_client(SOCKET socket) { printf("New client connection\n"); - auto networkconnection = std::make_unique(); + auto networkconnection = std::unique_ptr(new NetworkConnection); // change to make_unique in c++14 networkconnection->socket = socket; _clientConnectionList.push_back(std::move(networkconnection)); } diff --git a/src/network/network.h b/src/network/network.h index d2f1d67837..09f96dbbda 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -23,13 +23,16 @@ #ifndef DISABLE_NETWORK -#include "../common.h" - #ifdef __cplusplus #include #include #include +#include +extern "C" { +#include "../common.h" +#include "../platform/platform.h" +} class NetworkPacket { @@ -66,15 +69,6 @@ private: extern "C" { #endif -typedef struct network_packet network_packet; - -typedef struct network_packet { - uint16 size; - uint8* data; - int read; - network_packet* next; -} network_packet; - #define NETWORK_DEFAULT_PORT 11753 enum {