teach the snapshot verifier about decks
verify_snapshot still carried the stub from when both decks were always absent, so the first battle that actually carried one was refused before it reached the client. it reads them now: eight presence bits, then a data reference, five vints and two booleans per filled slot. while in there, the six battle booleans were all being discarded, which hid the fact that the two score-change vints are only present when the first of them is set. the verifier tracks it now, same as the encoder.
This commit is contained in:
parent
27f99ee898
commit
58d137ccd2
1 changed files with 20 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
use titan::{ByteStreamReader, Result};
|
use titan::{ByteStreamReader, Result};
|
||||||
use crate::battle::logic_game_mode::{SECTION_BATTLE, SECTION_TUTORIAL};
|
use crate::battle::logic_game_mode::{SECTION_BATTLE, SECTION_TUTORIAL};
|
||||||
use crate::data::{table, LogicDataRef, LogicDataTables};
|
use crate::data::{table, LogicDataRef, LogicDataTables};
|
||||||
|
use crate::model::DECK_SLOT_COUNT;
|
||||||
pub const BUFF_ARRAY_TABLE: i32 = table::DAMAGE_TYPES;
|
pub const BUFF_ARRAY_TABLE: i32 = table::DAMAGE_TYPES;
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct SnapshotReport {
|
pub struct SnapshotReport {
|
||||||
|
|
@ -37,6 +38,19 @@ impl<'a, 'b> Verifier<'a, 'b> {
|
||||||
}
|
}
|
||||||
Ok(Some((class_id, self.reader.read_vint()?)))
|
Ok(Some((class_id, self.reader.read_vint()?)))
|
||||||
}
|
}
|
||||||
|
fn spell_deck(&mut self) -> Result<()> {
|
||||||
|
let mut present = [false; DECK_SLOT_COUNT];
|
||||||
|
for slot in present.iter_mut() {
|
||||||
|
*slot = self.reader.read_boolean()?;
|
||||||
|
}
|
||||||
|
for _ in present.iter().filter(|slot| **slot) {
|
||||||
|
self.data_ref()?;
|
||||||
|
self.vints(5)?;
|
||||||
|
self.reader.read_boolean()?;
|
||||||
|
self.reader.read_boolean()?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
fn vints(&mut self, count: usize) -> Result<()> {
|
fn vints(&mut self, count: usize) -> Result<()> {
|
||||||
for _ in 0..count {
|
for _ in 0..count {
|
||||||
self.reader.read_vint()?;
|
self.reader.read_vint()?;
|
||||||
|
|
@ -173,7 +187,8 @@ impl<'a, 'b> Verifier<'a, 'b> {
|
||||||
self.vints(2)?;
|
self.vints(2)?;
|
||||||
self.vints(8)?;
|
self.vints(8)?;
|
||||||
self.vints(3)?;
|
self.vints(3)?;
|
||||||
for _ in 0..6 {
|
let battle_ended_called = self.reader.read_boolean()?;
|
||||||
|
for _ in 0..5 {
|
||||||
self.reader.read_boolean()?;
|
self.reader.read_boolean()?;
|
||||||
}
|
}
|
||||||
self.mark("objects");
|
self.mark("objects");
|
||||||
|
|
@ -224,7 +239,7 @@ impl<'a, 'b> Verifier<'a, 'b> {
|
||||||
self.mark("decks");
|
self.mark("decks");
|
||||||
for _ in 0..2 {
|
for _ in 0..2 {
|
||||||
if self.reader.read_boolean()? {
|
if self.reader.read_boolean()? {
|
||||||
return Err(titan::Error::Unsupported("decks are not expected yet"));
|
self.spell_deck()?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.mark("leaders");
|
self.mark("leaders");
|
||||||
|
|
@ -237,6 +252,9 @@ impl<'a, 'b> Verifier<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.mark("battle_tail");
|
self.mark("battle_tail");
|
||||||
|
if battle_ended_called {
|
||||||
|
self.vints(2)?;
|
||||||
|
}
|
||||||
self.vints(6)?;
|
self.vints(6)?;
|
||||||
self.mark("avatars");
|
self.mark("avatars");
|
||||||
for _ in 0..2 {
|
for _ in 0..2 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue