diff options
author | Andrei Karas <akaras@inbox.ru> | 2020-01-30 09:50:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2020-02-09 21:30:38 +0300 |
commit | 79811139ab53cc13f984f40f92c81ed4c06b2c0e (patch) | |
tree | 242a6aa756ad1806c5b3949448add9fbfa1fa9de /src | |
parent | 3cdf58c9d43e5f967b89d938bf22f0b129087e4a (diff) | |
download | hercules-79811139ab53cc13f984f40f92c81ed4c06b2c0e.tar.gz hercules-79811139ab53cc13f984f40f92c81ed4c06b2c0e.tar.bz2 hercules-79811139ab53cc13f984f40f92c81ed4c06b2c0e.tar.xz hercules-79811139ab53cc13f984f40f92c81ed4c06b2c0e.zip |
Dont save barter and expanded barter entries into db if amount is -1
Diffstat (limited to 'src')
-rw-r--r-- | src/map/npc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index aa392cea6..657fb987e 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1720,6 +1720,8 @@ static void npc_barter_tosql(struct npc_data *nd, int index) nullpo_retv(nd); Assert_retv(index >= 0 && index < nd->u.scr.shop->items); const struct npc_item_list *const item = &nd->u.scr.shop->item[index]; + if (item->qty == -1) + return; if (SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s', '%d', '%d', '%u', '%d')", map->npc_barter_data_db, nd->exname, item->nameid, item->qty, item->value, item->value2)) { Sql_ShowDebug(map->mysql_handle); @@ -1851,11 +1853,12 @@ static void npc_expanded_barter_tosql(struct npc_data *nd, int index) nullpo_retv(nd); Assert_retv(index >= 0 && index < nd->u.scr.shop->items); const struct npc_item_list *const item = &nd->u.scr.shop->item[index]; + if (item->qty == -1) + return; npc->expanded_barter_delfromsql(nd, index); StringBuf buf; - StrBuf->Init(&buf); StrBuf->Printf(&buf, "INSERT INTO `%s` VALUES ('%s', '%d', '%d', '%u'", map->npc_expanded_barter_data_db, nd->exname, item->nameid, item->qty, item->value); int currencyCount = item->value2; |