From 693108529eb77c9d543a48fe295ac709ec30a7bb Mon Sep 17 00:00:00 2001 From: Kenzzer <14257866+kenzzer@users.noreply.github.com> Date: Sun, 26 Oct 2025 19:03:40 +0000 Subject: [PATCH] Some ci attempt + fix kv --- .github/workflows/ci.yml | 86 ++++++++++++++++++++++++++++++++++++++++ tier1/KeyValues.cpp | 12 ++---- 2 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f580706d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: Compilation + +on: + push: + pull_request: + +jobs: + build: + strategy: + matrix: + os: [ubuntu-22.04, windows-2022] + include: + - os: ubuntu-22.04 + cc: clang + cxx: clang++ + - os: windows-2022 + cc: msvc + fail-fast: false + + name: ${{ matrix.os }} - ${{ matrix.cc }} + runs-on: ${{ matrix.os }} + + steps: + - name: Linux dependencies + if: startsWith(runner.os, 'Linux') + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \ + libc6-dev libc6-dev-i386 linux-libc-dev \ + linux-libc-dev:i386 lib32z1-dev ${{ matrix.cc }} + + - uses: actions/setup-python@v5 + name: Setup Python 3.12 + with: + python-version: 3.12 + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + + - uses: actions/checkout@v4 + name: Repository checkout + with: + fetch-depth: 0 + submodules: recursive + path: repository + + - uses: actions/checkout@v4 + name: AMBuild checkout + with: + repository: alliedmodders/ambuild + ref: fe8c99ccd24fa926bf6ac6b9935a5fc03df06a72 + fetch-depth: 0 + submodules: recursive + path: ambuild + + - name: Setup AMBuild + shell: bash + run: | + cd "${{ env.CACHE_PATH }}" + python -m pip install ./ambuild + + - name: Select clang compiler + if: startsWith(runner.os, 'Linux') + run: | + echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV + echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV + ${{ matrix.cc }} --version + ${{ matrix.cxx }} --version + + - name: Build + shell: bash + working-directory: repository + run: | + mkdir build + cd build + python ../configure.py + ambuild + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: libs_${{ runner.os }} + path: repository/build/lib \ No newline at end of file diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index 6be7790e..484acdc1 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -22,6 +22,7 @@ #include "tier0/vprof_telemetry.h" #include #include +#include #include "tier0/dbg.h" #include "tier0/mem.h" #include "utlbuffer.h" @@ -1385,15 +1386,8 @@ float KeyValues::GetFloat( const char *keyName, float defaultValue ) switch ( dat->m_iDataType ) { case TYPE_STRING: - return (float)atof(dat->m_sValue); - case TYPE_WSTRING: -#ifdef WIN32 - return (float) _wtof(dat->m_wsValue); // no wtof -#else - Assert( !"impl me" ); - return 0.0; -#endif - case TYPE_FLOAT: + return std::strtof(dat->m_sValue, nullptr); + case TYPE_FLOAT: return dat->m_flValue; case TYPE_INT: return (float)dat->m_iValue;