summaryrefslogtreecommitdiff
path: root/src/map/npc.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-14Fix npc initialisation in first map (m == 0).Andrei Karas1-1/+1
2015-11-12Split npc_duplicate_sub into separate functions based on subtypesHaru1-48/+82
- For plugin overriding purposes. Thanks to Andrei Karas for the idea. Signed-off-by: Haru <haru@dotalux.com>
2015-11-12Split frequently repeated code to add/register new NPCs to its own functionHaru1-58/+34
Signed-off-by: Haru <haru@dotalux.com>
2015-11-12Added subtype initializer to npc_create_npcHaru1-15/+18
Signed-off-by: Haru <haru@dotalux.com>
2015-11-12Moved class and dir initializers to npc_create_npcHaru1-49/+35
Signed-off-by: Haru <haru@dotalux.com>
2015-11-12Split the duplication logic away from the parsing logic in NPC duplicatesHaru1-136/+154
- Fixes #812 (warning message while creating instances) Signed-off-by: Haru <haru@dotalux.com>
2015-11-11Split the source path reference retain mechanism out of npc_parsename.Haru1-37/+69
Signed-off-by: Haru <haru@dotalux.com>
2015-10-19rename malloc.c/h to memmgr.Andrei Karas1-1/+1
2015-10-11Cleanup of the HPluginData implementation (second part)Haru1-2/+1
- 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-10/+2
- 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-09-25More aggressive whitespace cleanup. Follow up to 51329e6Haru1-141/+120
Signed-off-by: Haru <haru@dotalux.com>
2015-09-24Add bl parameter to getcell functions.Andrei Karas1-8/+8
2015-09-18Clarified the intent of several assignments inside conditional expressionsHaru1-6/+6
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15HPM compatibility improvementsHaru1-0/+1
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-10Add script interface function run_npc. It do same thing as run.Andrei Karas1-11/+11
2015-08-09Improved validation of monster/boss_monster top-level script objectsHaru1-3/+3
- xs, ys, delay1, delay2 and event are now required, as described in the documentation. Signed-off-by: Haru <haru@dotalux.com>
2015-08-09Added validation of the 'facing' value in top-level script objectsHaru1-0/+18
Signed-off-by: Haru <haru@dotalux.com>
2015-08-09Deprecated use of numeric NPC view IDs. Use constants instead.Haru1-0/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-07-05Fixed issue #560Emistry1-12/+11
@sold[] return named item values.
2015-06-19Cleaned up some #includesHaru1-0/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru1-28/+28
- 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-02Re-implemented clif->colormes to accept arbitrary colorsHaru1-2/+2
- Due to the backward-incompatible change, clif->colormes was renamed to clif->messagecolor_self (for similarity with clif->messagecolor). The 'color' argument is now a 0xRRGGBB color rather than a color_table index. - enum clif_colors is no longer needed, but 0xRRGGBB-based constants are now provided to replace the old COLOR_* values. Signed-off-by: Haru <haru@dotalux.com>
2015-06-01Replaced some of the hardcoded values with constants (map)Haru1-4/+4
- Replaced several hardcoded values with the appropriate enums. - Added documentation for some hardcoded values that haven't been replaced by enums (yet) - Minor code legibility improvements. Signed-off-by: Haru <haru@dotalux.com>
2015-05-19Fixed some issues reported by coverity scan [2/3]Haru1-7/+22
- Corrected some NPC ID range checks Signed-off-by: Haru <haru@dotalux.com>
2015-05-19Fixed some issues reported by coverity scan [1/3]Haru1-3/+4
Signed-off-by: Haru <haru@dotalux.com>
2015-05-17Fixed some issues detected by coverity scanHaru1-8/+11
Signed-off-by: Haru <haru@dotalux.com>
2015-03-15Follow up 330e31cc71ece055908acb1eb967b4009ebc9c46shennetsind1-0/+1
Fixed an issue caused by unescaped characters being written and read out of the .pot unproperly. This commit also causes map server to print the file it wrote to when terminating Signed-off-by: shennetsind <ind@henn.et>
2015-02-23Hercules Ultimate Localization Designshennetsind1-6/+22
Servers can now run on any number of languages, without editing npc files. Designed by Haruna and Ind http://hercules.ws/board/topic/8687-hercules-ultimate-localization-design/ Signed-off-by: shennetsind <ind@henn.et>
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-38/+37
- 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-18Fixing 38 issuesshennetsind1-2/+1
Addressing out of bounds read/write, pointless null checks on already deferenced variables, dead code. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-1727 Fixesshennetsind1-1/+1
Addressing out of bounds read/write, pointless null checks on already deferenced variables. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-17Another ~10 Fixesshennetsind1-1/+2
Addressing out of bounds read/write. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-02Add npcdb_checkid to npc interface.Andrei Karas1-1/+9
2015-01-01Merge pull request #425 from 4144/fixesHaruna1-11/+13
Different fixes after automatic checks
2014-12-31Remove useless checks.Andrei Karas1-3/+3
2014-12-31Add some missing null pointer checks after automatic checks.Andrei Karas1-8/+10
2014-12-31fix for bug http://hercules.ws/board/tracker/issue-8483-map-crash/Andrei Karas1-0/+6
2014-12-16If player left npc, call onUnTouch event.Andrei Karas1-1/+8
2014-12-16Add function what called if player leave npc area.Andrei Karas1-0/+11
2014-12-16Add function what call OnUntouch event.Andrei Karas1-2/+14
2014-12-16Fix script error termination if already running script continue from very ↵Andrei Karas1-1/+1
far npc. Note for Haruna: possible it may add side effects. Need check.
2014-12-15add npc area size field.Andrei Karas1-6/+13
2014-11-28Add function for create npc.Andrei Karas1-39/+21
2014-11-27Fix npc->parse_unknown_object usage.Andrei Karas1-1/+1
2014-11-27Add function for parse or report about unknown object in parsing script file.Andrei Karas1-3/+10
2014-11-27Add function for parse/report unknown map flag.Andrei Karas1-2/+10
2014-11-16Whitespace cleanup (no code changes)Haru1-23/+26
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
2014-10-28Removed some temporary case-check error messages.Haru1-1/+1
- Control flow statements (break, case, continue, default, do, for, if, switch, whilei, else) and sub-function declarations (function) will no longer show a custom error message when they are incorrectly capitalized. - Note: This does not mean that they are no longer case-sensitive. This only means that no special message will be shown in case such an error is detected. The script engine will throw a normal error, as it would with any other kind of typo, rather than treating this as a special case. Enough time was given to update third party scripts, and it is now time to clean up our parsing code and get rid of these special warnings. - Variables, labels and commands will still show a warning for the time being, since the side-effects of silently ignoring it could be quite dangerous. An alternative approach to the case-check will be presented in future. For now, those who want to disable it (and save a bit on execution time and memory use), can simply comment out the #define ENABLE_CASE_CHECK line in script.h, as usual. Signed-off-by: Haru <haru@dotalux.com>
2014-10-28Removed some temporary case-check error messages.Haru1-19/+0
- Top level commands (function, warp, shop, cashshop, script, trader, duplicate, monster, boss_monster, mapflag) will no longer show a custom error message when they are incorrectly capitalized. - Note: This does not mean that the commands are no longer case-sensitive. This only means that no special message will be shown in case such an error is detected. The script engine will throw a normal error, as it would with any other kind of typo, rather than treating this as a special case. Enough time was given to update third party scripts, and it is now time to clean up our parsing code and get rid of these special warnings. Signed-off-by: Haru <haru@dotalux.com>
2014-10-25Added some missing variable initializationsHaru1-6/+6
- The issue was caused by memcmp failing because of garbage in structs padding. - Fixes bugreport:8410, special thanks (and credits for the fix) to Garr http://hercules.ws/board/tracker/issue-8410-autotradeat-issue/ - Also reduced scope of some variables, where appropriate. - Thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>