-
-
Notifications
You must be signed in to change notification settings - Fork 463
Added cookie methodmap (clientprefs) #1012
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
Added cookie methodmap (clientprefs) #1012
Conversation
|
If there is a better solution for handling the methods where the Handle is not the first param, please let me know. |
I think for other similar cases, we did the same shim but on the C++ side to give us more flexibility for future. |
|
Happen to have any examples? I spent an hour or two digging for similar cases, but couldnt find anything, although good chance I overlooked it. By doing it on C++ side, how would it be handled? Creating a new native callback specifically for the methodmap? |
|
Yeah, you'd create a native that just either calls the other native (similar to what you did), or one that calls the same internal function that the other native wraps (with the difference in parameters). f020b56 is an example |
|
Merge conflict existing due to moving typedef to top of inc, allowing it to be defined for the methodmap. |
This PR adds a methodmap for clientprefs cookies without breaking changes, considering that the cookie Handle is not always the first param for clientprefs functions.
I implemented the switching to the c++ side of things and made the methodmap functions natives.
Headline
left a comment
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.
Just one little comment, I'll be happy to merge after that change
Nice work! 🎉
extensions/clientprefs/natives.cpp
Outdated
| static cell_t Cookie_Set(IPluginContext *pContext, const cell_t *params) | ||
| { | ||
| // This version takes (handle, client, value). The original is (client, handle, value). | ||
| cell_t new_params[4] = { |
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.
can you mark this const?
this along with the others
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.
Should this then be made const as well, the commit change I used for reference? https://github.com/alliedmodders/sourcemod/blob/master/core/smn_keyvalues.cpp#L1107
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.
Yes please!
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.
Addressed 60e2a30
|
Tested with: Results: |
Headline
left a comment
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.
Thanks!
This PR adds a methodmap for clientprefs cookies without breaking changes, considering that the cookie Handle is not always the first param for clientprefs functions.