Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-19-2008, 02:52 AM
Bulle
Hill Giant
 
Join Date: Jan 2008
Posts: 102
Default Two files that go in "common"

Code:
common/default_Hooks.h
----------------------
#ifndef DEFAULT_RULES_H_
#define DEFAULT_RULES_H_

#include "../common/eq_packet_structs.h"

/** A hook can be a function pointer of any type. So we define it as void *.
 *  Hooks are cast to their actual function type when they are called.
 */
typedef void *Hook;

/** Macro used to check the compliance of hook functions with the definition of the hook.
 *  It ensures the hook function has the correct signature.
 *  It can be very useful to avoid mistakes, and when a hook signature changes.
 *  The compiler can then issue an error.
 *  If no signature check is done, a badly-defined hook function will probably crash the server.
 *  usage: add a line after the hook function definition (in the *.cpp file)
 *    CheckHookSignature(CharacterCreation, ChangeCreationInfo, default_CharacterCreation_ChangeCreationInfo);
 */

#define CheckHookSignature(cat, rule, hook) \
	static Hook_##cat##_##rule CheckSignature_##hook = hook


/** Called during character creation right after the CharCreate structure has been checked for correctness.
 *  Allows the world builder to tweak the values sent by the client prior to the actual character creation.
 */
typedef void (*Hook_CharacterCreation_ChangeCreationInfo)(CharCreate_Struct *cc);


/** Does nothing.
 */
void default_CharacterCreation_ChangeCreationInfo(CharCreate_Struct *cc);


#endif /*DEFAULT_RULES_H_*/



common/default_Hooks.cpp
------------------------
#include "../common/debug.h"
#include "../common/default_Hooks.h"


void default_CharacterCreation_ChangeCreationInfo(CharCreate_Struct *cc)
{
};
CheckHookSignature(CharacterCreation, ChangeCreationInfo, default_CharacterCreation_ChangeCreationInfo);


I did not include the changes to the VC++ projects, I am kinda scared about the result. I will just give directives : add files common/default_Hooks.h and common/default_Hooks.cpp to the Common header/Source files of the World and the Zone projects

I will make a reply to this post to show how to implement the one hook I placed in the emulator code at the moment (a hook to tweak the character info structure coming from the Everquest client, prior to the actual character creation).
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:39 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3