summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-10-29 13:03:14 -0200
committershennetsind <ind@henn.et>2013-10-29 13:03:14 -0200
commitd080ed83f6c02ccf774cae906c4da698e793a310 (patch)
tree86de3b6ea29393748daab6f9b74bec2e6678b7af /src/map
parentcde3dff870ec0056c6bbd4c32be3306952000440 (diff)
downloadhercules-d080ed83f6c02ccf774cae906c4da698e793a310.tar.gz
hercules-d080ed83f6c02ccf774cae906c4da698e793a310.tar.bz2
hercules-d080ed83f6c02ccf774cae906c4da698e793a310.tar.xz
hercules-d080ed83f6c02ccf774cae906c4da698e793a310.zip
Fixed Bug #7788
Modified Storage packet so that the size of the packet is no longer a problem; splitting now in chunks of 500, made possible thanks to Yommy! http://hercules.ws/board/tracker/issue-7788-storage-problem/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c61
1 files changed, 35 insertions, 26 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 8c2dc21b2..957f75d99 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2459,40 +2459,49 @@ void clif_equiplist(struct map_session_data *sd) {
}
void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) {
- int i, normal = 0, equip = 0;
+ int i = 0;
struct item_data *id;
- for( i = 0; i < items_length; i++ ) {
-
- if( items[i].nameid <= 0 )
- continue;
-
- id = itemdb->search(items[i].nameid);
- if( !itemdb->isstackable2(id) ) //Non-stackable (Equippable)
- clif_item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip);
- else //Stackable (Normal)
- clif_item_normal(i+1,&storelist_normal.list[normal++],&items[i],id);
- }
+ do {
+ int normal = 0, equip = 0, k = 0;
+
+ for( ; i < items_length && k < 500; i++, k++ ) {
+
+ if( items[i].nameid <= 0 )
+ continue;
+
+ id = itemdb->search(items[i].nameid);
+
+ if( !itemdb->isstackable2(id) ) //Non-stackable (Equippable)
+ clif_item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip);
+ else //Stackable (Normal)
+ clif_item_normal(i+1,&storelist_normal.list[normal++],&items[i],id);
+ }
- if( normal ) {
- storelist_normal.PacketType = storagelistnormalType;
- storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal);
+ if( normal ) {
+ storelist_normal.PacketType = storagelistnormalType;
+ storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal);
+
#if PACKETVER >= 20120925
- safestrncpy(storelist_normal.name, "Storage", NAME_LENGTH);
-#endif
- clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF);
- }
-
- if( equip ) {
- storelist_equip.PacketType = storagelistequipType;
- storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip);
+ safestrncpy(storelist_normal.name, "Storage", NAME_LENGTH);
+#endif
+
+ clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF);
+ }
+
+ if( equip ) {
+ storelist_equip.PacketType = storagelistequipType;
+ storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip);
#if PACKETVER >= 20120925
- safestrncpy(storelist_equip.name, "Storage", NAME_LENGTH);
+ safestrncpy(storelist_equip.name, "Storage", NAME_LENGTH);
#endif
+
+ clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF);
+ }
- clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF);
- }
+ } while ( i < items_length );
+
}
void clif_cartlist(struct map_session_data *sd) {