From 9e40550a4a6c36029abf028fe0fe84b3b0c863d0 Mon Sep 17 00:00:00 2001 From: "florent.teppe" Date: Sat, 3 Sep 2022 22:21:16 +0200 Subject: [PATCH] improved readability of esm3Recname and esm4Recname --- components/esm/defs.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/esm/defs.hpp b/components/esm/defs.hpp index f864c07f65..0aac4d6501 100644 --- a/components/esm/defs.hpp +++ b/components/esm/defs.hpp @@ -91,12 +91,17 @@ bool inline operator!= (const Position& left, const Position& right) noexcept constexpr unsigned int esm4RecnameFlag = 0x00800000; constexpr unsigned int esm3Recname(const char(&name)[5]) { - return (fourCC(name) & esm4RecnameFlag) == 0 ? fourCC(name) : throw std::logic_error("there must be no collision between esm3 records and esm4 records"); //The throw errors ensures at compile time that no collision between ESM4 and ESM3 is possible + if ((fourCC(name) & esm4RecnameFlag) == 0) + return fourCC(name); + else + throw std::logic_error("there must be no collision between esm3 records and esm4 records"); //The throw errors ensures at compile time that no collision between ESM4 and ESM3 is possible } constexpr unsigned int esm4Recname(const ESM4::RecordTypes recType) { - - return (recType & esm4RecnameFlag) == 0 ? (recType | esm4RecnameFlag) : throw std::logic_error("there must be no collision between esm3 records and esm4 records");//The throw errors ensures at compile time that no collision between ESM4 and ESM3 is possible + if ((recType & esm4RecnameFlag) == 0) + return (recType | esm4RecnameFlag); + else + throw std::logic_error("there must be no collision between esm3 records and esm4 records");//The throw errors ensures at compile time that no collision between ESM4 and ESM3 is possible } enum RecNameInts : unsigned int