diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-12-14 01:20:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-12-14 23:52:47 +0300 |
commit | bc682624496b854607b8e1bd976bb317eb8b0d4f (patch) | |
tree | 57cb030d5c5d0f2865c05ea641041634f7855258 /src/map/atcommand.c | |
parent | 1a26402c3bd986d0bba0435bfbd62e32abf07302 (diff) | |
download | hercules-bc682624496b854607b8e1bd976bb317eb8b0d4f.tar.gz hercules-bc682624496b854607b8e1bd976bb317eb8b0d4f.tar.bz2 hercules-bc682624496b854607b8e1bd976bb317eb8b0d4f.tar.xz hercules-bc682624496b854607b8e1bd976bb317eb8b0d4f.zip |
Add inventory size field into db and using it in server.
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6cfa86163..0a1fd6da3 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1359,9 +1359,7 @@ ACMD(item2) *------------------------------------------*/ ACMD(itemreset) { - int i; - - for (i = 0; i < MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) { pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_COMMAND); } @@ -4274,10 +4272,8 @@ ACMD(partyspy) *------------------------------------------*/ ACMD(repairall) { - int count, i; - - count = 0; - for (i = 0; i < MAX_INVENTORY; i++) { + int count = 0; + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].card[0] == CARD0_PET) continue; if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { @@ -5286,9 +5282,7 @@ ACMD(follow) *------------------------------------------*/ ACMD(dropall) { - int i; - - for (i = 0; i < MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].amount) { if(sd->status.inventory[i].equip != 0) pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); @@ -5304,8 +5298,6 @@ ACMD(dropall) *------------------------------------------*/ ACMD(storeall) { - int i; - if (sd->state.storage_flag != STORAGE_FLAG_NORMAL) { //Open storage. if (storage->open(sd) == 1) { @@ -5319,7 +5311,7 @@ ACMD(storeall) return false; } - for (i = 0; i < MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].amount) { if(sd->status.inventory[i].equip != 0) pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); @@ -6714,9 +6706,9 @@ ACMD(refreshall) *------------------------------------------*/ ACMD(identify) { - int i,num; + int num = 0; - for (i=num=0;i<MAX_INVENTORY;i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){ num++; } @@ -8256,7 +8248,7 @@ ACMD(itemlist) } else if( strcmpi(info->command, "itemlist") == 0 ) { location = "inventory"; items = sd->status.inventory; - size = MAX_INVENTORY; + size = sd->status.inventorySize; } else return false; |