summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index bf816faa7..4c3d114a5 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5145,6 +5145,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)
@@ -5160,17 +5165,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.
@@ -8027,8 +8040,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;
@@ -8049,7 +8062,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;