summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-11-29 00:51:32 +0100
committerHaru <haru@dotalux.com>2013-11-29 00:51:32 +0100
commit0cf52e88ea2779d00c64e36b33e606d658682136 (patch)
treede2fa623d10dc9d647e21af764f820a0537060ef /src/map/pc.c
parent3fae6a6a8f25406aab8cd568e40141c57f2110ce (diff)
downloadhercules-0cf52e88ea2779d00c64e36b33e606d658682136.tar.gz
hercules-0cf52e88ea2779d00c64e36b33e606d658682136.tar.bz2
hercules-0cf52e88ea2779d00c64e36b33e606d658682136.tar.xz
hercules-0cf52e88ea2779d00c64e36b33e606d658682136.zip
Corrected an uninitialized variable when adding an item
- The .favorite field of newly added inventory items wasn't correctly initialized to zero, potentially causing data loss (fixes bugreport:7854, thanks to Vincent, GrumpyPanda). Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index b5fa9268e..6120ba033 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3997,9 +3997,11 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
return 4;
memcpy(&sd->status.inventory[i], item_data, sizeof(sd->status.inventory[0]));
- // clear equips field first, just in case
+ // clear equip and favorite fields first, just in case
if( item_data->equip )
sd->status.inventory[i].equip = 0;
+ if( item_data->favorite )
+ sd->status.inventory[i].favorite = 0;
sd->status.inventory[i].amount = amount;
sd->inventory_data[i] = data;