mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-03 18:53:52 +00:00
Fix for no factions in database crashing the server and shared memory
This commit is contained in:
parent
f613d12c61
commit
9daf572ea7
@ -1158,7 +1158,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) {
|
||||
auto row = results.begin();
|
||||
|
||||
list_count = static_cast<uint32>(atoul(row[0]));
|
||||
max_lists = static_cast<uint32>(atoul(row[1]));
|
||||
max_lists = static_cast<uint32>(atoul(row[1] ? row[1] : "0"));
|
||||
}
|
||||
|
||||
const NPCFactionList* SharedDatabase::GetNPCFactionEntry(uint32 id) {
|
||||
@ -1235,9 +1235,6 @@ bool SharedDatabase::LoadNPCFactionLists() {
|
||||
uint32 list_count = 0;
|
||||
uint32 max_lists = 0;
|
||||
GetFactionListInfo(list_count, max_lists);
|
||||
if(list_count == 0) {
|
||||
EQ_EXCEPT("SharedDatabase", "Database returned no result");
|
||||
}
|
||||
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<NPCFactionList>::estimated_size(
|
||||
list_count, max_lists));
|
||||
|
||||
@ -1837,7 +1834,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot
|
||||
auto row = results.begin();
|
||||
|
||||
loot_table_count = static_cast<uint32>(atoul(row[0]));
|
||||
max_loot_table = static_cast<uint32>(atoul(row[1]));
|
||||
max_loot_table = static_cast<uint32>(atoul(row[1] ? row[1] : "0"));
|
||||
loot_table_entries = static_cast<uint32>(atoul(row[2]));
|
||||
}
|
||||
|
||||
@ -1858,7 +1855,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d
|
||||
auto row =results.begin();
|
||||
|
||||
loot_drop_count = static_cast<uint32>(atoul(row[0]));
|
||||
max_loot_drop = static_cast<uint32>(atoul(row[1]));
|
||||
max_loot_drop = static_cast<uint32>(atoul(row[1] ? row[1] : "0"));
|
||||
loot_drop_entries = static_cast<uint32>(atoul(row[2]));
|
||||
}
|
||||
|
||||
|
||||
@ -31,9 +31,6 @@ void LoadFactions(SharedDatabase *database) {
|
||||
uint32 lists = 0;
|
||||
uint32 max_list = 0;
|
||||
database->GetFactionListInfo(lists, max_list);
|
||||
if(lists == 0) {
|
||||
EQ_EXCEPT("Shared Memory", "Unable to get any factions from the database.");
|
||||
}
|
||||
|
||||
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<NPCFactionList>::estimated_size(lists, max_list));
|
||||
EQEmu::MemoryMappedFile mmf("shared/faction", size);
|
||||
|
||||
@ -3256,7 +3256,7 @@ bool ZoneDatabase::LoadFactionData()
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
max_faction = atoi(row[0]);
|
||||
max_faction = row[0] ? atoi(row[0]) : 0;
|
||||
faction_array = new Faction*[max_faction+1];
|
||||
for(unsigned int index=0; index<max_faction; index++)
|
||||
faction_array[index] = nullptr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user