mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
use vec for raw event values
This commit is contained in:
parent
3adf7eebe7
commit
3298ac3fd0
3 changed files with 1031 additions and 1031 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -129,9 +129,9 @@ impl FromGameEventValue for () {
|
|||
|
||||
pub struct RawGameEvent {
|
||||
pub event_type: GameEventType,
|
||||
pub values: HashMap<String, GameEventValue>,
|
||||
pub values: Vec<GameEventValue>,
|
||||
}
|
||||
|
||||
pub trait FromRawGameEvent: Sized {
|
||||
fn from_raw_event(values: HashMap<String, GameEventValue>) -> Result<Self>;
|
||||
fn from_raw_event(values: Vec<GameEventValue>) -> Result<Self>;
|
||||
}
|
||||
|
|
@ -29,9 +29,9 @@ impl Parse for GameEventMessage {
|
|||
let event_type = data.read()?;
|
||||
let raw_event = match state.event_definitions.get(&event_type) {
|
||||
Some(definition) => {
|
||||
let mut values: HashMap<String, GameEventValue> = HashMap::with_capacity(definition.entries.len());
|
||||
let mut values: Vec<GameEventValue> = Vec::with_capacity(definition.entries.len());
|
||||
for entry in &definition.entries {
|
||||
values.insert(entry.name.clone(), read_event_value(stream, &entry)?);
|
||||
values.push(read_event_value(stream, &entry)?);
|
||||
}
|
||||
|
||||
RawGameEvent {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue