Fix 'server sent invalid packet' wrongly showing current instead of previous opcode for 'prev' (Thanks Venk)

This commit is contained in:
UnknownShadow200 2020-08-26 17:42:48 +10:00
parent 22a3c0d0b4
commit 0a29905f99
5 changed files with 4 additions and 10 deletions

View File

@ -195,7 +195,6 @@ static Vec3 ThirdPersonCamera_GetPosition(float t) {
} }
static cc_bool ThirdPersonCamera_Zoom(float amount) { static cc_bool ThirdPersonCamera_Zoom(float amount) {
struct LocalPlayer* p = &LocalPlayer_Instance;
float* dist = cam_isForwardThird ? &dist_forward : &dist_third; float* dist = cam_isForwardThird ? &dist_forward : &dist_third;
float newDist = *dist - amount; float newDist = *dist - amount;

View File

@ -107,9 +107,9 @@ static int Program_Run(int argc, char** argv) {
int argsCount = Platform_GetCommandLineArgs(argc, argv, args); int argsCount = Platform_GetCommandLineArgs(argc, argv, args);
#ifdef _MSC_VER #ifdef _MSC_VER
/* NOTE: Make sure to comment this out before pushing a commit */ /* NOTE: Make sure to comment this out before pushing a commit */
String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565"); //String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565");
//String rawArgs = String_FromConst("UnknownShadow200"); //String rawArgs = String_FromConst("UnknownShadow200");
argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4); //argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4);
#endif #endif
if (argsCount == 0) { if (argsCount == 0) {

View File

@ -1010,7 +1010,6 @@ static void ChatScreen_ContextLost(void* screen) {
static void ChatScreen_ContextRecreated(void* screen) { static void ChatScreen_ContextRecreated(void* screen) {
struct ChatScreen* s = (struct ChatScreen*)screen; struct ChatScreen* s = (struct ChatScreen*)screen;
int size = Drawer2D_BitmappedText ? 16 : 11;
struct FontDesc font; struct FontDesc font;
ChatScreen_ChatUpdateFont(s); ChatScreen_ChatUpdateFont(s);
ChatScreen_Redraw(s); ChatScreen_Redraw(s);
@ -1937,7 +1936,6 @@ static void TouchScreen_ContextRecreated(void* screen) {
} }
static void TouchScreen_Render(void* screen, double delta) { static void TouchScreen_Render(void* screen, double delta) {
struct TouchScreen* s = (struct TouchScreen*)screen;
if (Gui_GetInputGrab()) return; if (Gui_GetInputGrab()) return;
Gfx_SetTexturing(true); Gfx_SetTexturing(true);

View File

@ -418,12 +418,11 @@ static void MPConnection_Tick(struct ScheduledTask* task) {
} }
if (net_readCurrent + Protocol.Sizes[opcode] > readEnd) break; if (net_readCurrent + Protocol.Sizes[opcode] > readEnd) break;
lastOpcode = opcode;
lastPacket = Game.Time;
handler = Protocol.Handlers[opcode]; handler = Protocol.Handlers[opcode];
if (!handler) { DisconnectInvalidOpcode(opcode); return; } if (!handler) { DisconnectInvalidOpcode(opcode); return; }
lastOpcode = opcode;
lastPacket = Game.Time;
handler(net_readCurrent + 1); /* skip opcode */ handler(net_readCurrent + 1); /* skip opcode */
net_readCurrent += Protocol.Sizes[opcode]; net_readCurrent += Protocol.Sizes[opcode];
} }

View File

@ -3422,7 +3422,6 @@ int Window_GetWindowState(void) {
cc_result Window_EnterFullscreen(void) { cc_result Window_EnterFullscreen(void) {
EmscriptenFullscreenStrategy strategy; EmscriptenFullscreenStrategy strategy;
cc_result res;
strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH; strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF; strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF;
strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT; strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
@ -3475,7 +3474,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) { }
EMSCRIPTEN_KEEPALIVE void Window_OnTextChanged(const char* src) { EMSCRIPTEN_KEEPALIVE void Window_OnTextChanged(const char* src) {
char buffer[800]; char buffer[800];
int len;
String str; String str;
String_InitArray(str, buffer); String_InitArray(str, buffer);