Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Feb 14, 2022
1 parent 6bd8c51 commit 8f0cd0a
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 81 deletions.
80 changes: 0 additions & 80 deletions Code/client/Games/ExtraData.cpp

This file was deleted.

77 changes: 77 additions & 0 deletions Code/client/Games/ExtraDataList.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,82 @@
#include "ExtraDataList.h"

bool ExtraDataList::Contains(ExtraData aType) const
{
if(bitfield)
{
const auto value = static_cast<uint32_t>(aType);
const auto index = value >> 3;

const auto element = bitfield->data[index];

return (element >> (value % 8)) & 1;
}

return false;
}

BSExtraData* ExtraDataList::GetByType(ExtraData aType) const
{
BSScopedLock<BSRecursiveLock> _(lock);

if (!Contains(aType))
return nullptr;

auto pEntry = data;
#if TP_SKYRIM
while (pEntry != nullptr && pEntry->GetType() != aType)
#else
while (pEntry != nullptr && pEntry->type != aType)
#endif
{
pEntry = pEntry->next;
}

return pEntry;
}

bool ExtraDataList::Add(ExtraData aType, BSExtraData* apNewData)
{
if (Contains(aType))
return false;

// TODO: this sometimes causes a deadlock
//BSScopedLock<BSRecursiveLock> _(lock);

BSExtraData* pNext = data;
data = apNewData;
apNewData->next = pNext;
SetType(aType, false);

return true;
}

uint32_t ExtraDataList::GetCount() const
{
uint32_t count = 0;

BSExtraData* pNext = data;
while (pNext)
{
count++;
pNext = pNext->next;
}

return count;
}

void ExtraDataList::SetType(ExtraData aType, bool aClear)
{
uint32_t index = static_cast<uint8_t>(aType) >> 3;
uint8_t bitmask = 1 << (static_cast<uint8_t>(aType) % 8);
uint8_t& flag = bitfield->data[index];
if (aClear)
flag &= ~bitmask;
else
flag |= bitmask;
}


void ExtraDataList::SetSoulData(SOUL_LEVEL aSoulLevel) noexcept
{
TP_THIS_FUNCTION(TSetSoulData, void, ExtraDataList, SOUL_LEVEL aSoulLevel);
Expand Down
1 change: 1 addition & 0 deletions Code/client/Games/References.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <Forms/TESNPC.h>
#include <Forms/TESPackage.h>
#include <SaveLoad.h>
#include <Games/ExtraDataList.h>

#include <BSAnimationGraphManager.h>
#include <Misc/GameVM.h>
Expand Down
1 change: 1 addition & 0 deletions Code/client/Games/Skyrim/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <Games/Skyrim/ExtraData/ExtraCount.h>
#include <Games/Misc/ActorKnowledge.h>

#include <Games/ExtraDataList.h>
#include <ExtraData/ExtraCharge.h>
#include <ExtraData/ExtraCount.h>
#include <ExtraData/ExtraEnchantment.h>
Expand Down
2 changes: 1 addition & 1 deletion Code/client/Games/Skyrim/ExtraData/ExtraContainerChanges.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <Games/ExtraData.h>
#include <Games/ExtraDataList.h>

struct BGSLoadFormBuffer;
struct BGSSaveFormBuffer;
Expand Down
1 change: 1 addition & 0 deletions Code/client/Games/Skyrim/TESObjectREFR.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <Games/Magic/MagicSystem.h>
#include <Magic/MagicCaster.h>
#include <Structs/Container.h>
#include <Games/ExtraDataList.h>

struct AnimationVariables;
struct TESWorldSpace;
Expand Down

0 comments on commit 8f0cd0a

Please sign in to comment.