mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
use more nullhasher
This commit is contained in:
parent
33b8d76e88
commit
089f615a47
2 changed files with 15 additions and 7 deletions
|
|
@ -23,14 +23,14 @@ pub struct DemoMeta {
|
|||
}
|
||||
|
||||
pub struct ParserState {
|
||||
pub static_baselines: HashMap<ClassId, StaticBaseline>,
|
||||
pub parsed_static_baselines: RefCell<HashMap<ClassId, Vec<SendProp>>>,
|
||||
pub static_baselines: HashMap<ClassId, StaticBaseline, NullHasherBuilder>,
|
||||
pub parsed_static_baselines: RefCell<HashMap<ClassId, Vec<SendProp>, NullHasherBuilder>>,
|
||||
pub event_definitions: Vec<GameEventDefinition>,
|
||||
pub string_tables: Vec<StringTableMeta>,
|
||||
pub entity_classes: HashMap<EntityId, ClassId, NullHasherBuilder>,
|
||||
pub send_tables: Vec<SendTable>, // indexed by ClassId
|
||||
pub server_classes: Vec<ServerClass>,
|
||||
pub instance_baselines: [HashMap<EntityId, Vec<SendProp>>; 2],
|
||||
pub instance_baselines: [HashMap<EntityId, Vec<SendProp>, NullHasherBuilder>; 2],
|
||||
pub demo_meta: DemoMeta,
|
||||
analyser_handles: fn(message_type: MessageType) -> bool,
|
||||
handle_entities: bool,
|
||||
|
|
@ -54,14 +54,17 @@ impl StaticBaseline {
|
|||
impl ParserState {
|
||||
pub fn new(analyser_handles: fn(message_type: MessageType) -> bool) -> Self {
|
||||
ParserState {
|
||||
static_baselines: HashMap::new(),
|
||||
parsed_static_baselines: RefCell::new(HashMap::new()),
|
||||
static_baselines: HashMap::with_hasher(NullHasherBuilder),
|
||||
parsed_static_baselines: RefCell::new(HashMap::with_hasher(NullHasherBuilder)),
|
||||
event_definitions: Vec::new(),
|
||||
string_tables: Vec::new(),
|
||||
entity_classes: HashMap::with_hasher(NullHasherBuilder),
|
||||
send_tables: Vec::new(),
|
||||
server_classes: Vec::new(),
|
||||
instance_baselines: [HashMap::new(), HashMap::new()],
|
||||
instance_baselines: [
|
||||
HashMap::with_hasher(NullHasherBuilder),
|
||||
HashMap::with_hasher(NullHasherBuilder),
|
||||
],
|
||||
demo_meta: DemoMeta::default(),
|
||||
analyser_handles,
|
||||
handle_entities: analyser_handles(MessageType::PacketEntities),
|
||||
|
|
|
|||
|
|
@ -15,7 +15,12 @@ impl Hasher for NullHasher {
|
|||
|
||||
#[inline]
|
||||
fn write(&mut self, _msg: &[u8]) {
|
||||
panic!("can only hash u64 as u32");
|
||||
panic!("can only hash u64,u32,u16");
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn write_u16(&mut self, data: u16) {
|
||||
self.data = data as u64
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue