From 29c2c1a40c8c5b9ffb060608630314bd3660f4b7 Mon Sep 17 00:00:00 2001 From: maddymakesgames Date: Sun, 23 Jun 2024 02:13:24 -0400 Subject: [PATCH] Fix Level attributes being parsed inconsistently --- lib/src/maps/elements/level.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/src/maps/elements/level.rs b/lib/src/maps/elements/level.rs index 013916d..654df98 100644 --- a/lib/src/maps/elements/level.rs +++ b/lib/src/maps/elements/level.rs @@ -129,19 +129,12 @@ impl MapElement for Level { encoder.attribute("musicProgress", progress.clone()); } encoder.optional_attribute("ambience", &self.ambience); - if let Some(progress) = &self.ambience_progress { - encoder.attribute("ambienceProgress", progress.clone()); - } + encoder.optional_attribute("ambienceProgress", &self.ambience_progress); encoder.attribute("underwater", self.underwater); encoder.optional_attribute("space", &self.space); encoder.optional_attribute("disableDownTransition", &self.disable_down_transition); - if let Some(whisper) = self.whisper { - encoder.attribute("whisper", whisper); - } - - if let Some(alt_music_fade) = self.delay_alt_music_fade { - encoder.attribute("delayAltMusicFade", alt_music_fade); - } + encoder.optional_attribute("whisper", &self.whisper); + encoder.optional_attribute("delayAltMusicFade", &self.delay_alt_music_fade); encoder.optional_attribute("enforceDashNumber", &self.enforce_dash_number); encoder.attribute("x", self.x); encoder.attribute("y", self.y);