Merge pull request #848 from Tuupertunut/master

Fixed map loading with protocol 0.76.
This commit is contained in:
Tomoaki Kawada 2020-08-06 15:21:09 +09:00 committed by GitHub
commit 738c7e509e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,6 +88,7 @@ namespace spades {
PacketTypeWeaponReload = 28, // C2S2P
PacketTypeChangeTeam = 29, // C2S2P
PacketTypeChangeWeapon = 30, // C2S2P
PacketTypeMapCached = 31, // S2C
PacketTypeHandShakeInit = 31, // S2C
PacketTypeHandShakeReturn = 32, // C2S
PacketTypeVersionGet = 33, // S2C
@ -1299,6 +1300,16 @@ namespace spades {
} break;
case PacketTypeMapStart: {
// next map!
if (protocolVersion == 4) {
// The AoS 0.76 protocol allows the client to load a map from a local cache
// if possible. After receiving MapStart, the client should respond with
// MapCached to indicate whether the map with a given checksum exists in the
// cache or not. We don't implement a local cache, so we always ask the
// server to send fresh map data.
NetPacketWriter wri(PacketTypeMapCached);
wri.Write((uint8_t)0);
enet_peer_send(peer, 0, wri.CreatePacket());
}
client->SetWorld(NULL);
auto mapSize = reader.ReadInt();