1
0
Fork 0
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:
Robin Appelman 2019-03-02 14:58:08 +01:00
commit 3298ac3fd0
3 changed files with 1031 additions and 1031 deletions

File diff suppressed because it is too large Load diff

View file

@ -129,9 +129,9 @@ impl FromGameEventValue for () {
pub struct RawGameEvent { pub struct RawGameEvent {
pub event_type: GameEventType, pub event_type: GameEventType,
pub values: HashMap<String, GameEventValue>, pub values: Vec<GameEventValue>,
} }
pub trait FromRawGameEvent: Sized { pub trait FromRawGameEvent: Sized {
fn from_raw_event(values: HashMap<String, GameEventValue>) -> Result<Self>; fn from_raw_event(values: Vec<GameEventValue>) -> Result<Self>;
} }

View file

@ -29,9 +29,9 @@ impl Parse for GameEventMessage {
let event_type = data.read()?; let event_type = data.read()?;
let raw_event = match state.event_definitions.get(&event_type) { let raw_event = match state.event_definitions.get(&event_type) {
Some(definition) => { 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 { for entry in &definition.entries {
values.insert(entry.name.clone(), read_event_value(stream, &entry)?); values.push(read_event_value(stream, &entry)?);
} }
RawGameEvent { RawGameEvent {