Skip to content

Migrate Reactive Drop from C++14 to C++20 - #1115

Open
Kitsune44 wants to merge 13 commits into
ReactiveDrop:reactivedrop_betafrom
Kitsune44:cpp20
Open

Kitsune44 wants to merge 13 commits into
ReactiveDrop:reactivedrop_betafrom
Kitsune44:cpp20

Conversation

@Kitsune44

@Kitsune44 Kitsune44 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Migrate Reactive Drop from C++14 to C++20

Enables /std:c++20 (LanguageStandard=stdcpp20) for the Client (Swarm), Server (Swarm) and missionchooser projects in every build configuration, and fixes every error the switch surfaces.

  • Verified with:
  • MSBuild src\reactivedrop_vs13.sln /t:Rebuild for Release|Win32 and Debug|Win32 - 0 errors in both; client.dll, server.dll and missionchooser.dll produced for each.
  • Both the Release and the Debug DLLs were then swapped into the game installation and a smoke test was played on one solo map.

@Kitsune44
Kitsune44 requested a review from BenLubar September 27, 2026 17:15
@anf3is anf3is mentioned this pull request Sep 28, 2026
1 task done
@Kitsune44
Kitsune44 removed the request for review from BenLubar September 28, 2026 04:04
@Kitsune44
Kitsune44 marked this pull request as draft September 28, 2026 04:04
@Kitsune44
Kitsune44 marked this pull request as ready for review September 28, 2026 04:35

@anf3is anf3is left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I skipped part with EHANDLE and convar callbacks, but in general looks fine.
Otherwise I would suggest some minor changes. (And to to be honest, I believe that cpp version agnostic changes like the whole (const char*) story deserve their own PR.)

Comment thread src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp
Comment thread src/game/client/text_message.cpp
Comment thread src/public/tier1/strtools.h
Comment thread src/public/networkvar.h
Comment thread src/public/UtlCachedFileData.h
Comment thread src/public/vscript/ivscript.h Outdated
Comment thread src/public/keyframe/keyframe.cpp
Comment thread src/public/vgui_controls/Panel.h
Comment thread src/game/client/clientshadowmgr.cpp
Comment thread src/public/tier0/basetypes.h
@Kitsune44
Kitsune44 marked this pull request as draft September 29, 2026 12:18
@Kitsune44
Kitsune44 force-pushed the cpp20 branch 3 times, most recently from e56c2ad to 2eea42a Compare September 29, 2026 13:26
The three projects are switched to /std:c++20
(LanguageStandard=stdcpp20) in every configuration. No conformance
switch was relaxed: neither /Zc:twoPhase- nor /Zc:strictStrings- was
added.
Dependent base members and file-scope declarations are found again:
this-> where the base is dependent, explicit declarations and
out-of-line definitions, and the missing includes (math.h for log10,
tier1/KeyValues.h, fgdlib/WCKeyValues.h). The Debug configuration needed
this-> as well, where Assert and #ifdef _DEBUG compile the call out in
Release.
KeyValues is a complete type where it is instantiated (Panel.h) and
CSortedCacheFile is defined before its first use (UtlCachedFileData.h).
concept became a keyword in C++20. Renamed 216 identifiers from concept
to conceptName across the AI speech, passenger and response-rule code,
leaving comments and string literals untouched.
The clamp macro in mathlib.h was expanded inside <algorithm> and broke
it. The macro is gone; the C++ clamp template in tier0/basetypes.h is
the only clamp and takes the two bound types separately with an explicit
result conversion. The macro branch left there is the C one (#else of
#ifdef __cplusplus).
The datatable API is const-correct now (dt_recv, dt_send,
dt_utlvector_recv, dt_utlvector_send, ClientClass, ServerClass,
recvproxy, sendproxy), which fixes the RECVINFO/SENDINFO macro call
sites without touching the tables. The remaining literal sites were
fixed by making the local const or by const-correcting the in-repo
signature; explicit casts are kept only at engine boundaries.
false is not a null pointer constant in conformance mode: chunkfile.cpp
returns NULL, and the GetLocalTeam() result is compared against NULL
instead of being used as a bool-to-pointer conversion.
The string-returning virtuals are const char * now (GetEngineSound,
GetScannerSoundPrefix, GetDeathNoticeName, GetFixedCameraEntityName and
the particle definition members) in the headers and in their
definitions, which removes the casts their callers needed.
friend static is not a valid declaration: the console command handlers
in rd_workshop.h are static at namespace scope only.
Temporaries cannot bind to non-const references. Instead of keeping a
local at every call site, the in-repo callees take const Vector& / const
QAngle& (Tracer_Draw, CSnowFallManager::FindSnowVolumes, SetMoveTarget,
the three MeleeAttack helpers, FX_MicroExplosion), and
asw_broadcast_camera uses VectorLength() for the length it actually
needs. The engine-side particle interfaces consume the CUtlBuffer they
are given, so their call sites keep a local.
C++20 adds rewritten comparison candidates, so the legacy comparisons
became ambiguous: CUtlSymbol and FileNameHandle_t results are tested
with IsValid(), and EHANDLE and ScriptVariant_t are constructed
explicitly at the handle and script boundaries.
Qualified member declarations are not allowed inside a class body: void
CASW_Holo_Sentry::InputEnable becomes void InputEnable.
Explicit specializations of class template members are not implicitly
inline, so the linker folded duplicate definitions: the four
ITilegenClassFactory<T>::ReadLiteralValue specializations and
C_SpatialEntityTemplate<Vector>::ResetAccumulation are marked inline.
@Kitsune44
Kitsune44 marked this pull request as ready for review September 29, 2026 14:00
@anf3is
anf3is self-requested a review September 29, 2026 14:07
@Kitsune44
Kitsune44 removed the request for review from anf3is September 29, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants