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
Preprocessor definition to disable any native function #181
Comments
You could do this the other way round. Instead of having a definition to not include the symbol, use #undef IsPlayerInRangeOfPoint
#define IsPlayerInRangeOfPoint sampgdk_IsPlayerInRangeOfPoint So just do: #include <sampgdk/a_player.h>
#undef IsPlayerInRangeOfPoint Then define your own version. Put that in a header used to always include sampgdk and you have your protection. |
Well, doing that wouldn't allow alternatives in namespaces like By the way, I am actually using |
That's quite the contradiction, by defining SAMPGDK_CPP_WRAPPERS, you enable the sampgdk namespace, containing the function defintions. |
That's not quite a contradiction. |
Yes, it CREATES the |
My bad, read @lstuntmanl 's message wrong, pretend I said nothing! |
For example, I don't want to use functions like
IsPlayerInRangeOfPoint
,GetPlayer/VehicleDistanceFromPoint
,VectorSize
, etc. because they are being called through the AMX layer. There's no need for that, we can make faster alternatives in C++. In C++ we can make lots of separate files, so we may sometimes forget a default function call (instead of calling the faster alternative) in a small file when we definitely don't want that in any file at all. (example: we could use the defaultsampgdk::IsPlayerInRangeOfPoint
instead ofMyGameMode::IsPlayerInRangeOfPoint
and the compiler won't warn us about that)We should be able to add a preprocessor definition "
SAMPGDK_NO_[FUNCTION]
" and then its creation would be disabled insampgdk.h/c
, so we will receive an error if using a disabled function.Example:
SAMPGDK_NO_ISPLAYERINRANGEOFPOINT
" .sampgdk.h
:sampgdk.c
:I checked the
generate_code.py
file and I think that this could be made pretty fast.The text was updated successfully, but these errors were encountered: