mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Workaround for servers that rarely send LevelDataChunk before LevelBegin due to async sending. (Thanks BPzeBanshee)
This commit is contained in:
parent
b0c7f5f55a
commit
57b7eb8013
@ -82,6 +82,8 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HandleLevelInit() {
|
void HandleLevelInit() {
|
||||||
|
if( gzipStream != null )
|
||||||
|
return;
|
||||||
game.Map.Reset();
|
game.Map.Reset();
|
||||||
game.SetNewScreen( new LoadingMapScreen( game, ServerName, ServerMotd ) );
|
game.SetNewScreen( new LoadingMapScreen( game, ServerName, ServerMotd ) );
|
||||||
if( ServerMotd.Contains( "cfg=" ) ) {
|
if( ServerMotd.Contains( "cfg=" ) ) {
|
||||||
@ -108,6 +110,10 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HandleLevelDataChunk() {
|
void HandleLevelDataChunk() {
|
||||||
|
// Workaround for some servers that send LevelDataChunk before LevelInit
|
||||||
|
// due to their async packet sending behaviour.
|
||||||
|
if( gzipStream == null )
|
||||||
|
HandleLevelInit();
|
||||||
int usedLength = reader.ReadInt16();
|
int usedLength = reader.ReadInt16();
|
||||||
gzippedMap.Position = 0;
|
gzippedMap.Position = 0;
|
||||||
gzippedMap.SetLength( usedLength );
|
gzippedMap.SetLength( usedLength );
|
||||||
@ -149,6 +155,8 @@ namespace ClassicalSharp {
|
|||||||
sentWomId = true;
|
sentWomId = true;
|
||||||
}
|
}
|
||||||
gzipStream = null;
|
gzipStream = null;
|
||||||
|
ServerName = null;
|
||||||
|
ServerMotd = null;
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user