mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-24 19:59:48 +02:00
Break: fix winner_team_number for a draw
This commit is contained in:
1 parent
c9a2adff4c
commit
59353a9aca
3 files changed
+19
-5
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
use prost::bytes::Buf;
|
use prost::bytes::Buf;
|
||||||
use prost::Message;
|
use prost::{Enumeration, Message};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::result::Result;
|
use crate::result::Result;
|
||||||
@@ -22,7 +22,7 @@ pub struct BattleResults {
|
|||||||
#[prost(int64, tag = "2")]
|
#[prost(int64, tag = "2")]
|
||||||
pub timestamp: i64,
|
pub timestamp: i64,
|
||||||
|
|
||||||
#[prost(enumeration = "TeamNumber", tag = "3")]
|
#[prost(enumeration = "WinnerTeamNumber", tag = "3")]
|
||||||
pub winner_team_number: i32,
|
pub winner_team_number: i32,
|
||||||
|
|
||||||
/// Replay's author results.
|
/// Replay's author results.
|
||||||
@@ -78,15 +78,21 @@ pub struct PlayerInfo {
|
|||||||
pub avatar: Avatar,
|
pub avatar: Avatar,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Enumeration, Serialize)]
|
||||||
Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, prost::Enumeration, Serialize,
|
|
||||||
)]
|
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
pub enum TeamNumber {
|
pub enum TeamNumber {
|
||||||
One = 1,
|
One = 1,
|
||||||
Two = 2,
|
Two = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Enumeration, Serialize)]
|
||||||
|
#[repr(i32)]
|
||||||
|
pub enum WinnerTeamNumber {
|
||||||
|
Neither = 0,
|
||||||
|
One = 1,
|
||||||
|
Two = 2,
|
||||||
|
}
|
||||||
|
|
||||||
/// Player's battle results.
|
/// Player's battle results.
|
||||||
#[derive(Message, Serialize)]
|
#[derive(Message, Serialize)]
|
||||||
pub struct PlayerResults {
|
pub struct PlayerResults {
|
||||||
|
|||||||
@@ -117,3 +117,11 @@ fn victory_points_ok() -> Result<()> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn draw_ok() -> Result<()> {
|
||||||
|
let battle_results = Replay::open(File::open("tests/replays/20230503_0027__helaas_pindakaas_A140_ASTRON_REX_105_2319058483532631656.wotbreplay")?)?
|
||||||
|
.read_battle_results()?;
|
||||||
|
assert_eq!(battle_results.winner_team_number, 0);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Generated
BIN
Binary file not shown.
Reference in new issue
Block a user