From edb9b46b558dcd73a61a41253741aba44e6dd9fd Mon Sep 17 00:00:00 2001 From: Kp Date: Mon, 24 Aug 2020 01:31:28 +0000 Subject: [PATCH] Move piggy_is_needed to dcx --- similar/main/piggy.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/similar/main/piggy.cpp b/similar/main/piggy.cpp index b9a4bee84..a8e62e557 100644 --- a/similar/main/piggy.cpp +++ b/similar/main/piggy.cpp @@ -223,10 +223,10 @@ static void write_int(int i,PHYSFS_File *file); #endif #endif } -static int piggy_is_needed(int soundnum); } namespace dcx { +namespace { static void get_bitmap_name_from_header(std::array &output_name, const DiskBitmapHeader &bmh) { @@ -239,6 +239,20 @@ static void get_bitmap_name_from_header(std::array &output_name, const } } +static int piggy_is_needed(const int soundnum) +{ + if (!CGameArg.SysLowMem) + return 1; + constexpr std::size_t upper_bound = Sounds.size(); + for (const auto i : AltSounds) + { + if (i < upper_bound && Sounds[i] == soundnum) + return 1; + } + return 0; +} + +} } /* @@ -1161,19 +1175,6 @@ int properties_init(void) } #endif -static int piggy_is_needed(int soundnum) -{ - if (!CGameArg.SysLowMem) - return 1; - - for (const auto i : AltSounds) - { - if (i < Sounds.size() && Sounds[i] == soundnum) - return 1; - } - return 0; -} - #if defined(DXX_BUILD_DESCENT_I) void piggy_read_sounds(int pc_shareware) {