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

make game event definitions sortable

This commit is contained in:
Robin Appelman 2019-08-25 14:35:34 +02:00
commit faf205c9da
2 changed files with 28 additions and 1 deletions

View file

@ -4,6 +4,7 @@ use crate::{MalformedDemoError, ParseError, Result};
pub use super::gameevent_gen::{GameEvent, GameEventType};
use crate::demo::message::gameevent::GameEventTypeId;
use std::cmp::Ordering;
use std::fmt;
#[derive(Debug)]
@ -14,6 +15,26 @@ pub struct GameEventDefinition {
pub entries: Vec<GameEventEntry>,
}
impl PartialEq<GameEventDefinition> for GameEventDefinition {
fn eq(&self, other: &Self) -> bool {
self.id.eq(&other.id)
}
}
impl Eq for GameEventDefinition {}
impl PartialOrd for GameEventDefinition {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.id.partial_cmp(&other.id)
}
}
impl Ord for GameEventDefinition {
fn cmp(&self, other: &Self) -> Ordering {
self.id.cmp(&other.id)
}
}
#[derive(Debug)]
pub struct GameEventEntry {
pub name: String,