Move fourCC to a separate file

7098-improve-post-process-behavior-with-transparent-objects
elsid 2 years ago
parent 45e673564f
commit baa39c06bb
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -8,6 +8,7 @@
#include <osg/Vec3f>
#include "components/esm/fourcc.hpp"
#include <components/esm4/common.hpp>
namespace ESM

@ -1,7 +1,7 @@
#ifndef COMPONENT_ESM_FORMAT_H
#define COMPONENT_ESM_FORMAT_H
#include "defs.hpp"
#include "components/esm/fourcc.hpp"
#include <cstdint>
#include <iosfwd>

@ -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<unsigned char>(name[0]) | (static_cast<unsigned char>(name[1]) << 8)
| (static_cast<unsigned char>(name[2]) << 16) | (static_cast<unsigned char>(name[3]) << 24);
}
}
#endif // OPENMW_COMPONENTS_ESM_FOURCC_H

@ -30,18 +30,9 @@
#include <cstdint>
#include <string>
#include "formid.hpp"
#include "components/esm/fourcc.hpp"
namespace ESM
{
template <std::size_t len>
constexpr unsigned int fourCC(const char (&name)[len])
{
static_assert(len == 5, "Constant must be 4 characters long. (Plus null terminator)");
return static_cast<unsigned char>(name[0]) | (static_cast<unsigned char>(name[1]) << 8)
| (static_cast<unsigned char>(name[2]) << 16) | (static_cast<unsigned char>(name[3]) << 24);
}
}
#include "formid.hpp"
namespace ESM4
{

Loading…
Cancel
Save