Abstracted the CDClient tables

There is now an option to utilize shared memory for some CDClient tables by adding `CD_PROVIDER_MEMORY=1` to the CMakeVariables.txt file.

Allows masterconfig.ini to specify another run command for the world server, to allow for easier debugging through `valgrind`.
This commit is contained in:
wincent
2022-08-11 16:36:03 +02:00
parent 45ae46f6f1
commit 56f371216b
23 changed files with 661 additions and 328 deletions

View File

@@ -48,16 +48,28 @@ Instance * InstanceManager::GetInstance(LWOMAPID mapID, bool isFriendTransfer, L
//Start the actual process:
#ifdef _WIN32
std::string cmd = "start ./WorldServer.exe -zone ";
std::string cmd = "start ./WorldServer.exe";
#else
std::string cmd;
if (std::atoi(Game::config->GetValue("use_sudo_world").c_str())) {
cmd = "sudo ./WorldServer -zone ";
Game::logger->Log("InstanceManager", "world_command: %s\n", Game::config->GetValue("world_command").c_str());
if (!Game::config->GetValue("world_command").empty()) {
cmd = Game::config->GetValue("world_command");
// Replace %map%_%instance%_%time% with the correct values
cmd = cmd.replace(cmd.find("%map%"), 5, std::to_string(mapID));
cmd = cmd.replace(cmd.find("%instance%"), 10, std::to_string(instance->GetInstanceID()));
cmd = cmd.replace(cmd.find("%time%"), 5, std::to_string(time(nullptr)));
// Remove any other %
cmd = cmd.replace(cmd.find("%"), 1, "");
} else if (std::atoi(Game::config->GetValue("use_sudo_world").c_str())) {
cmd = "sudo ./WorldServer";
} else {
cmd = "./WorldServer -zone ";
cmd = "./WorldServer";
}
#endif
cmd.append(" -zone ");
cmd.append(std::to_string(mapID));
cmd.append(" -port ");
cmd.append(std::to_string(port));
@@ -73,6 +85,8 @@ Instance * InstanceManager::GetInstance(LWOMAPID mapID, bool isFriendTransfer, L
cmd.append("&"); //Sends our next process to the background on Linux
#endif
Game::logger->Log("InstanceManager", "Starting instance %i with command: %s\n", instance->GetInstanceID(), cmd.c_str());
system(cmd.c_str());
m_Instances.push_back(instance);

View File

@@ -226,7 +226,7 @@ int main(int argc, char** argv) {
ObjectIDManager::Instance()->Initialize(Game::logger);
Game::im = new InstanceManager(Game::logger, Game::server->GetIP());
CDBehaviorParameterTable::CreateSharedMap();
CDClientManager::Instance()->LoadHost();
//Depending on the config, start up servers:
if (config.GetValue("prestart_servers") != "" && config.GetValue("prestart_servers") == "1") {