diff --git a/components/esm/defs.hpp b/components/esm/defs.hpp index 1655766c79..f3e1ad640e 100644 --- a/components/esm/defs.hpp +++ b/components/esm/defs.hpp @@ -8,6 +8,7 @@ #include +#include "components/esm/fourcc.hpp" #include namespace ESM diff --git a/components/esm/format.hpp b/components/esm/format.hpp index 6bb5e270c1..d33a241903 100644 --- a/components/esm/format.hpp +++ b/components/esm/format.hpp @@ -1,7 +1,7 @@ #ifndef COMPONENT_ESM_FORMAT_H #define COMPONENT_ESM_FORMAT_H -#include "defs.hpp" +#include "components/esm/fourcc.hpp" #include #include diff --git a/components/esm/fourcc.hpp b/components/esm/fourcc.hpp new file mode 100644 index 0000000000..cb0cd7a6a3 --- /dev/null +++ b/components/esm/fourcc.hpp @@ -0,0 +1,13 @@ +#ifndef OPENMW_COMPONENTS_ESM_FOURCC_H +#define OPENMW_COMPONENTS_ESM_FOURCC_H + +namespace ESM +{ + inline constexpr unsigned int fourCC(const char (&name)[5]) + { + return static_cast(name[0]) | (static_cast(name[1]) << 8) + | (static_cast(name[2]) << 16) | (static_cast(name[3]) << 24); + } +} + +#endif // OPENMW_COMPONENTS_ESM_FOURCC_H diff --git a/components/esm4/common.hpp b/components/esm4/common.hpp index 5eae860a10..9d5b9e6bc6 100644 --- a/components/esm4/common.hpp +++ b/components/esm4/common.hpp @@ -30,18 +30,9 @@ #include #include -#include "formid.hpp" +#include "components/esm/fourcc.hpp" -namespace ESM -{ - template - constexpr unsigned int fourCC(const char (&name)[len]) - { - static_assert(len == 5, "Constant must be 4 characters long. (Plus null terminator)"); - return static_cast(name[0]) | (static_cast(name[1]) << 8) - | (static_cast(name[2]) << 16) | (static_cast(name[3]) << 24); - } -} +#include "formid.hpp" namespace ESM4 {