diff --git a/src/npc/utils.rs b/src/npc/utils.rs index 94ff694..ab3bd3f 100644 --- a/src/npc/utils.rs +++ b/src/npc/utils.rs @@ -238,7 +238,7 @@ impl NPCList { /// Deletes NPCs with specified type. pub fn kill_npcs_by_type(&self, npc_type: u16, smoke: bool, state: &mut SharedGameState) { for npc in self.iter_alive().filter(|n| n.npc_type == npc_type) { - state.game_flags.set(npc.flag_num as usize, true); + state.set_flag(npc.flag_num as usize, true); npc.cond.set_alive(false); if smoke { @@ -311,7 +311,7 @@ impl NPCList { } } - state.game_flags.set(npc.flag_num as usize, true); + state.set_flag(npc.flag_num as usize, true); if npc.npc_flags.show_damage() { if vanish { @@ -331,7 +331,7 @@ impl NPCList { for npc in self.iter_alive() { if npc.event_num == event_num { npc.cond.set_alive(false); - state.game_flags.set(npc.flag_num as usize, true); + state.set_flag(npc.flag_num as usize, true); } } } @@ -341,7 +341,7 @@ impl NPCList { for npc in self.iter_alive() { if npc.npc_type == npc_type { npc.cond.set_alive(false); - state.game_flags.set(npc.flag_num as usize, true); + state.set_flag(npc.flag_num as usize, true); match npc.size { 1 => self.create_death_smoke(npc.x, npc.y, npc.display_bounds.right as usize, 3, state, &npc.rng), diff --git a/src/profile.rs b/src/profile.rs index ffcac18..d3c72aa 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -1,6 +1,6 @@ use std::io; -use byteorder::{BE, LE, ReadBytesExt, WriteBytesExt}; +use byteorder::{ReadBytesExt, WriteBytesExt, BE, LE}; use num_traits::{clamp, FromPrimitive}; use crate::common::{Direction, FadeState}; @@ -99,28 +99,28 @@ impl GameProfile { for (idx, &flags) in self.flags.iter().enumerate() { if flags & 0b00000001 != 0 { - state.game_flags.set(idx * 8, true); + state.set_flag(idx * 8, true); } if flags & 0b00000010 != 0 { - state.game_flags.set(idx * 8 + 1, true); + state.set_flag(idx * 8 + 1, true); } if flags & 0b00000100 != 0 { - state.game_flags.set(idx * 8 + 2, true); + state.set_flag(idx * 8 + 2, true); } if flags & 0b00001000 != 0 { - state.game_flags.set(idx * 8 + 3, true); + state.set_flag(idx * 8 + 3, true); } if flags & 0b00010000 != 0 { - state.game_flags.set(idx * 8 + 4, true); + state.set_flag(idx * 8 + 4, true); } if flags & 0b00100000 != 0 { - state.game_flags.set(idx * 8 + 5, true); + state.set_flag(idx * 8 + 5, true); } if flags & 0b01000000 != 0 { - state.game_flags.set(idx * 8 + 6, true); + state.set_flag(idx * 8 + 6, true); } if flags & 0b10000000 != 0 { - state.game_flags.set(idx * 8 + 7, true); + state.set_flag(idx * 8 + 7, true); } } diff --git a/src/scripting/tsc/text_script.rs b/src/scripting/tsc/text_script.rs index 4bb0de7..968ab3c 100644 --- a/src/scripting/tsc/text_script.rs +++ b/src/scripting/tsc/text_script.rs @@ -814,7 +814,7 @@ impl TextScriptVM { if flag_to >= flag_from { for flag in flag_from..=flag_to { if state.get_flag(flag) { - state.game_flags.set(flag, false); + state.set_flag(flag, false); break; } } diff --git a/src/shared_game_state.rs b/src/shared_game_state.rs index 086aecf..b56d2e3 100644 --- a/src/shared_game_state.rs +++ b/src/shared_game_state.rs @@ -462,7 +462,7 @@ impl SharedGameState { if id < self.game_flags.len() { self.game_flags.set(id, value); } else { - log::warn!("Attempted to set an out-of-bounds flag {}:", id); + log::warn!("Attempted to set an out-of-bounds flag: {} to {}.", id, value); } }