1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-05 02:54:10 +02:00

minor cleanup

This commit is contained in:
Robin Appelman 2019-08-11 13:25:47 +02:00
commit 8442c5e385
4 changed files with 34 additions and 28 deletions

View file

@ -44,9 +44,13 @@ impl SendPropDefinition {
///
/// Note that this is not the owner table
pub fn get_data_table<'a>(&self, tables: &'a [ParseSendTable]) -> Option<&'a ParseSendTable> {
self.table_name
.as_ref()
.and_then(|name| tables.iter().find(|table| table.name == *name))
if self.prop_type == SendPropType::DataTable {
self.table_name
.as_ref()
.and_then(|name| tables.iter().find(|table| table.name == *name))
} else {
None
}
}
pub fn read(stream: &mut Stream, owner_table: SendTableName) -> ReadResult<Self> {
@ -99,6 +103,14 @@ impl SendPropDefinition {
pub fn is_exclude(&self) -> bool {
self.flags.contains(SendPropFlag::Exclude)
}
pub fn get_exclude_table(&self) -> Option<&SendTableName> {
if self.is_exclude() {
self.table_name.as_ref()
} else {
None
}
}
}
#[derive(BitRead, Copy, Clone, PartialEq, Debug)]