mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Base Data] Remove from shared memory and simplify (#4045)
* [Base Data] Remove from shared memory and simplify - Removes Base Data loading from shared memory and puts it into zone. - Changes type of `level` and `class` to `uint8_t` from `uint32_t` for consistency since we're renaming fields here anyway. - Renames `unk1` to `hp_regen` in `base_data` table. - Renames `unk2` to `end_regen` in `base_data` table. - These changed fields were already mapped, we just hadn't renamed them for whatever reason. - Regenerates Base Data repository. - Adds `#reload base_data` to reload base data in real time. * Cleanup * Update shareddb.h * Cleanup. * Update shareddb.cpp * Update main.cpp
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
|
||||
SET(shared_memory_sources
|
||||
base_data.cpp
|
||||
items.cpp
|
||||
main.cpp
|
||||
spells.cpp
|
||||
@@ -9,7 +8,6 @@ SET(shared_memory_sources
|
||||
)
|
||||
|
||||
SET(shared_memory_headers
|
||||
base_data.h
|
||||
items.h
|
||||
spells.h
|
||||
skill_caps.h
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/* 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 "base_data.h"
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/shareddb.h"
|
||||
#include "../common/ipc_mutex.h"
|
||||
#include "../common/memory_mapped_file.h"
|
||||
#include "../common/eqemu_exception.h"
|
||||
|
||||
void LoadBaseData(SharedDatabase *database, const std::string &prefix) {
|
||||
EQ::IPCMutex mutex("base_data");
|
||||
mutex.Lock();
|
||||
int records = (database->GetMaxBaseDataLevel() + 1);
|
||||
if(records == 0) {
|
||||
EQ_EXCEPT("Shared Memory", "Unable to get base data from the database.");
|
||||
}
|
||||
|
||||
uint32 size = records * 16 * sizeof(BaseDataStruct);
|
||||
|
||||
auto Config = EQEmuConfig::get();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("base_data");
|
||||
EQ::MemoryMappedFile mmf(file_name, size);
|
||||
mmf.ZeroFile();
|
||||
|
||||
void *ptr = mmf.Get();
|
||||
database->LoadBaseData(ptr, records);
|
||||
mutex.Unlock();
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/* 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
|
||||
*/
|
||||
|
||||
#ifndef __EQEMU_SHARED_MEMORY_BASE_DATA_H
|
||||
#define __EQEMU_SHARED_MEMORY_BASE_DATA_H
|
||||
|
||||
#include <string>
|
||||
#include "../common/eqemu_config.h"
|
||||
|
||||
class SharedDatabase;
|
||||
void LoadBaseData(SharedDatabase *database, const std::string &prefix);
|
||||
|
||||
#endif
|
||||
+5
-23
@@ -30,7 +30,6 @@
|
||||
#include "items.h"
|
||||
#include "skill_caps.h"
|
||||
#include "spells.h"
|
||||
#include "base_data.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "../common/path_manager.h"
|
||||
@@ -180,22 +179,15 @@ int main(int argc, char **argv)
|
||||
|
||||
std::string hotfix_name = "";
|
||||
|
||||
bool load_all = true;
|
||||
bool load_items = false;
|
||||
bool load_skill_caps = false;
|
||||
bool load_spells = false;
|
||||
bool load_bd = false;
|
||||
bool load_all = true;
|
||||
bool load_items = false;
|
||||
bool load_loot = false;
|
||||
bool load_skill_caps = false;
|
||||
bool load_spells = false;
|
||||
|
||||
if (argc > 1) {
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
switch (argv[i][0]) {
|
||||
case 'b':
|
||||
if (strcasecmp("base_data", argv[i]) == 0) {
|
||||
load_bd = true;
|
||||
load_all = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
if (strcasecmp("items", argv[i]) == 0) {
|
||||
load_items = true;
|
||||
@@ -263,16 +255,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (load_all || load_bd) {
|
||||
LogInfo("Loading base data");
|
||||
try {
|
||||
LoadBaseData(&content_db, hotfix_name);
|
||||
} catch (std::exception &ex) {
|
||||
LogError("{}", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
LogSys.CloseFileLogs();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user