wow, C++.
I suck at C++.
Personally I would get rid of the STL and use my own struct for that. Then using an array like this:
Code:
struct usermessage_t messages[MAX_USERMESSAGES];
I would just fill this array for each call of pfnRegUserMsg(), then parse this array and return a pointer to the right slot each time pfnMessageBegin() is called (actually that's what I do already in my bot code).
Adding a pointer to the callback function in the network message structure is a smart idea, I think I will borrow this one !
What's the advantage of using the STL by the way ? Auto-sorting by name or by ID ? This can be done using a binary tree and a linked list instead of an array for sorting by name; and sorting by ID can be done just by inserting the messages at their right position in the array since there's 256 registerable user messages at max in the HL engine.