git: 012e8794d732 - main - games/0ad: Fix build with miniupnpc 2.2.8

From: Guido Falsi <madpilot_at_FreeBSD.org>
Date: Tue, 16 Jul 2024 21:02:11 UTC
The branch main has been updated by madpilot:

URL: https://cgit.FreeBSD.org/ports/commit/?id=012e8794d732dfc026e160bede5e78862dd65fae

commit 012e8794d732dfc026e160bede5e78862dd65fae
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2024-07-16 20:56:18 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2024-07-16 20:56:18 +0000

    games/0ad: Fix build with miniupnpc 2.2.8
    
    PR:             280298
    Suggested by:   Stefan Ehmann <shoesoft@gmx.net>
    Obtained from:  https://bugs.gentoo.org/934315
---
 games/0ad/files/patch-source_network_NetServer.cpp | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/games/0ad/files/patch-source_network_NetServer.cpp b/games/0ad/files/patch-source_network_NetServer.cpp
new file mode 100644
index 000000000000..6866c8a427f5
--- /dev/null
+++ b/games/0ad/files/patch-source_network_NetServer.cpp
@@ -0,0 +1,33 @@
+--- source/network/NetServer.cpp.orig	2022-09-23 19:17:14 UTC
++++ source/network/NetServer.cpp
+@@ -302,7 +302,11 @@ void CNetServerWorker::SetupUPnP()
+ 	else if ((devlist = upnpDiscover(10000, 0, 0, 0, 0, 0)) != NULL)
+ #endif
+ 	{
++#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION >= 18
++		ret = UPNP_GetValidIGD(devlist, &urls, &data, internalIPAddress, sizeof(internalIPAddress), NULL, 0);
++#else
+ 		ret = UPNP_GetValidIGD(devlist, &urls, &data, internalIPAddress, sizeof(internalIPAddress));
++#endif
+ 		allocatedUrls = ret != 0; // urls is allocated on non-zero return values
+ 	}
+ 	else
+@@ -321,9 +325,18 @@ void CNetServerWorker::SetupUPnP()
+ 		LOGMESSAGE("Net server: found valid IGD = %s", urls.controlURL);
+ 		break;
+ 	case 2:
++#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION >= 18
++		LOGMESSAGE("Net server: found a valid IGD with a reserved address = %s, will try to continue anyway", urls.controlURL);
++		break;
++	case 3:
+ 		LOGMESSAGE("Net server: found a valid, not connected IGD = %s, will try to continue anyway", urls.controlURL);
+ 		break;
++	case 4:
++#else
++		LOGMESSAGE("Net server: found a valid, not connected IGD = %s, will try to continue anyway", urls.controlURL);
++		break;
+ 	case 3:
++#endif
+ 		LOGMESSAGE("Net server: found a UPnP device unrecognized as IGD = %s, will try to continue anyway", urls.controlURL);
+ 		break;
+ 	default: