diff options
author | Haru <haru@dotalux.com> | 2017-05-27 19:24:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-27 19:24:42 +0200 |
commit | cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2 (patch) | |
tree | 1b1df55f4143bae6bed85093f3424b6af11e4a01 /src/map/atcommand.c | |
parent | be118c7fad6df29dc691452ef511ac12fea37a06 (diff) | |
parent | d966a8e6860d418bb3a235e57928436127eba555 (diff) | |
download | hercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.tar.gz hercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.tar.bz2 hercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.tar.xz hercules-cb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2.zip |
Merge pull request #1722 from Smokexyz/mmo_charstatus-fix
Dismemberment of `storage_data` from `mmo_charstatus`.
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9f37a754f..4d3a82ee2 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5159,6 +5159,11 @@ ACMD(storeall) } } + if (sd->storage.received == false) { + clif->message(fd, msg_fd(fd, 27)); // "Storage has not been loaded yet" + return false; + } + for (i = 0; i < MAX_INVENTORY; i++) { if (sd->status.inventory[i].amount) { if(sd->status.inventory[i].equip != 0) @@ -5174,17 +5179,25 @@ ACMD(storeall) ACMD(clearstorage) { - int i, j; + int i; if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) { clif->message(fd, msg_fd(fd,250)); return false; } - j = sd->status.storage.storage_amount; - for (i = 0; i < j; ++i) { - storage->delitem(sd, i, sd->status.storage.items[i].amount); + if (sd->storage.received == false) { + clif->message(fd, msg_fd(fd, 27)); // "Storage has not been loaded yet" + return false; } + + for (i = 0; i < VECTOR_LENGTH(sd->storage.item); ++i) { + if (VECTOR_INDEX(sd->storage.item, i).nameid == 0) + continue; // we skip the already deleted items. + + storage->delitem(sd, i, VECTOR_INDEX(sd->storage.item, i).amount); + } + storage->close(sd); clif->message(fd, msg_fd(fd,1394)); // Your storage was cleaned. @@ -8041,8 +8054,8 @@ ACMD(itemlist) if( strcmpi(info->command, "storagelist") == 0 ) { location = "storage"; - items = sd->status.storage.items; - size = MAX_STORAGE; + items = VECTOR_DATA(sd->storage.item); + size = VECTOR_LENGTH(sd->storage.item); } else if( strcmpi(info->command, "cartlist") == 0 ) { location = "cart"; items = sd->status.cart; @@ -8063,7 +8076,7 @@ ACMD(itemlist) const struct item* it = &items[i]; struct item_data* itd; - if( it->nameid == 0 || (itd = itemdb->exists(it->nameid)) == NULL ) + if (it->nameid == 0 || (itd = itemdb->exists(it->nameid)) == NULL) continue; counter += it->amount; |