summaryrefslogtreecommitdiff
path: root/src/map/script.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-12Adjusted indexing of vars with index 0shennetsind1-8/+66
Special Thanks to Haruna. Also fixed a compiler warning, thanks to ossi0110 Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Follow up 82b583b5ef4e729ad2c3c74b26adce16a145605ashennetsind1-10/+7
Fixed mapreg reload issue, sql_query not returning results, and caused deletearray to no longer display error messages when the array in question is not available. Special Thanks to Haruna, ossi0110 Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Fixed Bug 7960shennetsind1-2/+4
http://hercules.ws/board/tracker/issue-7960-scriptc-warnings/ Also applied a temporary adjustment due to ERS_OPT_CLEAN not being consistent (decent fix will follow up, haru and i are working on it) -- thanks to kyeme for pointing it out! Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Follow up 82b583b5ef4e729ad2c3c74b26adce16a145605ashennetsind1-1/+0
Forgot to remove this little fella. Thanks to kyeme! Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Hercules 1st 2014 MegaPatchshennetsind1-321/+514
http://hercules.ws/board/topic/3886-hercules-1st-2014-megapatch/ Signed-off-by: shennetsind <ind@henn.et>
2014-01-09Merge branch 'master' of https://github.com/HerculesWS/Herculesshennetsind1-2679/+2571
2013-12-31Fixed issues pointed out in Report 7909shennetsind1-1/+1
Special Thanks to Vader. http://hercules.ws/board/tracker/issue-7909-some-code-errors-and-optimisations/ Signed-off-by: shennetsind <ind@henn.et>
2013-12-30Whitespace fixes in script.cHaru1-2379/+2370
Signed-off-by: Haru <haru@dotalux.com>
2013-12-30Added support for string vars on commands that require a stringHaru1-311/+212
- Fixes bugreport:7901, thanks to Angelmelody http://hercules.ws/board/tracker/issue-7901-about-pass-variable-type-as-function-parameter - Bonus: debugmes can now take both strings and numbers (i.e. to print a number variable you no longer need to do 'debugmes "" + .@num;') Signed-off-by: Haru <haru@dotalux.com>
2013-12-24Christmas Patch - 2013-12-23 Supportshennetsind1-1/+276
Info: http://hercules.ws/board/topic/3614-christmas-patch-gifto/ Signed-off-by: shennetsind <ind@henn.et>
2013-12-17Speed up of several procedures that rely on ERS, _mreallocz ('z'ero)shennetsind1-2/+1
Made Possible Thanks to the Woonderful Haruna! <3 Commit also fixes an inconsistency in the ERS, where it'd start with clear memory but would use garbage upon resizing, also implements a new ERS option that clears entries as soon as pass by ers_free, so that they'll be all shinny for when ers_alloc reuses them. Signed-off-by: shennetsind <ind@henn.et>
2013-12-15Replaced pc->pc_has_permission/can_give_items/can_give_bound_items with ↵shennetsind1-1/+1
equivalent macros Because 2/3 jumps to perform such a operation is just awful Signed-off-by: shennetsind <ind@henn.et>
2013-12-14Replaced pc->get_group_level with a macro (pc_get_group_level)shennetsind1-3/+3
Because 2 jumps to get a single value is just awful. Signed-off-by: shennetsind <ind@henn.et>
2013-12-12ensuring script_state is clear (as ers reuses memory).shennetsind1-0/+1
Signed-off-by: shennetsind <ind@henn.et>
2013-12-11modified second "infinity loop !" error so that its different from the firstshennetsind1-1/+1
and thus doesn't cause confusion (and it wasn't loop-related anyway). Signed-off-by: shennetsind <ind@henn.et>
2013-12-17Fixed several compiler warningsHaru1-30/+26
- Warnings detected thanks to Xcode's compiler settings (more strict by default) and clang, warnings mostly but not only related to data sizes on 64 bit systems, that were silenced until now by very lax compiler settings. - This also decreases by a great deal the amount of warnings produced by MSVC in x64 mode (for the adventurous ones who tried that) - Also fixed (or silenced in case of false positives) the potential issues pointed out by the (awesome) clang static analyzer. - Patch co-produced with Ind, I'm merging and committing in his place! Signed-off-by: Haru <haru@dotalux.com>
2013-12-11Corrected some local 'mapindex' variables shadowing the global oneHaru1-9/+9
Signed-off-by: Haru <haru@dotalux.com>
2013-12-09Fixed some logic errorsshennetsind1-7/+8
Special Thanks to Haru Signed-off-by: shennetsind <ind@henn.et>
2013-12-06HPM: mapindex interfaceshennetsind1-41/+41
Signed-off-by: shennetsind <ind@henn.et>
2013-12-05Improved script builtin function parserHaru1-75/+86
- Removed duplicate code shared between script_hp_add and script_parse_builtin. - Improved error handling in script_hp_add to be on par with the script_parse_builtin version. - Added script->add_builtin function, providing a hooking point for plugins (i.e. text editor syntax definition generators) to obtain the builtin commands list. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-12-03Questlog fixesHaru1-17/+13
- Improved memory usage of the quest log system. (saves up to 75kB per online character). Fixes issue #133. - Fixed various issues with quest entries disappearing from characters without an apparent reason, or monster kill counters getting stuck - the issues were caused by a de-synchronization between the two parallel questlog arrays in map_session_data. - Added some code documentation. - Thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-12-02Fixed an uninitialized variable / broken code.Haru1-22/+21
- Follow up to c6c2ad187c386d8d27d3336dcbdd5a92555493d2 - Special thanks to Ind Signed-off-by: Haru <haru@dotalux.com>
2013-12-01Changed variables, labels, functions, commands to case sensitive.Haru1-93/+153
- Fixes bugreport:7810, thanks to Wend, kyeme, evilpuncker, jaBote, and various other people I may be forgetting to mention http://hercules.ws/board/tracker/issue-7810-disguise-script-command - Due to the nature of this change, I'm leaving the deprecation messages lingering around for a while more (as errors rather than warnings), to make sure they won't pass unnoticed, in case you haven't yet updated your custom scripts to comply with this. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-12-01Changed builtin keywords in the script engine to case sensitive.Haru1-52/+61
- Any scripts using the wrong case, that were throwing deprecation warnings until now, will become invalid. - Related to bugreport:7810. Signed-off-by: Haru <haru@dotalux.com>
2013-11-30Fixed an issue with assignment operators and expressionsHaru1-2/+3
- Assignment operators would not work correctly, or at all, when followed by an expression (as opposed as a value). - Fixes bugreport:7864, thanks to Lelouch, Ind. - Added associativity tests for those operators to the self-test script. - Added total error count to the self-test script (thanks to Lighta.) Signed-off-by: Haru <haru@dotalux.com>
2013-11-28Merge branch 'master' of https://github.com/HerculesWS/Herculesshennetsind1-120/+168
2013-11-28Added support for automatic concatenation of adjacent string literalsHaru1-18/+21
- [ This commit is part of a larger script engine related update ] - Adjacent string literals are now automatically concatenated into one string upon parsing. - Adjacent string literals are string literals (i.e. "such as this", with only whitespace (including line breaks and/or comments) between them. For example, the lines: mes "this will be concatenated " /* skipping this comment */ " into one string"; // at parse time will produce an output of "this will be concatenated into one string". - The feature brings parity with other languages (i.e. C), and makes it easier to split long strings in multiple lines, without having to resort to a, slower, run-time string concatenation operator ('+') - Special thanks to Trojal for the idea. Signed-off-by: Haru <haru@dotalux.com>
2013-11-28Corrected operator precedence table.Haru1-20/+20
- [ This commit is part of a larger script engine related update ] - Operator precedence rules now closely follow those of languages such as C and derivates/related (C++, Java, PHP, etc.) - Please note that if you had custom scripts with non parenthesized expressions containing bitwise |, &, ^ operators, they may behave incorrectly now (or perhaps they were already behaving incorrectly, since the previous behavior was undocumented). - Added an up to date operator precedence/associativity table in the script documentation. - Added an operator/keyword self-test script in the npc/custom folder, in case if may be of some use for future regression-testing.
2013-11-28Added pre de/increment operators. Fixed post de/increment operators.Haru1-100/+146
- [ This commit is part of a larger script engine related update ] - Suffix ++ and -- operators now behave like in other languages (updating the variable *after* its value is returned.) - Prefix ++ and -- operators are added for parity with other scripting/programming languages. They update the variable they're applied to *before* returning its value. - Please note that the implementation of the prefix form of those operators (like it happens in most languages) is more efficient than the suffix form. '++.@i' is (slightly) faster than '.@i++', or at least not slower. - Fixed some outdated script debug functions. - Follow-up to c18f438. Signed-off-by: Haru <haru@dotalux.com>
2013-11-28Removed meaningless '~=' operator.Haru1-1/+0
- [ This commit is part of a larger script engine related update ] - Since: c18f438 Signed-off-by: Haru <haru@dotalux.com>
2013-11-27Dropped emperium spawn restrictionsshennetsind1-5/+0
Thanks to kyeme for bringing it to our attention. Signed-off-by: shennetsind <ind@henn.et>
2013-11-19Merge branch 'master' of https://github.com/HerculesWS/Herculesshennetsind1-10/+11
2013-11-19Fixed Bug 7799 - SC_MOONSTAR neverendingshennetsind1-2/+10
Follows up 665f1306a130d4b8c359972bf4e58ef9d3bd9cd8 http://hercules.ws/board/tracker/issue-7799-sc-moonstar/ Signed-off-by: shennetsind <ind@henn.et>
2013-11-19Sanitized and improved several macros through the codeHaru1-7/+8
- Sanitized all potentially unsafe macros (related eA:15259) - Improved some function-like macros to evaluate their argument only once and keep it in a temporary variable. This improves performance in the damage calculation related code. Signed-off-by: Haru <haru@dotalux.com>
2013-11-18Corrected size-related constant names and cleaned up comments (closes #222).Mumbles1-3/+3
2013-11-12Follow up ce6c4c63a3a5c1516780f2eac978d02820a8dc0bshennetsind1-0/+5
Fixed shutdown memory manager warning. Signed-off-by: shennetsind <ind@henn.et>
2013-11-11Fixed MSVC compile error in ce6c4c63a3a5c1516780f2eac978d02820a8dc0bHaru1-2/+3
- Fixed bugreport:7818, thanks to sevenzz23 http://hercules.ws/board/tracker/issue-7818-error-when-compiling/ Signed-off-by: Haru <haru@dotalux.com>
2013-11-11Follow-up to dd05ae388d69e7df1dffcd393cea5e4cdc605e75Haru1-4/+108
- Reduced number of false positives when parsing .@scope variables. - Added correct error source information where it previously said 'source not found'. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-11-10Added deprecation messages for incorrect capitalization in scriptsHaru1-3/+56
- These messages are temporary, only meant to help those with custom scripts to transition them to the correct case-sensitive syntax. If you ignore the deprecation messages you encounter, your scripts may continue to work just as they did until now, but this will no longer be true in the near future, and they may stop working at any time. If you ignore this, and your scripts break, you'll get to keep the pieces :) Signed-off-by: Haru <haru@dotalux.com>
2013-11-09Consolidated commands called in scripts to their lowercase versionHaru1-13/+13
- Added a note about variables and command scripts case sensitivity. Even though the engine still accepts variable, function and command names in a case insensitive way, it is discouraged to rely on such behavior. Please update your custom scripts as soon as possible. Signed-off-by: Haru <haru@dotalux.com>
2013-11-07Merge remote-tracking branch 'upstream/master'shennetsind1-38/+78
2013-11-07Extended script constants to support NPC sprite IDsHaru1-35/+76
- Added support for constants whose name begins with a number. - Follow-up to 124ab2a1cdb344f24170a4d91f7000ebabf39b40. - Replaced calls to setnpcdisplay with hardcoded numeric IDs to constants. - Thanks to Yommy. Signed-off-by: Haru <haru@dotalux.com>
2013-11-07Item Bound Fixes/Adjustments/Improvementsshennetsind1-192/+60
Special Thanks to Haruna Signed-off-by: shennetsind <ind@henn.et>
2013-11-07Corrected a const pointer being incorrectly initializedHaru1-2/+1
- Fixes bugreport:7804, thanks to kyeme http://hercules.ws/board/tracker/issue-7804-warning-c4090-function Signed-off-by: Haru <haru@dotalux.com>
2013-11-07Fixed equip command failing when another item of the same kind is equippedHaru1-1/+1
- The command now correctly skips the already equipped items, rather than trying to equip them again (and fail during the process). - Special thanks to Poison. Signed-off-by: Haru <haru@dotalux.com>
2013-11-06Merge remote-tracking branch 'origin/master'shennetsind1-3/+226
Signed-off-by: shennetsind <ind@henn.et> Conflicts: conf/messages.conf src/common/mmo.h src/map/pc_groups.c src/map/pc_groups.h
2013-11-06Merge branch 'master' of https://github.com/HerculesWS/Herculesshennetsind1-18/+54
2013-11-06Merge pull request #217 from HerculesWS/script-checkershennetsind1-18/+54
Introducing the Hercules Standalone Script Syntax Checker
2013-11-06Fixed Bug 7799shennetsind1-9/+2
SC_MOONSTAR, SC_SUPER_STAR are no longer removeable by sc_end all, and sc clear. Modified sc_config.txt, added a new flag (0x80/128) for such cases. http://hercules.ws/board/tracker/issue-7799-sc-moonstar/ Special Thanks to kyeme. Signed-off-by: shennetsind <ind@henn.et>
2013-11-06Modified status_calc_shennetsind1-9/+9
Replaces the previous 'first' flag with a multi-option flag capable of selectively determining calls where the recalculation must not be hold by delayed damage, and therefore must take place immediately. This fixes issues caused by actions that require immediate recalculation e.g. on-level-up max_hp update, also modified @baselevel where status_calc was being called after the heal and not before, causing it not to be fully healed. Special Thanks to Haruna! <3 Signed-off-by: shennetsind <ind@henn.et>