mirror of
https://git.mentality.rip/numas13/xash3d-master.git
synced 2025-01-22 12:54:24 +00:00
protocol: parse numbers with colorcode prefix
This commit is contained in:
parent
32971a15ed
commit
0b8ee3dac1
@ -65,7 +65,14 @@ macro_rules! impl_get_value {
|
|||||||
($($t:ty),+ $(,)?) => {
|
($($t:ty),+ $(,)?) => {
|
||||||
$(impl<'a> GetKeyValue<'a> for $t {
|
$(impl<'a> GetKeyValue<'a> for $t {
|
||||||
fn get_key_value(cur: &mut Cursor<'a>) -> Result<Self, Error> {
|
fn get_key_value(cur: &mut Cursor<'a>) -> Result<Self, Error> {
|
||||||
cur.get_key_value::<&str>()?.parse().map_err(|_| Error::InvalidPacket)
|
let s = cur.get_key_value::<&str>()?;
|
||||||
|
// HACK: special case for one asshole
|
||||||
|
let s = if s.len() > 2 && s.as_bytes()[0] == b'^' && s.as_bytes()[1].is_ascii_digit() {
|
||||||
|
&s[2..]
|
||||||
|
} else {
|
||||||
|
s
|
||||||
|
};
|
||||||
|
s.parse().map_err(|_| Error::InvalidPacket)
|
||||||
}
|
}
|
||||||
})+
|
})+
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user