summaryrefslogtreecommitdiff
path: root/src/common/HPM.c
AgeCommit message (Collapse)AuthorFilesLines
2016-10-28Fixed wrong nullpo checkLemongrass31101-1/+1
2016-10-14Fixed a memory manager crash when a memory leak occurs in a pluginHaru1-1/+2
- Plugins were accidentally using the core's memory manager instead of the HPM-safe wrappers. - As a side-effect of this, plugins shall not be able to hook into the iMalloc interface. - The issue was introduced in e7c2f7d827ad286dc826e483391e64b8ffe2720b Signed-off-by: Haru <haru@dotalux.com>
2016-10-07Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra)Haru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-10-04Add missing checks into HPM.cAndrei Karas1-11/+35
2016-08-20Re-added HPM support for configuration settingsHaru1-3/+58
Plugin settings should be relative to the the libconfig file root. For example, a configuration setting of type HPCT_CHAR will be relative to the root of conf/char/char-server.conf. In order to add a configuration entry inside the char_configuration block, the full configuration path (slash-delimited) should be passed to addCharConf(), as in the following example: `addCharConf("char_configuration/my_setting", my_parser_function);` Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Added option to make plugin-defined battle config entries optionalHaru1-2/+3
When a setting optional, no warning is issued on the console when said setting is not found in the config Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported battle.conf to libconfigHaru1-1/+48
Ported to modern Hercules and cleaned up from Panikon's commits: 44fea0b3cdba6901599265220228ba4359b1f96d, 9cba05bc0811e638bbaaa6cff887d0b2c9872560 Signed-off-by: Haru <haru@dotalux.com>
2016-07-02Trivialities: indentation fixesHaru1-5/+5
Signed-off-by: Haru <haru@dotalux.com>
2016-04-30Moved HPMHooking-related definitions to plugins/HPMHooking.hHaru1-15/+25
- Plugins that want to make use of the HPMHooking must now include "plugins/HPMHooking.h". Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedef from DBMapHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-02-19Fix all known warnings from compiler flags -Wformat*Andrei Karas1-6/+6
Add all missing -Wformat flags into configure.
2016-02-17Removed unnecessary typedefs from libconfigHaru1-3/+3
Signed-off-by: Haru <haru@dotalux.com>
2016-02-17Renamed config->read_file to config->load_fileHaru1-1/+1
- The return value is now consistent with the libconfig standard (CONFIG_TRUE/CONFIG_FALSE). - Removed some redundant error messages. Signed-off-by: Haru <haru@dotalux.com>
2016-01-25Fix packet id being sent encrypted to Hercules Plugin Manager.hemagx1-2/+2
Now packet id will be passed to Hercules Plugin Manager instead of let it figure it on itself
2015-12-15Added GPL-compliant header to all sources and build scriptsHaru1-3/+19
Signed-off-by: Haru <haru@dotalux.com>
2015-12-13- Fixed #723 now it's possible to retrieve Battle Config Settings from ↵Your Name1-3/+37
plugins into scripts - Fixed Possible Crash when null parse function pointer passed to HPMi->addConf - Now it's possible to use same parse function for all config entries - Now Battle Config entries must have a return function
2015-10-19rename malloc.c/h to memmgr.Andrei Karas1-1/+1
2015-10-11Fixed various compiler warnings (follow-up to 5c22b63)Haru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Cleanup of the HPluginData implementation (second part)Haru1-84/+135
- Changed the hplugin_data_store's array into a VECTOR. Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Cleanup of the HPluginData implementation (First part)Haru1-72/+96
- Several explicit casts are removed, to have a slightly better type-checking at compile time. - A destructor function is provided, to remove code duplication. Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Changed cmdline->args_data to a VECTORHaru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Changed HPM->cmdline_plugins to a VECTOR and renamed to ↵Haru1-13/+8
HPM->cmdline_load_plugins Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Changed HPM->confs to a VECTOR and renamed to HPM->config_listenersHaru1-33/+45
Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Changed HPM->fnames to a vector type, renamed to HPM->filenamesHaru1-22/+36
- This is a generic vector. It doesn't make use of the VECTOR type because it needs to outlive the memory manager. Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Changed HPM->packets[] into an array of VECTORHaru1-42/+42
Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Changed HPM->symbols to a VECTORHaru1-19/+33
Signed-off-by: Haru <haru@dotalux.com>
2015-10-11Replaced HPM->plugins with a VECTORHaru1-55/+91
Signed-off-by: Haru <haru@dotalux.com>
2015-10-10Fixed issue #783Emistry1-1/+1
signed/unsigned mismatch.
2015-09-25Corrected a plugin unload issueHaru1-13/+14
- This doesn't affect the current unloading function (executed at shutdown), but it is only related to the (upcoming) manual plugin unloading. Signed-off-by: Haru <haru@dotalux.com>
2015-09-18Clarified the intent of several assignments inside conditional expressionsHaru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-09-08Fixed some memory leaks in code using libconfigHaru1-1/+1
- Special thanks to Dastgir Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Automatic HPM symbol sharingHaru1-38/+0
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Removed some unnecessary shared symbols, already present in interfacesHaru1-250/+256
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Moved sql_handle into the HPMi interfaceHaru1-8/+0
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Added core HPM interfaceHaru1-5/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Enabled HPMDataCheck for login and char serversHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15HPM compatibility improvementsHaru1-25/+13
Improved compatibility, portability and standards conformance. - Since it is not possible to portably and reliably re-use the core's symbols in plugins, symbols are no longer exported unless explicitly required, in the UNIX builds. This mimics the Windows behavior and adds HPM compatibility to OSes such as FreeBSD. Credits to Andrei Karas for making this possible. - For convenience, it is no longer necessary to call GET_SYMBOL, since the plugin will automatically import all the available symbols when it's loaded, depending on the included headers. - Plugins are now supposed to include the "common/hercules.h" header before including anything else. Incluing common/HPMi.h, common/cbasetypes.h or conf/core.h is no longer necessary, as those are guaranteed to be automatically included by hercules.h. - HPM API version bumped to 1.1. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Added HPMHooking support for common interfacesHaru1-1/+9
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Added showmsg HPM interfaceHaru1-9/+3
- The showmsg interface is automatically imported into plugins by the HPM (just like previously, the various Show* functions were). This change requires no actions from plugin developers. - stdout_with_ansisequence is now available through showmsg->stdout_with_ansisequence - msg_silent is now available through showmsg->silent - console_msg_log is now available through showmsg->console_log - timestamp_format is now available through showmsg->timestamp_format - Plugin-safe macros are provided, so that all Show* and Clear* calls will require no changes. - vShowMessage is provided through the public API, as va_list variant of ShowMessage. - vShowMessage_ is no longer part of the public API. If necessary, va_list variants of the other Show* functions will be added at a later time as follow-ups. Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Improved info/error messages during plugin loadingHaru1-3/+8
- Each loaded plugin will now show a status message - If a plugin loads because of a missing symbol, an error message will be displayed, mentioning the name of the missing symbol. Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Cleaned up some #includesHaru1-0/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru1-16/+16
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
2015-06-01Plugin load failure now causes Fatal ErrorAncyker1-39/+26
If you set a plugin to load and it fails for some reason, the server will now exit. It will still warn when attempting to load a plugin twice.
2015-01-20Fixes Compile Error on WindowsDastgir1-2/+3
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-10/+10
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
2015-01-18Command line arguments handling overhaulHaru1-56/+48
- login_server, char_server, map_server as well as the tools (mapcache) now have a common command line arguments handling mechanism. - All of them now accept `--help` (`-h`), `--version` (`-v`) and `--load-plugin`. - login_server now accepts `--login-config` and `--lan-config` instead of relying on positional arguments to override those files. The old syntax will no longer work, please update your custom startup scripts. - char_server now accepts `--char-config`, `--inter-config`, `--lan-config` instead of relying on positional arguments. The old syntax will no longer work, please update your custom startup scripts. - mapcache now accepts `--grf-list`, `--map-list`, `--map-cache`, `--rebuild` in place of, respectively, `-grf`, `-list`, `-cache`, `-rebuild`. - A new macro `CMDLINEARG()` is provided, to help defining new command line argument handlers (i.e. in plugins). the `addArg()` call is still required, but its syntax has changed. The `help` argument is now of type `const char *` rather than a function pointer, and it is supposed to contain the message to show in the `--help` screen. Pass `NULL` if no help message is desired. Signed-off-by: Haru <haru@dotalux.com>
2015-01-18Implementing nullpo interface for plugin useshennetsind1-0/+2
As proposed in pull request #361 Signed-off-by: shennetsind <ind@henn.et>
2015-01-12Added detailed error message when a plugin fails to loadHaru1-2/+3
- This helps figuring out why a plugin can't be loaded (especially on linux systems.) - Special thanks to Dastgir. Signed-off-by: Haru <haru@dotalux.com>
2014-12-31Add some missing null pointer checks after automatic checks.Andrei Karas1-12/+15
2014-12-14Fixed some improper grammar.Mysteries1-1/+1