summaryrefslogtreecommitdiff
path: root/src/char/int_storage.c
AgeCommit message (Collapse)AuthorFilesLines
2020-01-13Update copyright headers for year 2020Haru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2018-07-17Replace item id shorts to int in char server.Andrei Karas1-3/+3
2018-07-01Change functions to static where possible (Part 3 - char)Haru1-11/+11
This fixes issues with plugins defining symbols with the same names Signed-off-by: Haru <haru@dotalux.com>
2018-06-30Move mapif functions from int_storage.c to mapif.cHaru1-214/+0
Signed-off-by: Haru <haru@dotalux.com>
2018-06-30Move some non-mapif functionality from the mapif interface to the ↵Haru1-30/+38
inter_storage interface Signed-off-by: Haru <haru@dotalux.com>
2018-05-312012-2018 !Maytichai Saowa1-1/+1
2017-11-18Pass the correct types and sizes to the StmtBind functionsHaru1-13/+13
Fixes #1531 (and other similar issues) Signed-off-by: Haru <haru@dotalux.com>
2017-07-05Optimisation of char_memitemdata_to_sql()smokexyz1-1/+1
Implements the storage saving algorithm for inventory, cart and guild storage tables. Total queries to a table in any call would be no more than 4 per call, replacing the original algorithm that could make a lot more through single update queries per call. This significantly reduces the run time speed for saving/loading of item data from the game server.
2017-06-02Fix replace statement formatting in storage save function.smokexyz1-3/+3
2017-05-31Fix a race condition when saving the storage on logoutHaru1-70/+17
The storage data is no longer cached in the char server. This removal doesn't cause any performance loss, since the cached data was refreshed (loaded from the database) after every save operation. This commit moves the load at the beginning of the save rather than at the end, and discars the cached copy after the save is completed. Related to #1754 Signed-off-by: Haru <haru@dotalux.com>
2017-05-30Merge pull request #1756 from Smokexyz/mmo_charstatus-fixsmokexyz1-7/+6
Fix storage saving checks and amount update.
2017-05-30Fix storage saving checks and amount update.smokexyz1-7/+6
Special thanks to @MishimaHaruna for the fix.
2017-05-29Fix memory leak in storage item vector (Fixes #1751)Andrei Karas1-0/+14
2017-05-22Add storage_data reception, parsing and sending to/from the map-server.Smokexyz1-33/+316
Remove loading and saving of storage_data through char.c Re-declaration of structure storage_data as a vector. Re-code of portions in the map-server using storage_data. A new approach is taken by saving the loaded storage data from sql into memory for the duration of the session, thereby removing the need of querying the database to re-load all items everytime a storage save routine is issued from the map-server. Saving of storage items is done through a new function that significantly reduces the number of queries compared to char_memitemdata_tosql(), and therefore run-time speed. This method potentially reduces the number of update and delete queries from MAX_STORAGE (which could be >= 600) times to literally 1. Storage items are stored in a dynamically allocated array and handled accordingly. struct mmo_charstatus size reduces by 34,800 bytes. Update pc_checkitem() with masks for item checks. `sd->state.itemcheck` has been changed to `sd->itemcheck` of type `enum pc_checkitem_types` `battle/items.conf` has been updated to reflect configuration changes. Further updates to assert a successful reception of storage data in related functions.
2017-04-04Implementation of Item Options System.Smokexyz1-20/+51
Allows the infusing of equipments with bonus item options. This feature is constrained to clients of packet versions greater than or equal to `20150226`. Item Options and their effects are defined server-side in `db/item_options.conf` and client side in `data/luafiles514/lua files/datainfo/addrandomoptionnametable.lub` The ID of the option must tally with the correct index of the description provided in the client side lua file to avoid bugs. IT_OPT_* keys and MAX_ITEM_OPTIONS macro are also exported from the source as constants. An additional flag `disable_options` has been added to sql, and as `DisableOptions: true/false (boolean, defaults to false !!for equipments only!!)` to item_db.conf files. Script commands documentation is also included. SQL file updates are included. Credits: [Smokexyz](https://github.com/Smokexyz) Style and Script Fixes by [Asheraf](https://github.com/Asheraf) Initial design Idea by [secretdataz](https://github.com/secretdataz)
2016-10-28Fixed copyright year for 2016Lemongrass31101-1/+1
2016-03-20Removed unnecessary typedefs from sql.hHaru1-1/+1
- Sql -> struct Sql - SqlStmt -> struct SqlStmt - SqlDataType -> enum SqlDataType This is expected to improve compile time, by removing #include cycles (and forward declaring instead) Signed-off-by: Haru <haru@dotalux.com>
2016-02-24Removed several unnecessary explicit casts of the WFIFOP resultHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-02-24Removed several unnecessary RFIFOP typecastsHaru1-1/+1
- While this is arguable, those explicit typecasts are potentially dangerous/misleading (for example, a const specifier might get accidentally dropped without even generating a compiler warning, or a variable type might change during code changes, and any related warning would get silenced by the explicit typecast). - As a reminder Hercules is written in C, and not in C++ (and there's no such thing as "compiling in C++ mode" - they're two different languages.) As such, it is legal to let the compiler automatically promote void* from/to any non-const pointer type, as well as const void* from/to any const pointer type. Signed-off-by: Haru <haru@dotalux.com>
2016-02-24Added const qualifier to several variable/argument pointersHaru1-1/+1
- This is necessary for compatibility with a const RFIFOP. Signed-off-by: Haru <haru@dotalux.com>
2016-02-19Remove some unused macroses. Left macroses in socket.cAndrei Karas1-2/+0
2016-02-19Fix all known warnings from compiler flags -Wformat*Andrei Karas1-1/+1
Add all missing -Wformat flags into configure.
2015-12-15Added GPL-compliant header to all sources and build scriptsHaru1-4/+20
Signed-off-by: Haru <haru@dotalux.com>
2015-10-19rename malloc.c/h to memmgr.Andrei Karas1-1/+1
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-06-19Cleaned up some #includesHaru1-1/+0
Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru1-12/+12
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
2015-05-17Fixed some issues detected by coverity scanHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-04-09Add checks to int_storage.cAndrei Karas1-1/+7
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-7/+4
- 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-12Fixed some -Wformat-security warningsHaru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2014-11-16Whitespace cleanup (no code changes)Haru1-7/+7
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-11-15Move global variable into interface in inter.cAndrei Karas1-48/+48
2014-11-15Add most functions from int_storage.c to interfaces.Andrei Karas1-14/+36
2014-11-15Add most functions from char.c to interfaces.Andrei Karas1-5/+5
Introduced interfaces: chr, mapif, loginif.
2014-11-15Add prefix inter_storage_ to most functions in int_storage.cAndrei Karas1-7/+7
2014-11-15Add prefix char_ to most functions in char.cAndrei Karas1-5/+5
2014-10-25Added some missing variable initializationsHaru1-0/+1
- 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>
2014-08-07Corrected several format-string errors through the codeHaru1-10/+7
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
2014-05-10Re-commit of "Fixed order of includes in all source files"Haru1-9/+13
This reverts commit 94657284973f4037596bae468ebfbee5c217e02b.
2014-05-10Revert "Fixed order of includes in all source files"panikon1-13/+9
This reverts commit b6b3f58795288701d0e162d43fa6f0a47af913b3. Fixes issue 8184 http://hercules.ws/board/tracker/issue-8184-cart-related/
2014-05-09Fixed order of includes in all source filesHaru1-9/+13
- Changed order according to the (upcoming) code style guidelines. - Fixes several issues caused by missing headers when their include order is changed or in plugins. Signed-off-by: Haru <haru@dotalux.com>
2014-04-12Added sanity checks in itemboundretrieve_subpanikon1-2/+11
2014-04-12Fixed some compiler/analyzer warnings.Haru1-9/+10
- Sanitized some macros (they weren't going to cause problems, but better being safe than sorry) - Parenthesized an incorrect expression in 6f6a6b3. - Inverted an if(foo); else bar; statement in 6f6a6b3 to get rid of the empty expression (for legibility). - Commented out some unnecessary lines as suggested by clang's static analyzer. Signed-off-by: Haru <haru@dotalux.com>
2014-04-10Fixed issue: 7936panikon1-8/+60
http://hercules.ws/board/tracker/issue-7936-guildparty-item-bounded/
2013-12-05Fixed Bug 7879shennetsind1-5/+7
guild storage would remain locked when the operation failed, now it unlocks regardless of success. Special Thanks to GrumpyPanda http://hercules.ws/board/tracker/issue-7879-guild-storage-bug/ Signed-off-by: shennetsind <ind@henn.et>
2013-11-07Item Bound Fixes/Adjustments/Improvementsshennetsind1-32/+26
Special Thanks to Haruna Signed-off-by: shennetsind <ind@henn.et>
2013-10-31No error after compilation, but when logging in at map server it will crash.sevenzz231-16/+151
Im pretty sure its on the clif.c Signed-off-by: sevenzz23 <sevenzz23@yahoo.com>
2013-05-15HPM Updateshennetsind1-46/+47
Made SQL and strlib functions HPM-friendly, special thanks to Yommy for bringing the issue up. Added partial map.c support, for the all-handy map[] array, beware that soon the whole map.c renewal design will be commit and when that happens your usage of map.c functions in plugins might require some updates. Signed-off-by: shennetsind <ind@henn.et>
2013-01-08* Renaming variable name from nsiuid to unique_id for better understanding ↵markzd1-4/+4
of its meaning, as requested on tid:69380. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17086 54d463be-8e91-2dee-dedb-b68131a5f0ec