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

@ -61,7 +61,7 @@ class SharedDatabase;
namespace EQ namespace EQ
{ {
class InventoryProfile; class InventoryProfile;
class ItemInstance { class ItemInstance {
public: public:
///////////////////////// /////////////////////////

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

@ -1290,23 +1290,24 @@ bool ZoneDatabase::GetTradeRecipe(
//length limit on buf2 //length limit on buf2
if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096)
LogError("GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched [{}] of [{}] possible entries", index + 1, results.RowCount()); LogError("GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched [{}] of [{}] possible entries", index + 1, results.RowCount());
break; break;
} }
} }
query = StringFormat("SELECT tre.recipe_id " query = StringFormat("SELECT tre.recipe_id "
"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());
LogError("Error in GetTradeRecipe, error: [{}]", results.ErrorMessage().c_str()); LogError("Error in GetTradeRecipe, error: [{}]", results.ErrorMessage().c_str());
return false; return false;
} }
} }
if (results.RowCount() < 1) if (results.RowCount() < 1)
return false; return false;
@ -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++;
} }
LogTradeskills(
"[GetTradeRecipe] Component count loop [{}] item [{}] recipe component_count [{}]",
component_count,
item->ID,
atoi(row[1])
);
} }
if (ccnt != atoi(row[1])) { if (component_count != atoi(row[1])) {
return false; return false;
} }
} }