1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-22 17:44:22 +00:00

Do not try to convert "set" deck code portions to CardSet variants

This commit is contained in:
Steffo 2022-10-18 22:11:41 +02:00
parent 6c63d36ca3
commit 1f6e05d419
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -198,9 +198,7 @@ impl Deck {
let card_count = reader.read_u32_varint().map_err(DeckDecodingError::Read)?;
let set = reader.read_u32_varint().map_err(DeckDecodingError::Read)?;
let set = CardSet::from(set)
.to_code()
.ok_or(DeckDecodingError::UnknownSet)?;
let set = format!("{:02}", &set);
let region = reader.read_u32_varint().map_err(DeckDecodingError::Read)?;
let region = CardRegion::from(region)
@ -229,8 +227,7 @@ impl Deck {
.write_u32_varint(len)
.map_err(DeckEncodingError::Write)?;
let set: u32 = CardSet::from_code(set)
.try_into()
let set: u32 = set.parse()
.map_err(|_| DeckEncodingError::UnknownSet)?;
writer
.write_u32_varint(set)