mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
Fix crash when failing to connect to server
This commit is contained in:
parent
8d76c0c1b1
commit
7db39d73ee
@ -59,7 +59,7 @@ namespace ClassicalSharp.Network {
|
|||||||
cpe = new CPEProtocol(game);
|
cpe = new CPEProtocol(game);
|
||||||
cpeBlockDefs = new CPEProtocolBlockDefs(game);
|
cpeBlockDefs = new CPEProtocolBlockDefs(game);
|
||||||
wom = new WoMProtocol(game);
|
wom = new WoMProtocol(game);
|
||||||
ResetProtocols();
|
ResetState();
|
||||||
|
|
||||||
classic.WriteLogin(game.Username, game.Mppass);
|
classic.WriteLogin(game.Username, game.Mppass);
|
||||||
SendPacket();
|
SendPacket();
|
||||||
@ -190,21 +190,22 @@ namespace ClassicalSharp.Network {
|
|||||||
packetSizes[i] = 0;
|
packetSizes[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.ExtendedPositions = false; reader.ExtendedBlocks = false;
|
BlockInfo.SetMaxUsed(255);
|
||||||
writer.ExtendedPositions = false; writer.ExtendedBlocks = false;
|
ResetState();
|
||||||
BlockInfo.SetMaxUsed(255);
|
|
||||||
|
|
||||||
ResetProtocols();
|
|
||||||
cpeData.Reset();
|
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetProtocols() {
|
void ResetState() {
|
||||||
if (classic == null) return; // null if no successful connection ever made before
|
if (classic == null) return; // null if no successful connection ever made before
|
||||||
|
|
||||||
|
cpeData.Reset();
|
||||||
classic.Reset();
|
classic.Reset();
|
||||||
cpe.Reset();
|
cpe.Reset();
|
||||||
cpeBlockDefs.Reset();
|
cpeBlockDefs.Reset();
|
||||||
wom.Reset();
|
wom.Reset();
|
||||||
|
|
||||||
|
reader.ExtendedPositions = false; reader.ExtendedBlocks = false;
|
||||||
|
writer.ExtendedPositions = false; writer.ExtendedBlocks = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Action[] handlers = new Action[256];
|
internal Action[] handlers = new Action[256];
|
||||||
@ -225,6 +226,7 @@ namespace ClassicalSharp.Network {
|
|||||||
|
|
||||||
public override void OnNewMap(Game game) {
|
public override void OnNewMap(Game game) {
|
||||||
// wipe all existing entity states
|
// wipe all existing entity states
|
||||||
|
if (classic == null) return;
|
||||||
for (int i = 0; i < EntityList.MaxCount; i++) {
|
for (int i = 0; i < EntityList.MaxCount; i++) {
|
||||||
classic.RemoveEntity((byte)i);
|
classic.RemoveEntity((byte)i);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ String_AppendConst(&logMsg, "\r\n");
|
|||||||
String_AppendConst(&logMsg, "Please report the crash to github.com/UnknownShadow200/ClassicalSharp/issues so we can fix it.");
|
String_AppendConst(&logMsg, "Please report the crash to github.com/UnknownShadow200/ClassicalSharp/issues so we can fix it.");
|
||||||
|
|
||||||
LONG WINAPI ErrorHandler_UnhandledFilter(struct _EXCEPTION_POINTERS* pInfo) {
|
LONG WINAPI ErrorHandler_UnhandledFilter(struct _EXCEPTION_POINTERS* pInfo) {
|
||||||
//pInfo->ExceptionRecord->
|
pInfo->ExceptionRecord->
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user