Reconile a post merge issue [skip ci]

This commit is contained in:
Akkadius 2020-05-25 01:35:39 -05:00
parent a9790e2779
commit cfe3b2b071
3 changed files with 24 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* EQ::: Everquest Server Emulator /* EQ Everquest Server Emulator
Copyright (C) 2001-2002 EQ:: Development Team (http://EQ::.org) Copyright (C) 2001-2002 EQ:: Development Team (http://EQ::.org)
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@ -1299,7 +1299,8 @@ bool ZoneDatabase::GetTradeRecipe(
"FROM tradeskill_recipe_entries AS tre " "FROM tradeskill_recipe_entries AS tre "
"WHERE tre.recipe_id IN (%s) " "WHERE tre.recipe_id IN (%s) "
"GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u " "GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u "
"AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum
);
results = QueryDatabase(query); results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
LogError("Error in GetTradeRecipe, re-query: [{}]", query.c_str()); LogError("Error in GetTradeRecipe, re-query: [{}]", query.c_str());
@ -1373,23 +1374,30 @@ bool ZoneDatabase::GetTradeRecipe(
} }
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
int ccnt = 0; int component_count = 0;
for (int x = EQ::invbag::SLOT_BEGIN; x < EQ::invtype::WORLD_SIZE; x++) { for (int x = EQ::invbag::SLOT_BEGIN; x < EQ::invtype::WORLD_SIZE; x++) {
const EQ::ItemInstance* inst = container->GetItem(x); const EQ::ItemInstance* inst = container->GetItem(x);
if(!inst) if(!inst)
continue; continue;
const EQ::ItemData* item = GetItem(inst->GetItem()->ID); const EQ::ItemData* item = database.GetItem(inst->GetItem()->ID);
if (!item) if (!item)
continue; continue;
if (item->ID == atoi(row[0])) { if (item->ID == atoi(row[0])) {
ccnt++; component_count++;
}
} }
if (ccnt != atoi(row[1])) { LogTradeskills(
"[GetTradeRecipe] Component count loop [{}] item [{}] recipe component_count [{}]",
component_count,
item->ID,
atoi(row[1])
);
}
if (component_count != atoi(row[1])) {
return false; return false;
} }
} }