diff options
author | Ibrahim Zidan <brahem@aotsw.com> | 2019-04-08 04:23:08 +0200 |
---|---|---|
committer | Ibrahim Zidan <brahem@aotsw.com> | 2019-04-10 16:25:22 +0200 |
commit | 37767f6505db9e7a4039621cfd77623b06d92606 (patch) | |
tree | 74743daf5d2e72e3cb8b521dab3f1bce5e398172 /src/map/clif.h | |
parent | ab81d4012eac5c2c00c485971fc9b89bf69761be (diff) | |
download | hercules-37767f6505db9e7a4039621cfd77623b06d92606.tar.gz hercules-37767f6505db9e7a4039621cfd77623b06d92606.tar.bz2 hercules-37767f6505db9e7a4039621cfd77623b06d92606.tar.xz hercules-37767f6505db9e7a4039621cfd77623b06d92606.zip |
Rewrite clif_storageItems
- The maximum packetsize is now decided during compile time depending on client version which fixes an issue started with clients supporting int32 as itemid where packet size would underflow
- The function now have a single loop that is easier to read and understand
Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
Diffstat (limited to 'src/map/clif.h')
-rw-r--r-- | src/map/clif.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/map/clif.h b/src/map/clif.h index 6c9058cba..b3441f908 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -78,6 +78,11 @@ enum rodex_get_items; #define COLOR_YELLOW 0xffff00U #define COLOR_DEFAULT COLOR_GREEN +#define MAX_STORAGE_ITEM_PACKET_NORMAL ((INT16_MAX - (sizeof(struct ZC_STORE_ITEMLIST_NORMAL) - (sizeof(struct NORMALITEM_INFO) * MAX_ITEMLIST))) / sizeof(struct NORMALITEM_INFO)) +#define MAX_STORAGE_ITEM_PACKET_EQUIP ((INT16_MAX - (sizeof(struct ZC_STORE_ITEMLIST_EQUIP) - (sizeof(struct EQUIPITEM_INFO) * MAX_ITEMLIST))) / sizeof(struct EQUIPITEM_INFO)) +STATIC_ASSERT(MAX_STORAGE_ITEM_PACKET_NORMAL > 0, "Max items per storage item packet for normal items is less than 1, it's most likely to be a bug and shall not be ignored."); +STATIC_ASSERT(MAX_STORAGE_ITEM_PACKET_EQUIP > 0, "Max items per storage item packet for equip items is less than 1, it's most likely to be a bug and shall not be ignored."); + /** * Enumerations **/ |