mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Move fourCC to a separate file
This commit is contained in:
parent
45e673564f
commit
baa39c06bb
4 changed files with 17 additions and 12 deletions
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <osg/Vec3f>
|
#include <osg/Vec3f>
|
||||||
|
|
||||||
|
#include "components/esm/fourcc.hpp"
|
||||||
#include <components/esm4/common.hpp>
|
#include <components/esm4/common.hpp>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef COMPONENT_ESM_FORMAT_H
|
#ifndef COMPONENT_ESM_FORMAT_H
|
||||||
#define COMPONENT_ESM_FORMAT_H
|
#define COMPONENT_ESM_FORMAT_H
|
||||||
|
|
||||||
#include "defs.hpp"
|
#include "components/esm/fourcc.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
13
components/esm/fourcc.hpp
Normal file
13
components/esm/fourcc.hpp
Normal file
|
@ -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 <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "formid.hpp"
|
#include "components/esm/fourcc.hpp"
|
||||||
|
|
||||||
namespace ESM
|
#include "formid.hpp"
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ESM4
|
namespace ESM4
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue