version 1.3 | | version 1.4 |
---|
| | |
A plugin can be hooked to different events, either related to an object or global ones. | | A plugin can be hooked to different events, either related to an object or global ones. |
(see list later on). | | (see list later on). |
| | |
File include/plugin.h contains all definitions a plugin needs to hook to the server. | | You should always include two header files in your plugin projects: |
This should be enough to write plugins. | | |
The best way to find what you need to write is to check this file. You can also check the | | |
Python plugin (plugin/plugin_python.c) which is the most advanced one. | | |
| | |
All functions the plugin can access are defined as HOOK_xxx, events are EVENT_xxx. | | - plugin.h, which contains the declaration of most plugin-related constants and |
Check CFW* functions in server/plugins.c for all exported functions and what they do. | | the required Crossfire includes; |
| | - plugin_common.h (from the plugins/plugin_common directory), which includes the |
| | necessary support for Crossfire function wrappers. |
| | |
| | All your projects should also include plugin_common.c in their build processes; |
| | that source file contains a lot of Crossfire function wrappers you can call. |
| | Do *not* call the callbacks sent by the Crossfire server directly - use what's |
| | provided by plugin_common.c. |
| | |
Important: a plugin should *never* directly call malloc, free, or any function | | Important: a plugin should *never* directly call malloc, free, or any function |
manipulating memory if the memory needs to be given to server. This breaks Windows | | manipulating memory if the memory needs to be given to server. This breaks Windows |