Break: extract TeamNumber

This commit is contained in:
Pavel Perestoronin committed 2022-12-03 18:13:57 +01:00
1 parent 6fb70da06f
commit 68e00c5eca
1 file changed
+15 -2
+15 -2
View File
@@ -15,30 +15,43 @@ impl BattleResults {
#[derive(Message)] #[derive(Message)]
pub struct BattleResults { pub struct BattleResults {
/// Battle timestamp.
#[prost(int64, tag = "2")] #[prost(int64, tag = "2")]
pub timestamp: i64, pub timestamp: i64,
/// Players in the battle.
#[prost(message, repeated, tag = "201")] #[prost(message, repeated, tag = "201")]
pub players: Vec<Player>, pub players: Vec<Player>,
} }
#[derive(Message)] #[derive(Message)]
pub struct Player { pub struct Player {
/// Player's account ID.
#[prost(uint32, tag = "1")] #[prost(uint32, tag = "1")]
pub account_id: u32, pub account_id: u32,
/// Player's extended information.
#[prost(message, required, tag = "2")] #[prost(message, required, tag = "2")]
pub info: PlayerInfo, pub info: PlayerInfo,
} }
#[derive(Message)] #[derive(Message)]
pub struct PlayerInfo { pub struct PlayerInfo {
/// Player's nickname.
#[prost(string, tag = "1")] #[prost(string, tag = "1")]
pub nickname: String, pub nickname: String,
#[prost(uint32, optional, tag = "2")] #[prost(uint32, optional, tag = "2")]
pub platoon_id: Option<u32>, pub platoon_id: Option<u32>,
#[prost(uint32, tag = "3")] /// Player's team assignment.
pub team_number: u32, #[prost(enumeration = "TeamNumber", tag = "3")]
pub team_number: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, prost::Enumeration)]
#[repr(i32)]
pub enum TeamNumber {
One = 1,
Two = 2,
} }