Allow client and server negotiate on savegame format if both are patched
This commit is contained in:
@@ -592,7 +592,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
|
||||
sent_packets = 4; // We start with trying 4 packets
|
||||
|
||||
/* Make a dump of the current game */
|
||||
if (SaveWithFilter(this->savegame, true) != SL_OK) usererror("network savedump failed");
|
||||
if (SaveWithFilter(this->savegame, true, this->cm_preset) != SL_OK) usererror("network savedump failed");
|
||||
}
|
||||
|
||||
if (this->status == STATUS_MAP) {
|
||||
@@ -908,9 +908,15 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p)
|
||||
p->Recv_string(name, sizeof(name));
|
||||
playas = (Owner)p->Recv_uint8();
|
||||
client_lang = (NetworkLanguage)p->Recv_uint8();
|
||||
uint8 savegame_formats = p->CanReadFromPacket(1) ? p->Recv_uint8() : 23u /* assume non-modded has everything but zstd */;
|
||||
|
||||
if (this->HasClientQuit()) return NETWORK_RECV_STATUS_CONN_LOST;
|
||||
|
||||
/* Find common savegame compression format to use */
|
||||
auto preset = citymania::FindCompatibleSavePreset("", savegame_formats);
|
||||
if (!preset) return this->SendError(NETWORK_ERROR_NOT_EXPECTED);
|
||||
this->cm_preset = *preset;
|
||||
|
||||
/* join another company does not affect these values */
|
||||
switch (playas) {
|
||||
case COMPANY_NEW_COMPANY: // New company
|
||||
|
||||
Reference in New Issue
Block a user