summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-10-25 00:42:05 +0200
committerHaru <haru@dotalux.com>2014-10-25 00:42:05 +0200
commit3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5 (patch)
tree91414ec9aad216e7297a700dd9bec8c08d668502 /src/map/npc.c
parentab3b5bd8d231434d0c3fb4db0d977e96613b4e77 (diff)
downloadhercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.tar.gz
hercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.tar.bz2
hercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.tar.xz
hercules-3e1fe0d3842aab1c85f4dfd8e3533ca6631fc4e5.zip
Added some missing variable initializations
- The issue was caused by memcmp failing because of garbage in structs padding. - Fixes bugreport:8410, special thanks (and credits for the fix) to Garr http://hercules.ws/board/tracker/issue-8410-autotradeat-issue/ - Also reduced scope of some variables, where appropriate. - Thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 7dc0bda60..46b33bacb 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1818,11 +1818,11 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list) {
for( i = 0; i < n; ++i ) {
int nameid = item_list[i*2+1];
int amount = item_list[i*2+0];
- struct item item_tmp;
- if (itemdb_type(nameid) == IT_PETEGG)
+ if (itemdb_type(nameid) == IT_PETEGG) {
pet->create_egg(sd, nameid);
- else {
+ } else {
+ struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = nameid;
item_tmp.identify = 1;
@@ -1933,7 +1933,6 @@ int npc_market_buylist(struct map_session_data* sd, unsigned short list_size, st
for( i = 0; i < list_size; ++i ) {
int nameid = p->list[i].ITID;
int amount = p->list[i].qty;
- struct item item_tmp;
j = npc_market_qty[i];
@@ -1944,9 +1943,10 @@ int npc_market_buylist(struct map_session_data* sd, unsigned short list_size, st
npc->market_tosql(nd,j);
- if (itemdb_type(nameid) == IT_PETEGG)
+ if (itemdb_type(nameid) == IT_PETEGG) {
pet->create_egg(sd, nameid);
- else {
+ } else {
+ struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = nameid;
item_tmp.identify = 1;