mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
compare definitions by index
This commit is contained in:
parent
5c3eb53946
commit
06d53573d4
2 changed files with 5 additions and 4 deletions
|
|
@ -69,7 +69,7 @@ impl PacketEntity {
|
||||||
fn get_prop_by_definition(&mut self, definition: &SendPropDefinition) -> Option<&mut SendProp> {
|
fn get_prop_by_definition(&mut self, definition: &SendPropDefinition) -> Option<&mut SendProp> {
|
||||||
self.props
|
self.props
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.find(|prop| prop.definition.as_ref().eq(definition))
|
.find(|prop| prop.definition.index == definition.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_update(&mut self, props: Vec<SendProp>) {
|
pub fn apply_update(&mut self, props: Vec<SendProp>) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ pub struct SendPropDefinition {
|
||||||
|
|
||||||
impl PartialEq for SendPropDefinition {
|
impl PartialEq for SendPropDefinition {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.owner_table == other.owner_table && self.name == other.name
|
self.index == other.index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -529,11 +529,12 @@ impl From<Vec<SendPropValue>> for SendPropValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
|
||||||
pub struct SendPropDefinitionIndex(usize, usize);
|
pub struct SendPropDefinitionIndex(u32);
|
||||||
|
|
||||||
impl SendPropDefinitionIndex {
|
impl SendPropDefinitionIndex {
|
||||||
pub fn new(table: usize, prop: usize) -> Self {
|
pub fn new(table: usize, prop: usize) -> Self {
|
||||||
SendPropDefinitionIndex(table, prop)
|
// there can be at most 1024 (10 bits) props per table
|
||||||
|
SendPropDefinitionIndex((table * 1024 + prop) as u32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue