mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #4789 from janisozaur/server-load-new-map
Fix #4755: Crash loading new map while running a server
This commit is contained in:
commit
7a4ef4073f
|
@ -927,11 +927,21 @@ void Network::Server_Send_MAP(NetworkConnection* connection)
|
|||
SDL_RWops* rw = SDL_RWFromFP(temp, SDL_TRUE);
|
||||
size_t out_size;
|
||||
unsigned char *header;
|
||||
header = save_for_network(rw, out_size, connection->RequestedObjects);
|
||||
std::vector<const ObjectRepositoryItem *> objects;
|
||||
if (connection) {
|
||||
objects = connection->RequestedObjects;
|
||||
} else {
|
||||
// This will send all custom objects to connected clients
|
||||
// TODO: fix it so custom objects negotiation is performed even in this case.
|
||||
objects = scenario_get_packable_objects();
|
||||
}
|
||||
header = save_for_network(rw, out_size, objects);
|
||||
SDL_RWclose(rw);
|
||||
if (header == nullptr) {
|
||||
connection->SetLastDisconnectReason(STR_MULTIPLAYER_CONNECTION_CLOSED);
|
||||
connection->Socket->Disconnect();
|
||||
if (connection) {
|
||||
connection->SetLastDisconnectReason(STR_MULTIPLAYER_CONNECTION_CLOSED);
|
||||
connection->Socket->Disconnect();
|
||||
}
|
||||
return;
|
||||
}
|
||||
size_t chunksize = 65000;
|
||||
|
|
Loading…
Reference in New Issue