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:
@@ -893,12 +893,12 @@ namespace {
|
||||
|
||||
void OnCreatePrivateZone(const CreatePrivateZone& request, const SystemAddress& sysAddr) {
|
||||
// Passwords were cut to 50 characters when read
|
||||
const auto& newInst = Game::im->CreatePrivateInstance(request.zoneID, request.cloneID, request.password.c_str());
|
||||
const auto& newInst = Game::im->CreatePrivateInstance(request.zoneID, request.cloneID, request.password.c_str(), request.editMode != 0);
|
||||
if (!newInst) {
|
||||
LOG("No private zone was created for map %i/%i", request.zoneID, request.cloneID);
|
||||
return;
|
||||
}
|
||||
LOG("Creating private zone %i/%i/%i", newInst->GetMapID(), newInst->GetCloneID(), newInst->GetInstanceID());
|
||||
LOG("Creating private zone %i/%i/%i%s", newInst->GetMapID(), newInst->GetCloneID(), newInst->GetInstanceID(), newInst->GetIsEditMode() ? " in edit mode" : "");
|
||||
}
|
||||
|
||||
void OnRequestPrivateZone(const RequestPrivateZone& request, const SystemAddress& sysAddr) {
|
||||
@@ -915,6 +915,12 @@ namespace {
|
||||
return;
|
||||
}
|
||||
|
||||
// Still starting (asked for right after it was created): answered when its world server is ready
|
||||
if (!instance->GetIsReady()) {
|
||||
instance->GetPendingRequests().push_back({ requestID, static_cast<bool>(mythranShift), sysAddr, {} });
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& zone = instance->GetZoneID();
|
||||
|
||||
RequestZoneTransferResponse response;
|
||||
|
||||
Reference in New Issue
Block a user