1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 10:44:07 +02:00

fix ElementCount (too many) for LightColor

This commit is contained in:
Quaternions 2025-02-13 16:13:40 -08:00
commit a6bb2aba5c

View file

@ -231,28 +231,30 @@ impl FromStr for LightColor {
fn from_str(str: &str) -> Result<Self, Self::Err> {
let mut values = str.split(' ');
Ok(LightColor {
r: values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?,
g: values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?,
b: values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?,
intensity: values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?,
})
let r = values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?;
let g = values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?;
let b = values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?;
let intensity = values
.next()
.ok_or(EntityParseError::ElementCount)?
.parse()
.map_err(EntityParseError::Int)?;
if values.next().is_some() {
return Err(EntityParseError::ElementCount);
}
Ok(LightColor { r, g, b, intensity })
}
}