From 17cac19c6266dca7b38b3ef5db6b4db7ec550c55 Mon Sep 17 00:00:00 2001 From: genxium Date: Mon, 5 Dec 2022 17:27:44 +0800 Subject: [PATCH] Fix on backend "createInputsBufferSnapshot". --- battle_srv/models/room.go | 11 ++++++----- frontend/assets/scenes/login.fire | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/battle_srv/models/room.go b/battle_srv/models/room.go index 27a90f9..c02c002 100644 --- a/battle_srv/models/room.go +++ b/battle_srv/models/room.go @@ -1605,20 +1605,21 @@ func (pR *Room) downsyncToSinglePlayer(playerId int32, player *Player, refRender func (pR *Room) createInputsBufferSnapshot(stFrameId, edFrameId int32) []*InputFrameDownsync { // [WARNING] This function MUST BE called while "pR.InputsBufferLock" is locked! snapshot := make([]*InputFrameDownsync, 0, edFrameId-stFrameId) - prevFrameFound := true + prevFrameFound := false j := stFrameId for j < edFrameId { tmp := pR.InputsBuffer.GetByFrameId(j) if nil == tmp { if false == prevFrameFound { - // The "id"s are always consecutive - break + j++ + continue // allowed to keep not finding the requested inputFrames at the beginning } else { - prevFrameFound = false - continue + break // The "id"s are always consecutive } } + prevFrameFound = true foo := tmp.(*InputFrameDownsync) + bar := &InputFrameDownsync{ InputFrameId: foo.InputFrameId, InputList: make([]uint64, len(foo.InputList)), diff --git a/frontend/assets/scenes/login.fire b/frontend/assets/scenes/login.fire index 31380ab..0deae0c 100644 --- a/frontend/assets/scenes/login.fire +++ b/frontend/assets/scenes/login.fire @@ -440,7 +440,7 @@ "array": [ 0, 0, - 210.7506841057913, + 210.2448888647705, 0, 0, 0,