Merge branch 'main' into fix/cmake-libs-2

This commit is contained in:
David Markowitz
2024-03-03 04:17:27 -08:00
committed by GitHub
475 changed files with 5755 additions and 6213 deletions

View File

@@ -17,7 +17,8 @@
InstanceManager::InstanceManager(Logger* logger, const std::string& externalIP) {
mLogger = logger;
mExternalIP = externalIP;
GeneralUtils::TryParse(Game::config->GetValue("world_port_start"), m_LastPort);
m_LastPort =
GeneralUtils::TryParse<uint16_t>(Game::config->GetValue("world_port_start")).value_or(m_LastPort);
m_LastInstanceID = LWOINSTANCEID_INVALID;
}
@@ -180,7 +181,7 @@ void InstanceManager::RequestAffirmation(Instance* instance, const PendingInstan
bitStream.Write(request.id);
Game::server->Send(&bitStream, instance->GetSysAddr(), false);
Game::server->Send(bitStream, instance->GetSysAddr(), false);
LOG("Sent affirmation request %llu to %i/%i", request.id,
static_cast<int>(instance->GetZoneID().GetMapID()),
@@ -322,7 +323,7 @@ Instance* InstanceManager::FindPrivateInstance(const std::string& password) {
}
int InstanceManager::GetSoftCap(LWOMAPID mapID) {
CDZoneTableTable* zoneTable = CDClientManager::Instance().GetTable<CDZoneTableTable>();
CDZoneTableTable* zoneTable = CDClientManager::GetTable<CDZoneTableTable>();
if (zoneTable) {
const CDZoneTable* zone = zoneTable->Query(mapID);
@@ -335,7 +336,7 @@ int InstanceManager::GetSoftCap(LWOMAPID mapID) {
}
int InstanceManager::GetHardCap(LWOMAPID mapID) {
CDZoneTableTable* zoneTable = CDClientManager::Instance().GetTable<CDZoneTableTable>();
CDZoneTableTable* zoneTable = CDClientManager::GetTable<CDZoneTableTable>();
if (zoneTable) {
const CDZoneTable* zone = zoneTable->Query(mapID);
@@ -360,7 +361,7 @@ void Instance::Shutdown() {
BitStreamUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::SHUTDOWN);
Game::server->Send(&bitStream, this->m_SysAddr, false);
Game::server->Send(bitStream, this->m_SysAddr, false);
LOG("Triggered world shutdown for zone/clone/instance %i/%i/%i", GetMapID(), GetCloneID(), GetInstanceID());
}

View File

@@ -134,7 +134,7 @@ private:
Logger* mLogger;
std::string mExternalIP;
std::vector<Instance*> m_Instances;
unsigned short m_LastPort = 3000;
uint16_t m_LastPort = 3000;
LWOINSTANCEID m_LastInstanceID;
/**

View File

@@ -89,9 +89,8 @@ int main(int argc, char** argv) {
if (!dConfig::Exists("worldconfig.ini")) LOG("Could not find worldconfig.ini, using default settings");
uint32_t clientNetVersion = 171022;
const auto clientNetVersionString = Game::config->GetValue("client_net_version");
if (!clientNetVersionString.empty()) GeneralUtils::TryParse(clientNetVersionString, clientNetVersion);
const uint32_t clientNetVersion = GeneralUtils::TryParse<uint32_t>(clientNetVersionString).value_or(171022);
LOG("Using net version %i", clientNetVersion);
@@ -177,17 +176,6 @@ int main(int argc, char** argv) {
// Run migrations should any need to be run.
MigrationRunner::RunSQLiteMigrations();
//Get CDClient initial information
try {
CDClientManager::Instance();
} catch (CppSQLite3Exception& e) {
LOG("Failed to initialize CDServer SQLite Database");
LOG("May be caused by corrupted file: %s", (Game::assetManager->GetResPath() / "CDServer.sqlite").string().c_str());
LOG("Error: %s", e.errorMessage());
LOG("Error Code: %i", e.errorCode());
return EXIT_FAILURE;
}
//If the first command line argument is -a or --account then make the user
//input a username and password, with the password being hidden.
if (argc > 1 &&
@@ -588,7 +576,7 @@ void HandlePacket(Packet* packet) {
BitStreamUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::SESSION_KEY_RESPONSE);
bitStream.Write(key.first);
bitStream.Write(username);
Game::server->Send(&bitStream, packet->systemAddress, false);
Game::server->Send(bitStream, packet->systemAddress, false);
break;
}
}
@@ -798,7 +786,7 @@ int ShutdownSequence(int32_t signal) {
{
CBITSTREAM;
BitStreamUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::SHUTDOWN);
Game::server->Send(&bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
Game::server->Send(bitStream, UNASSIGNED_SYSTEM_ADDRESS, true);
LOG("Triggered master shutdown");
}