Skip to content

Commit

Permalink
Fix typo in frags.
Browse files Browse the repository at this point in the history
  • Loading branch information
vikpe committed May 21, 2024
1 parent d62a036 commit 71ceabf
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/frags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use std::io::Cursor;

use anyhow::{anyhow as e, Result};

use fragfile::FragEvent;

use crate::mvd::message::io::ReadMessages;
use crate::mvd::message::print::ReadPrint;
use crate::mvd::message::update_frags::ReadUpdateFrags;
Expand Down Expand Up @@ -43,31 +41,31 @@ pub fn frags(data: &[u8]) -> HashMap<String, i32> {
for (print, frame_info) in print_frames {
let content_u = quake_text::bytestr::to_unicode(&print.content);

match FragEvent::try_from(content_u.trim_end()) {
match fragfile::Event::try_from(content_u.trim_end()) {
Ok(event) => {
//println!("{:?}", event);
match event {
FragEvent::Frag { killer, .. } => {
fragfile::Event::Frag { killer, .. } => {
let killer = frags.entry(killer).or_insert(0);
*killer += 1;
}
FragEvent::Death { player } => {
fragfile::Event::Death { player } => {
let player = frags.entry(player).or_insert(0);
*player -= 1;
}
FragEvent::Suicide { player } => {
fragfile::Event::Suicide { player } => {
let player = frags.entry(player).or_insert(0);
*player -= 2;
}
FragEvent::SuicideByWeapon { player } => {
fragfile::Event::SuicideByWeapon { player } => {
let player = frags.entry(player).or_insert(0);
*player -= 1;
}
FragEvent::Teamkill { killer } => {
fragfile::Event::Teamkill { killer } => {
let killer = frags.entry(killer).or_insert(0);
*killer -= 1;
}
FragEvent::TeamkillByUnknown { victim } => {
fragfile::Event::TeamkillByUnknown { victim } => {
if let Ok(name) = find_team_killer(data, frame_info.index, &victim) {
// println!("KILLER: {:?} -> {}", content_u, name);
let killer = frags.entry(name).or_insert(0);
Expand Down

0 comments on commit 71ceabf

Please sign in to comment.