summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)AuthorFilesLines
2016-12-03Clarify some Job Class vs MapID confusion (1/2)Haru1-3/+5
This commit ensures that `sd->status.class` and related variables only contain Job Classes (i.e. the client-compatible values, where High Novice 4001) and are never checked against the bitmask-based MapID values. As a rule of thumb, from now on, when a variable is named `class`, it is intended to contain a Job Class ID and not a MapID. The type of such variable shall be a signed `int16` or `int`. To ensure that related third party code is also verified when this commit is merged, the variable `struct mmo_charstatus::class_ (i.e. `sd->status.class_`) is renamed to `class`. Some issues in related lines are also fixed, including: - A wrong check in the char server would prevent the correct detection of babies in code related to the family exp sharing. - Baby Arch Bishops would not be affected by Eucharistica. - A wrong check would cause the `questinfo()` script command not to display its information for most classes (except 1-1 classes). - Map IDs and Job Classes were mixed up in `itemdb_jobid2mapid()` and `itemdb_jobmask2mapid()` for 1-1 classes (causing currently no harm, since they just happen to coincide). - The Baby Sura class would not cause parties to be marked as containing a monk type character (for SLS Team Up purposes). - Baby Geneticists would bypass the cart check when trying to equip ammunitions. - Baby Mechanics would bypass the Mado Gear check when trying to equip ammunitions. - Transcendent Shadow Chasers would lose the Stalkers' ability to clone transcendent skills. Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Clarify the meaning of the MAPID_* constantsHaru1-6/+6
The enum values are now written in a more explicit way, showing how they're composed (upper mask + base job). A future-proof static assertion is added, to make sure the base jobs won't overlap the upper masks. Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Add support for static assertions (on compilers that support them)Haru1-0/+27
This introduces the macro `STATIC_ASSERT(ex, msg)`, that works like its C11 counterpart `_Static_assert(ex, msg)`, on compilers that support it. Support is provided, depending on the compiler: - When in C11 mode, use the native `_Static_assert` - If the compiler advertises having the `c_static_assert` feature, use `_Static_assert` (according to the clang documentation). - If the compiler is GCC >= 4.7 (tested to be compatible), use `_Static_assert` (nonstandard extension, C11 feature available in C99). - If the compiler is MSVC (all the currently supported versions have been tested to be compatible), then use `static_assert` (nonstandard extension, C++ feature) - Otherwise, define it as a no-op macro. Signed-off-by: Haru <haru@dotalux.com>
2016-11-19Add fixed-size versions of the _int64 libconfig getters/settersHaru2-13/+87
As we use int64 (instead of long long int) through the code, it's preferable if our libconfig interface does the same, avoiding us to create temporary interchange variables for that purpose. Signed-off-by: Haru <haru@dotalux.com>
2016-11-01Merge pull request #1498 from Lemongrass3110/cleanup/copyright2016Ibrahem Hossam24-24/+24
Fixed copyright year for 2016
2016-10-28Fixed copyright year for 2016Lemongrass311024-24/+24
2016-10-28Fixed wrong nullpo checkLemongrass31101-1/+1
2016-10-22Increases MAX_SKILL to occupy Summoner SkillsDastgir Pojee1-1/+1
2016-10-22Added Packets for Several Clients: 2015-10-01, 2015-10-29, 2015-11-04 andDastgir Pojee1-0/+2
2015-12-16 Added New Char Creation Packet(0xa39). Added Placeholder of JOB_SUMMONER
2016-10-14HPM Hooks UpdateHaru1-6/+0
Signed-off-by: Haru <haru@dotalux.com>
2016-10-14Fixed a memory manager crash when a memory leak occurs in a pluginHaru3-2/+6
- 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-07Updated VECTOR_INIT() and VECTOR_ENSURE() to be more analyzer- (and ↵Haru1-7/+10
human-reader-) friendly Signed-off-by: Haru <haru@dotalux.com>
2016-10-07Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra)Haru3-9/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-10-04Fix warning in strlib.cAndrei Karas1-0/+1
2016-10-04Add missing checks into utils.cAndrei Karas1-6/+23
2016-10-04Add missing checks into sysinfo.cAndrei Karas1-26/+58
2016-10-04Add missing checks into sql.cAndrei Karas1-5/+15
2016-10-04Add missing checks into socket.cAndrei Karas1-9/+22
2016-10-04Add missing checks into mutex.cAndrei Karas1-0/+12
2016-10-04Add missing checks into mapindex.cAndrei Karas1-10/+25
2016-10-04Add missing checks into grfio.cAndrei Karas1-3/+21
2016-10-04Add missing checks into ers.cAndrei Karas1-5/+11
2016-10-04Add missing checks into des.cAndrei Karas1-0/+7
2016-10-04Add missing checks into db.cAndrei Karas1-10/+15
2016-10-04Add missing checks into core.cAndrei Karas1-9/+30
2016-10-04Add missing checks into console.cAndrei Karas1-11/+32
2016-10-04Add missing checks into HPM.cAndrei Karas1-11/+35
2016-10-02Changed _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") to target GCC 4.6 ↵Haru2-9/+9
instead of 4.5 - The support on GCC 4.5 is incomplete, and in order to build Hercules, GCC >= 4.6 is recommended Signed-off-by: Haru <haru@dotalux.com>
2016-09-30Add different fixes for gcc 7 warnings.Andrei Karas3-0/+17
Some possible buffer overflows. Add attribute for mark fallthrough cases. Skipped libconfig warnings.
2016-09-22Fixed a compile error when SEND_SHORTLIST is disabledHaru1-5/+4
- Since f8edb93a (likely caused by a find and replace macro gone horribly wrong) Signed-off-by: Haru <haru@dotalux.com>
2016-08-20Re-added HPM support for configuration settingsHaru2-4/+60
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-20Added a better error message when a libconfig file is not foundHaru1-0/+5
Previously, it'd say "[Error] (null):0 - file I/O error" Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Added option to make plugin-defined battle config entries optionalHaru3-10/+12
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 libconfigHaru2-2/+52
Ported to modern Hercules and cleaned up from Panikon's commits: 44fea0b3cdba6901599265220228ba4359b1f96d, 9cba05bc0811e638bbaaa6cff887d0b2c9872560 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported socket.conf (was packet.conf) to libconfigHaru1-67/+196
Ported to modern Hercules and cleaned up from Panikon's commits: b10f2a88073882bea812c6278fdec7848102ab87, bc5007299a92898ea4630f2a977d9a1b42b6c145 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Changed access_allow and access_deny to VECTORsHaru1-24/+29
Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Removed unnecessary typedefs in socket.cHaru1-13/+13
Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported inter-server.conf to libconfigHaru2-42/+56
Ported to modern Hercules and cleaned up from Panikon's commits: 40f9ec33868e2240cab013308897898ed252b3e0, a9d646da19e25ab6fcf44dbd1ae7d90c30f6686c, 1aa8581a0aecbfd53e877686c399ffb731dcd75e, 72c645b015ae6130ca7d4309d0fb1413340e7f23, f8c906a0496b9acdae1d8244b1544fa03592061e, 51d88a58983c9552dfd1a0f059e5a031742aed61, 443684b3c77f4c32fe7877a7f8d62debf73b1e93, cf93eafef1f322cd1583226272b7d4008f562da4 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported char-server.conf to libconfigHaru1-4/+2
Fixed issue: 8115, now start items can be equipped as well Ported to modern Hercules and cleaned up from Panikon's commits: c6482e9870645ffe59a6a059b819574d4ac79fd9, 832fb27d4f767e4bc8b68c432d0da00b7cb7a4f9, f81b579899e3a15bd472ca8c6a6e0116c43bec92, e23723725499b617def03d05661eca637edaeabd, 0b783a83d82e588efd760f7f4baec0c8074a6fd1, 1b7de91308a57ea07b158ed95a2515a3c8cc36bd, 677d3430cbda0962b320a60cf499e9dadf637d00 Signed-off-by: Haru <haru@dotalux.com>
2016-07-17If build bot enabled, show error message in ShowConfigWarning.Andrei Karas1-0/+4
2016-07-14Changed mmo_charstatus::status_point and mmo_charstatus::skill_point to intHaru1-1/+1
Fixes several -Wsign-compare issues Signed-off-by: Haru <haru@dotalux.com>
2016-07-14Changed mmo_charstatus::base_level and mmo_charstatus::job_level to intHaru1-1/+1
Fixes several -Wsign-compare issues Signed-off-by: Haru <haru@dotalux.com>
2016-07-12HPM Hooks UpdateHaru2-0/+11
Signed-off-by: Haru <haru@dotalux.com>
2016-07-12Various changes to the grfio interfaceHaru2-188/+330
Mostly stylistic changes. Cleaned up documentation. Signed-off-by: Haru <haru@dotalux.com>
2016-07-12Dropped unnecessary typedefs from grfioHaru1-24/+26
Signed-off-by: Haru <haru@dotalux.com>
2016-07-12Interface grfio.chemagx3-14/+39
2016-07-12HPM Hooks UpdateHaru2-1/+12
Signed-off-by: Haru <haru@dotalux.com>
2016-07-12Various changes to the thread interfaceHaru2-116/+135
Mostly stylistic changes. Cleaned up documentation. Signed-off-by: Haru <haru@dotalux.com>
2016-07-12Removed unnecessary typedefs from thread and spinlockHaru5-74/+86
- SPIN_LOCK -> struct spin_lock - rAthread -> struct thread_handle - rAthreadProc -> threadFunc - RATHREAD_PRIO -> enum thread_priority - RAT_PRIO_LOW -> THREADPRIO_LOW - RAT_PRIO_NORMAL -> THREADPRIO_NORMAL - RAT_PRIO_HIGH -> THREADPRIO_HIGH - RA_THREADS_MAX -> THREADS_MAX Signed-off-by: Haru <haru@dotalux.com> fixupthread
2016-07-12Interface thread.chemagx5-139/+173