From 2a9f38de2a618a9d1c1dbe3f97d624bd07c26d84 Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Sun, 28 Oct 2018 12:44:13 -0400 Subject: [PATCH] Fix Get Corpse to fetch the corpse indicated. --- zone/zonedb.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 027225243..5fe6560f1 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -4356,15 +4356,15 @@ uint32 ZoneDatabase::GetCharacterCorpseCount(uint32 char_id) { } uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) { - std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u'", char_id); - auto results = QueryDatabase(query); + std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u' limit %d, 1", char_id, corpse); - for (auto row = results.begin(); row != results.end(); ++row) { - for (int i = 0; i < corpse; i++) { - return atoul(row[0]); - } - } - return 0; + auto results = QueryDatabase(query); + auto row = results.begin(); + + if (row != results.end()) + return atoul(row[0]); + else + return 0; } uint32 ZoneDatabase::GetCharacterCorpseItemCount(uint32 corpse_id){