alliedmodders / hl2sdk

Half-Life 2 SDK Mirrors
https://github.com/valvesoftware
353 stars 173 forks source link

[CS:GO] Fix compilation errors for std=c++2a #144

Open mixern6 opened 1 year ago

mixern6 commented 1 year ago

The PR fixes these compilation errors:

Explanation:

GAMMACASE commented 1 year ago

You probably wanted to target cs2 branch instead of csgo?

mixern6 commented 1 year ago

It is relevant for CS2 too, but I'd like to sort out these problems for CS:GO before moving on to CS2

GAMMACASE commented 1 year ago

The ifdef around the clamp wouldn't cover all the cases, as earlier cpp versions also could trigger. The macro would later conflict with libraries like algorithm, you can btw remove it completely as I see there's a clamp function defined in basetypes.h in hl2sdk codebase so it gets picked up.

mixern6 commented 1 year ago

The ifdef around the clamp wouldn't cover all the cases, as earlier cpp versions also could trigger. The macro would later conflict with libraries like algorithm, you can btw remove it completely as I see there's a clamp function defined in basetypes.h in hl2sdk codebase so it gets picked up.

Removed the clamp definition. SourceMod building finishes without errors.

GAMMACASE commented 1 year ago

I can't merge the csgo pr's, but by any chance if you are able to duplicate it also to the cs2 branch I'll merge that in as cs2 is the same in this regard. Otherwise looks good to me.

mixern6 commented 1 year ago

I can't merge the csgo pr's, but by any chance if you are able to duplicate it also to the cs2 branch I'll merge that in as cs2 is the same in this regard. Otherwise looks good to me.

What will happen to this PR? I see the problem is relevant for all the other SDK's. Can the fix be merged to all of them? Shall I create a separate PR for each SDK?

@GAMMACASE Could you please cherry-pick this change to all the branches?