Merge branch 'master' into 1.11

This commit is contained in:
dP
2021-04-01 14:35:09 +03:00
11 changed files with 435 additions and 64 deletions

View File

@@ -629,7 +629,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) {
@@ -925,9 +925,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