From 6b09c975b841863ce482e114c6dbf12a39d7a52d Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Sun, 31 May 2020 15:26:03 -0700 Subject: [PATCH] Enable Travis-CI + Buildfix (#25) * Update gsnatives.cpp * Update swgameserver.h * Update .travis.yml --- .travis.yml | 44 +++++++++++++++++++++++++++++++++++++++++ Extension/gsnatives.cpp | 18 ++++++++++++++--- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..331a796 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,44 @@ +git: + depth: 1 +language: cpp +compiler: gcc +sudo: false +dist: trusty + +env: + global: + - secure: "VsvGz6WqBVbT+RpnaWwYb16mVvQHQMvzfRxLlUEnYBVkKCWBgyECDXRL/ShBwGW+aMYW25ZPt/aJNk7rN/wvTrgGU2N9X6CrfVyGPp94HPSYPzEbZSXRoCGex30HkVVITYUBDd06CWuMMIOgS7At/XdJIR1ZjZpOr91Oze3YbGA=" + +addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-6', 'g++-6-multilib', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib'] + +before_script: + - CHECKOUT_DIR=$PWD && cd .. + - git clone https://github.com/alliedmodders/ambuild.git + - cd ambuild + - python setup.py build + - python setup.py install --user + - cd .. + - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules https://$OAUTH@github.com/SteamDatabase/SteamworksSDK.git SteamworksSDK + - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b sdk2013 https://github.com/alliedmodders/hl2sdk.git hl2sdk-sdk2013 + - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules https://github.com/alliedmodders/metamod-source.git mmsource-central + - git clone --depth 1 --recurse-submodules -j8 --shallow-submodules -b 1.7-dev https://github.com/alliedmodders/sourcemod.git sourcemod-central + - cd $CHECKOUT_DIR + +script: + - PATH="~/.local/bin:$PATH" + - mkdir build && cd build + - python ../configure.py -s 'sdk2013' --hl2sdk-root=../../ --sm-path=../../sourcemod-central --mms-path=../../mmsource-central --steamworks-path=../../SteamworksSDK + - ambuild + +deploy: + provider: releases + api_key: + secure: "VLNd1mCrVbm9e/3pMmmKy1eJQu46z3HlHE4HZ8udQ0lPL2ttPmks1Ggv5M6eCr27v6k5DNyWymjgbj8h6+/2fv/qukyEu5N2xOJriItrpB/gcq7U5SlLweqjk3suCV2ulv8xjXQeqXlKa25bb61M/ALiv/I6AvQNvu8lAGYceOI=" + file_glob: true + file: package/* + skip_cleanup: true + on: + tags: true diff --git a/Extension/gsnatives.cpp b/Extension/gsnatives.cpp index 73e65f6..9c0db4c 100644 --- a/Extension/gsnatives.cpp +++ b/Extension/gsnatives.cpp @@ -58,8 +58,14 @@ static cell_t sm_GetPublicIP(IPluginContext *pContext, const cell_t *params) { return 0; } - - uint32_t ipaddr = pServer->GetPublicIP(); + + SteamIPAddress_t sAddr = pServer->GetPublicIP(); + if (!sAddr.IsSet()) + { + return 0; + } + + uint32_t ipaddr = sAddr.m_unIPv4; cell_t *addr; pContext->LocalToPhysAddr(params[1], &addr); @@ -80,7 +86,13 @@ static cell_t sm_GetPublicIPCell(IPluginContext *pContext, const cell_t *params) return 0; } - return pServer->GetPublicIP(); + SteamIPAddress_t sAddr = pServer->GetPublicIP(); + if (!sAddr.IsSet()) + { + return 0; + } + + return sAddr.m_unIPv4; } static cell_t sm_IsLoaded(IPluginContext *pContext, const cell_t *params)