From 2516654d2ecfab336a141846e49e89f4e184aab8 Mon Sep 17 00:00:00 2001 From: Ryan Stecker Date: Thu, 15 Jan 2015 13:40:21 -0600 Subject: [PATCH] Use BfRead or Protobuf tags in umsg hook callbacks, rather than a generic Handle. --- plugins/include/usermessages.inc | 46 +++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/plugins/include/usermessages.inc b/plugins/include/usermessages.inc index d2bbfedb..7445c0b9 100644 --- a/plugins/include/usermessages.inc +++ b/plugins/include/usermessages.inc @@ -151,19 +151,39 @@ native Handle:StartMessageEx(UserMsg:msg, clients[], numClients, flags=0); native EndMessage(); /** - * Called when a message is hooked - * - * @param msg_id Message index. - * @param msg Handle to the input bit buffer or protobuf. - * @param players Array containing player indexes. - * @param playersNum Number of players in the array. - * @param reliable True if message is reliable, false otherwise. - * @param init True if message is an initmsg, false otherwise. - * @return Ignored for normal hooks. For intercept hooks, Plugin_Handled - * blocks the message from being sent, and Plugin_Continue - * resumes normal functionality. - */ -typedef MsgHook = function Action (UserMsg msg_id, Handle msg, const int[] players, int playersNum, bool reliable, bool init); + * Hook function types for user messages. +*/ +typeset MsgHook +{ + /** + * Called when a bit buffer based usermessage is hooked + * + * @param msg_id Message index. + * @param msg Handle to the input bit buffer. + * @param players Array containing player indexes. + * @param playersNum Number of players in the array. + * @param reliable True if message is reliable, false otherwise. + * @param init True if message is an initmsg, false otherwise. + * @return Ignored for normal hooks. For intercept hooks, Plugin_Handled + * blocks the message from being sent, and Plugin_Continue + * resumes normal functionality. + */ + function Action (UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init); + /** + * Called when a protobuf based usermessage is hooked + * + * @param msg_id Message index. + * @param msg Handle to the input protobuf. + * @param players Array containing player indexes. + * @param playersNum Number of players in the array. + * @param reliable True if message is reliable, false otherwise. + * @param init True if message is an initmsg, false otherwise. + * @return Ignored for normal hooks. For intercept hooks, Plugin_Handled + * blocks the message from being sent, and Plugin_Continue + * resumes normal functionality. + */ + function Action (UserMsg msg_id, Protobuf msg, const int[] players, int playersNum, bool reliable, bool init); +}; /** * Called when a message hook has completed.