diff options
author | MadCamel <madcamel@gmail.com> | 2010-11-27 21:04:08 -0500 |
---|---|---|
committer | MadCamel <madcamel@gmail.com> | 2010-11-27 21:04:08 -0500 |
commit | 882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7 (patch) | |
tree | b6df7c8a511ac746f3b1427d3b27c5142b75240b /src/map/pc.c | |
parent | 5c3b1b3ed36194a2d0d23169f1b9f3282ab0104a (diff) | |
parent | 6b07d219170dcfefe86facea14037ffeb825f015 (diff) | |
download | tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.tar.gz tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.tar.bz2 tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.tar.xz tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.zip |
Merge branch 'master' of git://gitorious.org/tmw-eathena/mainline
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 2b5dc3e..11cd864 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3808,8 +3808,14 @@ int pc_putitemtocart (struct map_session_data *sd, int idx, int amount) struct item *item_data; nullpo_retr (0, sd); + + if (idx < 0 || idx >= MAX_INVENTORY) + return 1; + nullpo_retr (0, item_data = &sd->status.inventory[idx]); + if (!pc_iscarton (sd)) + return 1; if (item_data->nameid == 0 || item_data->amount < amount) return 1; if (pc_cart_additem (sd, item_data, amount) == 0) @@ -3827,8 +3833,14 @@ int pc_cartitem_amount (struct map_session_data *sd, int idx, int amount) struct item *item_data; nullpo_retr (-1, sd); + + if (idx < 0 || idx >= MAX_CART) + return -1; + nullpo_retr (-1, item_data = &sd->status.cart[idx]); + if (!pc_iscarton (sd)) + return -1; if (item_data->nameid == 0 || !item_data->amount) return -1; return item_data->amount - amount; @@ -3845,8 +3857,14 @@ int pc_getitemfromcart (struct map_session_data *sd, int idx, int amount) int flag; nullpo_retr (0, sd); + + if (idx < 0 || idx >= MAX_CART) + return 1; + nullpo_retr (0, item_data = &sd->status.cart[idx]); + if (!pc_iscarton (sd)) + return 1; if (item_data->nameid == 0 || item_data->amount < amount) return 1; if ((flag = pc_additem (sd, item_data, amount)) == 0) |