rom: Remove end of line chars from names ('@')

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-11-25 16:07:33 +01:00
parent efc5128890
commit 9a3f604b39
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -79,6 +79,15 @@ fn get_pokemon_list(data: &[u8]) -> Result<Vec<String>, Error> {
// TODO: Ensure we have the right length? a multiple of 10
for (offset, ord) in data.iter().enumerate() {
if offset != 0 && (offset % 10) == 0 {
res.push(buffer.clone());
buffer.clear()
}
if *ord == 0x50 { // End char, '@'.
continue
}
let pkstr = match PKString::try_from(&[*ord][..]) {
Ok(pkstr) => pkstr,
Err(e) => {
@ -87,11 +96,6 @@ fn get_pokemon_list(data: &[u8]) -> Result<Vec<String>, Error> {
},
};
if offset != 0 && (offset % 10) == 0 {
res.push(buffer.clone());
buffer.clear()
}
buffer.push_str(String::from(&pkstr).as_str());
}