From bc60315e6459b265bdb2f3752c2dfa0d194b36d5 Mon Sep 17 00:00:00 2001 From: pawel Date: Mon, 7 Nov 2011 19:12:13 +0000 Subject: [PATCH] Fix build after update of net/enet Reported by: pav --- games/cube/files/patch-client.cpp | 29 +++++++++++++++++++++++++---- games/cube/files/patch-server.cpp | 16 ++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/games/cube/files/patch-client.cpp b/games/cube/files/patch-client.cpp index 40a69731638a..7a1f24ef5096 100644 --- a/games/cube/files/patch-client.cpp +++ b/games/cube/files/patch-client.cpp @@ -1,6 +1,27 @@ ---- client.cpp.orig Tue Feb 6 01:24:56 2007 -+++ client.cpp Tue Feb 6 01:26:30 2007 -@@ -86,7 +86,7 @@ +--- client.cpp.orig 2011-11-07 18:39:52.000000000 +0100 ++++ client.cpp 2011-11-07 18:55:26.000000000 +0100 +@@ -63,12 +63,18 @@ + conoutf("could not resolve server %s", servername); + return; + }; +- ++#if ENET_VERSION > 130 ++ clienthost = enet_host_create(NULL, 1, 0, rate, rate); ++#else + clienthost = enet_host_create(NULL, 1, rate, rate); +- ++#endif + if(clienthost) + { ++#if ENET_VERSION > 130 ++ enet_host_connect(clienthost, &address, 1, 0); ++#else + enet_host_connect(clienthost, &address, 1); ++#endif + enet_host_flush(clienthost); + connecting = lastmillis; + connattempts = 0; +@@ -86,7 +92,7 @@ { if(!connecting && !disconnecting) { @@ -9,7 +30,7 @@ enet_host_flush(clienthost); disconnecting = lastmillis; }; -@@ -304,6 +304,9 @@ +@@ -304,6 +310,9 @@ if(disconnecting) disconnect(); else server_err(); return; diff --git a/games/cube/files/patch-server.cpp b/games/cube/files/patch-server.cpp index 777abd25b693..1c4a2e90bb11 100644 --- a/games/cube/files/patch-server.cpp +++ b/games/cube/files/patch-server.cpp @@ -1,5 +1,5 @@ ---- server.cpp.orig 2007-08-03 15:52:35.000000000 +0200 -+++ server.cpp 2007-08-03 15:58:58.000000000 +0200 +--- server.cpp.orig 2011-11-07 18:57:19.000000000 +0100 ++++ server.cpp 2011-11-07 19:01:52.000000000 +0100 @@ -104,7 +104,7 @@ void disconnect_client(int n, char *reason) { @@ -35,3 +35,15 @@ }; if(numplayers>maxclients) +@@ -448,7 +451,11 @@ + { + ENetAddress address = { ENET_HOST_ANY, CUBE_SERVER_PORT }; + if(*ip && enet_address_set_host(&address, ip)<0) printf("WARNING: server ip not resolved"); ++#if ENET_VERSION > 130 ++ serverhost = enet_host_create(&address, MAXCLIENTS, 0, 0, uprate); ++#else + serverhost = enet_host_create(&address, MAXCLIENTS, 0, uprate); ++#endif + if(!serverhost) fatal("could not create server host\n"); + loopi(MAXCLIENTS) serverhost->peers[i].data = (void *)-1; + };