Reformat code with clang format

This commit is contained in:
Clang Format
2023-11-19 15:28:38 +01:00
committed by Jan
parent 22e17272fd
commit 6b4f5d94a8
1099 changed files with 16763 additions and 18076 deletions

View File

@ -1,48 +1,18 @@
#include "GameAssetPoolIW3.h"
#include "Pool/AssetPoolDynamic.h"
#include "Pool/AssetPoolStatic.h"
#include <cassert>
#include <type_traits>
#include "Pool/AssetPoolStatic.h"
#include "Pool/AssetPoolDynamic.h"
using namespace IW3;
const char* GameAssetPoolIW3::ASSET_TYPE_NAMES[]
{
"xmodelpieces",
"physpreset",
"xanim",
"xmodel",
"material",
"techniqueset",
"image",
"sound",
"soundcurve",
"loadedsound",
"clipmap",
"clipmap",
"comworld",
"gameworldsp",
"gameworldmp",
"mapents",
"gfxworld",
"lightdef",
"uimap",
"font",
"menulist",
"menu",
"localize",
"weapon",
"snddriverglobals",
"fx",
"impactfx",
"aitype",
"mptype",
"character",
"xmodelalias",
"rawfile",
"stringtable"
const char* GameAssetPoolIW3::ASSET_TYPE_NAMES[]{
"xmodelpieces", "physpreset", "xanim", "xmodel", "material", "techniqueset", "image", "sound", "soundcurve", "loadedsound",
"clipmap", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", "gfxworld", "lightdef", "uimap", "font",
"menulist", "menu", "localize", "weapon", "snddriverglobals", "fx", "impactfx", "aitype", "mptype", "character",
"xmodelalias", "rawfile", "stringtable",
};
/*
@ -81,21 +51,21 @@ const char* GameAssetPoolIW3::ASSET_TYPE_NAMES[]
GameAssetPoolIW3::GameAssetPoolIW3(Zone* zone, const int priority)
: ZoneAssetPools(zone),
m_priority(priority)
m_priority(priority)
{
static_assert(std::extent<decltype(ASSET_TYPE_NAMES)>::value == ASSET_TYPE_COUNT);
}
void GameAssetPoolIW3::InitPoolStatic(const asset_type_t type, const size_t capacity)
{
#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \
case assetType: \
{ \
if((poolName) == nullptr && capacity > 0) \
{ \
(poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \
} \
break; \
#define CASE_INIT_POOL_STATIC(assetType, poolName, poolType) \
case assetType: \
{ \
if ((poolName) == nullptr && capacity > 0) \
{ \
(poolName) = std::make_unique<AssetPoolStatic<poolType>>(capacity, m_priority, (assetType)); \
} \
break; \
}
switch (type)
@ -137,14 +107,14 @@ void GameAssetPoolIW3::InitPoolStatic(const asset_type_t type, const size_t capa
void GameAssetPoolIW3::InitPoolDynamic(const asset_type_t type)
{
#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \
case assetType: \
{ \
if((poolName) == nullptr) \
{ \
(poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \
} \
break; \
#define CASE_INIT_POOL_DYNAMIC(assetType, poolName, poolType) \
case assetType: \
{ \
if ((poolName) == nullptr) \
{ \
(poolName) = std::make_unique<AssetPoolDynamic<poolType>>(m_priority, (assetType)); \
} \
break; \
}
switch (type)
@ -184,18 +154,19 @@ void GameAssetPoolIW3::InitPoolDynamic(const asset_type_t type)
#undef CASE_INIT_POOL_STATIC
}
XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone)
XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool(
asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone)
{
XAsset xAsset{};
xAsset.type = static_cast<XAssetType>(type);
xAsset.header.data = asset;
#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \
case assetType: \
{ \
assert((poolName) != nullptr); \
return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \
#define CASE_ADD_TO_POOL(assetType, poolName, headerName) \
case assetType: \
{ \
assert((poolName) != nullptr); \
return (poolName)->AddAsset(std::move(name), xAsset.header.headerName, zone, std::move(dependencies), std::move(usedScriptStrings)); \
}
switch (xAsset.type)
@ -239,12 +210,12 @@ XAssetInfoGeneric* GameAssetPoolIW3::AddAssetToPool(asset_type_t type, std::stri
XAssetInfoGeneric* GameAssetPoolIW3::GetAsset(const asset_type_t type, std::string name) const
{
#define CASE_GET_ASSET(assetType, poolName) \
case assetType: \
{ \
if((poolName) != nullptr) \
return (poolName)->GetAsset(std::move(name)); \
break; \
#define CASE_GET_ASSET(assetType, poolName) \
case assetType: \
{ \
if ((poolName) != nullptr) \
return (poolName)->GetAsset(std::move(name)); \
break; \
}
switch (type)

View File

@ -1,10 +1,10 @@
#pragma once
#include <memory>
#include "Pool/ZoneAssetPools.h"
#include "Pool/AssetPool.h"
#include "Game/IW3/IW3.h"
#include "Pool/AssetPool.h"
#include "Pool/ZoneAssetPools.h"
#include <memory>
class GameAssetPoolIW3 final : public ZoneAssetPools
{
@ -14,7 +14,12 @@ class GameAssetPoolIW3 final : public ZoneAssetPools
static const char* ASSET_TYPE_NAMES[];
protected:
XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*> dependencies, std::vector<scr_string_t> usedScriptStrings, Zone* zone) override;
XAssetInfoGeneric* AddAssetToPool(asset_type_t type,
std::string name,
void* asset,
std::vector<XAssetInfoGeneric*> dependencies,
std::vector<scr_string_t> usedScriptStrings,
Zone* zone) override;
public:
std::unique_ptr<AssetPool<IW3::PhysPreset>> m_phys_preset;

View File

@ -1,10 +1,10 @@
#pragma once
#include "Game/IW3/IW3.h"
#include "Zone/ZoneTypes.h"
#include <cstdint>
#include <string>
#include "Zone/ZoneTypes.h"
#include "Game/IW3/IW3.h"
namespace IW3
{
class ZoneConstants final
@ -14,7 +14,7 @@ namespace IW3
public:
static constexpr const char* MAGIC_UNSIGNED = "IWffu100";
static constexpr int ZONE_VERSION = 5;
static_assert(std::char_traits<char>::length(MAGIC_UNSIGNED) == sizeof(ZoneHeader::m_magic));
static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000;
@ -23,4 +23,4 @@ namespace IW3
static constexpr int OFFSET_BLOCK_BIT_COUNT = 4;
static constexpr block_t INSERT_BLOCK = XFILE_BLOCK_VIRTUAL;
};
}
} // namespace IW3