-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise natives code #40
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KitRifty
requested changes
Jul 22, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work refactoring the natives code. This is much preferred over having that huge list in the main natives file. However there are a couple of types and a handful of instances where pawn addresses aren't being converted to pointers, and vice versa.
KitRifty
approved these changes
Jul 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's changed ?
Instead of all the natives being inside various include files, and then all included by
natives.h
we instead divide those natives into multiple.hpp
and.cpp
files, available in thenatives
directory. Very much mirroring the setup of our .inc files.New way to register natives
No more global array, instead an std::vector is passed around by reference. The natives are then added to it by each
.cpp
module. Furthermore, macros to define native functions have been eliminated. Everything are now locally defined functions, only available in their respective.cpp
file.Example :
New coding style for
{}
As of this PR, I wish that we adopt Rust's styling for
.cpp
and.hpp
files. The extension never had a coding style to begin with, so I believe this is a good point to start introducing some.New/updated natives
CBaseNPC
andCExtNPC
natives not verifying invalid npc index. Leading to spectacular nullpointer crashes.Prepare for TF2 x64 bits
In addition to everything above, speculative but correct changes have been made to hopefully prepare enough the extension for the eventual release of 64bits tf2. See alliedmodders/hl2sdk#127 for further details.