diff options
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; |