mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 07:47:13 +00:00
feat(master): an edit mode flag on a private instance, down to its world server
CreatePrivateZone carries editMode as one more byte, written only when set, so a plain private zone is sent as before. Master keeps it on the instance, starts the world server with -editmode 1, and gives a private instance's replacement (a reload or a live update) the same flag. Nothing sets it yet. A capped string now skips the characters it cut, so what follows it is read from the right place. A request to join a private instance that is still starting is answered once its world server is ready, instead of at once with an address nothing listens on yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -387,7 +387,7 @@ const InstancePtr& InstanceManager::FindInstanceWithPrivate(LWOMAPID mapID, LWOI
|
||||
return g_Empty;
|
||||
}
|
||||
|
||||
const InstancePtr& InstanceManager::CreatePrivateInstance(LWOMAPID mapID, LWOCLONEID cloneID, const std::string& password) {
|
||||
const InstancePtr& InstanceManager::CreatePrivateInstance(LWOMAPID mapID, LWOCLONEID cloneID, const std::string& password, const bool editMode) {
|
||||
const auto& instance = FindPrivateInstance(password);
|
||||
|
||||
if (instance != nullptr) {
|
||||
@@ -408,9 +408,10 @@ const InstancePtr& InstanceManager::CreatePrivateInstance(LWOMAPID mapID, LWOCLO
|
||||
|
||||
uint32_t port = GetFreePort();
|
||||
auto newInstance = make_unique<Instance>(mExternalIP, port, mapID, ++m_LastInstanceID, cloneID, maxPlayers, maxPlayers, true, password);
|
||||
newInstance->SetIsEditMode(editMode);
|
||||
|
||||
//Start the actual process:
|
||||
StartWorldServer(mapID, port, m_LastInstanceID, maxPlayers, cloneID);
|
||||
StartWorldServer(mapID, port, m_LastInstanceID, maxPlayers, cloneID, editMode);
|
||||
|
||||
m_Instances.push_back(std::move(newInstance));
|
||||
if (m_OnInstancesChanged) m_OnInstancesChanged();
|
||||
|
||||
Reference in New Issue
Block a user