diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-08-04 00:13:58 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-08-04 00:13:58 +0200 |
commit | cb4ade7710f6fa171130edeeabfa2db2fb1c526b (patch) | |
tree | 0c254c52dcc537c0ffef2de27566d2098e3c511b /src/event.rs | |
parent | 1eb04b8496dcdf626f8d4651f66955a0ea7c1102 (diff) | |
download | evtclib-cb4ade7710f6fa171130edeeabfa2db2fb1c526b.tar.gz evtclib-cb4ade7710f6fa171130edeeabfa2db2fb1c526b.tar.bz2 evtclib-cb4ade7710f6fa171130edeeabfa2db2fb1c526b.zip |
fix endianness for CBTS_ERROR
Otherwise the text will be garbled (reversed and probably cut short).
Diffstat (limited to 'src/event.rs')
-rw-r--r-- | src/event.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/event.rs b/src/event.rs index d0d3181..f9ee8e5 100644 --- a/src/event.rs +++ b/src/event.rs @@ -6,7 +6,7 @@ use super::raw; use std::convert::TryFrom; use std::io; -use byteorder::{BigEndian, WriteBytesExt}; +use byteorder::{BigEndian, WriteBytesExt, LE}; use getset::{CopyGetters, Getters}; use num_traits::FromPrimitive; use thiserror::Error; @@ -515,11 +515,11 @@ fn get_api_guild_string(bytes: &[u8; 16]) -> Option<String> { fn get_error_bytes(raw_event: &raw::CbtEvent) -> [u8; 32] { let mut result = [0; 32]; let mut cursor = io::Cursor::new(&mut result as &mut [u8]); - cursor.write_u64::<BigEndian>(raw_event.time).unwrap(); - cursor.write_u64::<BigEndian>(raw_event.src_agent).unwrap(); - cursor.write_u64::<BigEndian>(raw_event.dst_agent).unwrap(); - cursor.write_i32::<BigEndian>(raw_event.value).unwrap(); - cursor.write_i32::<BigEndian>(raw_event.buff_dmg).unwrap(); + cursor.write_u64::<LE>(raw_event.time).unwrap(); + cursor.write_u64::<LE>(raw_event.src_agent).unwrap(); + cursor.write_u64::<LE>(raw_event.dst_agent).unwrap(); + cursor.write_i32::<LE>(raw_event.value).unwrap(); + cursor.write_i32::<LE>(raw_event.buff_dmg).unwrap(); result } |