mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 02:31:03 +00:00
Partial work on loot tables (non-compiling)
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2013 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "loot.h"
|
||||
#include "../common/debug.h"
|
||||
#include "../common/shareddb.h"
|
||||
#include "../common/ipc_mutex.h"
|
||||
#include "../common/memory_mapped_file.h"
|
||||
#include "../common/eqemu_exception.h"
|
||||
#include "../common/loottable.h"
|
||||
|
||||
void LoadLoot(SharedDatabase *database) {
|
||||
EQEmu::IPCMutex mutex("loot");
|
||||
mutex.Lock();
|
||||
|
||||
uint32 loottable_count, loottable_max, loottable_entries_count, lootdrop_count, lootdrop_max, lootdrop_entries_count;
|
||||
database->GetLootTableInfo(loottable_max, loottable_entries_count,
|
||||
lootdrop_max, lootdrop_entries_count);
|
||||
uint32 size = (sizeof(uint32) *3) +
|
||||
(sizeof(uint32) * (loottable_max + 1)) +
|
||||
(sizeof(LootTable_Struct) * loottable_count) +
|
||||
(sizeof(LootTableEntries_Struct) * loottable_entries_count) +
|
||||
(sizeof(uint32) * (lootdrop_max + 1)) +
|
||||
(sizeof(LootDrop_Struct) * lootdrop_count) +
|
||||
(sizeof(LootDropEntries_Struct) * lootdrop_entries_count);
|
||||
|
||||
EQEmu::MemoryMappedFile mmf("shared/loot", size);
|
||||
mmf.ZeroFile();
|
||||
|
||||
void *ptr = mmf.Get();
|
||||
database->LoadLoot(ptr, loottable_count, loottable_max, loottable_entries_count, lootdrop_count,
|
||||
lootdrop_max, lootdrop_entries_count);
|
||||
mmf.SetLoaded();
|
||||
mutex.Unlock();
|
||||
}
|
||||
Reference in New Issue
Block a user