From d17e47895be88f4edbb9529aa88958920942dbc5 Mon Sep 17 00:00:00 2001 From: Yakys <250988377+Yakys@users.noreply.github.com> Date: Sat, 16 May 2026 18:46:15 +0200 Subject: [PATCH] bugfix(smudge): Include hash_map_adapter.h to fix STLport build of W3DSmudge * Fixes #2674 * Follow up for #2484 After PR #2484 introduced a std::hash specialization and a std::hash_map<...> typedef in Smudge.h, translation units that include Smudge.h without having previously pulled in fail to compile under STLport. The declaration of std::hash as a class template in _hash_fun.h is then processed after Smudge.h has already referenced an unqualified hash, producing the cascade of C2913 / C2989 / C2143 errors reported in #2674. W3DSmudge.cpp is the affected translation unit reported in the issue. Include in Smudge.h itself. The adapter is the repo's existing cross-toolchain shim: under STLport it pulls in (which transitively provides _hash_fun.h's template hash declaration), and on modern toolchains it includes and provides an alias from std::unordered_map. It is already used by Common/FileSystem.h and several other headers in the repo for exactly this reason. Verified by running scripts/docker-build.sh --game zh end to end; all z_* targets link and produce executables of the expected size. This patch was prepared with AI assistance (Anthropic Claude) and was reviewed, built and verified by the author before submission. The diff is one #include line plus a comment. --- Core/GameEngine/Include/GameClient/Smudge.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/GameEngine/Include/GameClient/Smudge.h b/Core/GameEngine/Include/GameClient/Smudge.h index ab6245736b1..deb7dbe2715 100644 --- a/Core/GameEngine/Include/GameClient/Smudge.h +++ b/Core/GameEngine/Include/GameClient/Smudge.h @@ -24,6 +24,9 @@ #include "WWMath/vector2.h" #include "WWMath/vector3.h" +// TheSuperHackers @bugfix Include hash_map_adapter.h so that std::hash is visible as a class template before this header specializes std::hash and uses std::hash_map below. Without this, translation units that include Smudge.h without having pulled in beforehand (e.g. W3DSmudge.cpp) fail to compile under STLport. Fixes #2674. +#include + #define SET_SMUDGE_PARAMETERS(smudge,pos,offset,size,opacity) (smudge->m_pos=pos;smudge->m_offset=offset;smudge->m_size=size;smudge->m_opacity=opacity;) struct Smudge : public DLNodeClass