CommonLibSSE NG
Loading...
Searching...
No Matches
TESContainer.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BSContainer.h"
6
8
9namespace RE
10{
11 class TESBoundObject;
12
14 {
15 public:
17 ContainerObject(TESBoundObject* a_obj, std::int32_t a_count);
18 ContainerObject(TESBoundObject* a_obj, std::int32_t a_count, TESForm* a_owner);
19
20 ~ContainerObject() = default;
21
23
24 // members
25 std::int32_t count; // 00 - CNTO~
26 std::uint32_t pad04; // 04
27 TESBoundObject* obj; // 08 - ~CNTO
29 };
30 static_assert(sizeof(ContainerObject) == 0x18);
31
33 {
34 public:
35 inline static constexpr auto RTTI = RTTI_TESContainer;
36
37 ~TESContainer() override; // 00
38
39 // override (BaseFormComponent)
40 void InitializeDataComponent() override; // 01 - { return; }
41 void ClearDataComponent() override; // 02
42 void CopyComponent(BaseFormComponent* a_rhs) override; // 03
43
44 inline void ForEachContainerObject(std::function<BSContainer::ForEachResult(ContainerObject&)> a_fn) const
45 {
46 for (std::uint32_t i = 0; i < numContainerObjects; ++i) {
47 auto entry = containerObjects[i];
48 if (entry) {
49 if (a_fn(*entry) == BSContainer::ForEachResult::kStop) {
50 break;
51 }
52 }
53 }
54 }
55
56 std::optional<ContainerObject*> GetContainerObjectAt(std::uint32_t a_idx) const;
57 std::optional<std::uint32_t> GetContainerObjectIndex(TESBoundObject* a_object, std::int32_t a_count) const;
58 bool AddObjectToContainer(TESBoundObject* a_object, std::int32_t a_count, TESForm* a_owner);
59 bool AddObjectsToContainer(std::map<TESBoundObject*, std::int32_t>& a_objects, TESForm* a_owner);
60 std::int32_t CountObjectsInContainer(TESBoundObject* a_object) const;
61 bool RemoveObjectFromContainer(TESBoundObject* a_object, std::int32_t a_count);
62
63 // members
65 std::uint32_t numContainerObjects; // 10
66 std::uint32_t pad14; // 14
67
68 private:
69 void CopyObjectList(const std::vector<ContainerObject*>& a_copiedData);
70 };
71 static_assert(sizeof(TESContainer) == 0x18);
72}
Definition BaseFormComponent.h:8
Definition TESBoundObject.h:24
Definition TESContainer.h:33
static constexpr auto RTTI
Definition TESContainer.h:35
void ClearDataComponent() override
void CopyComponent(BaseFormComponent *a_rhs) override
bool RemoveObjectFromContainer(TESBoundObject *a_object, std::int32_t a_count)
bool AddObjectsToContainer(std::map< TESBoundObject *, std::int32_t > &a_objects, TESForm *a_owner)
std::optional< ContainerObject * > GetContainerObjectAt(std::uint32_t a_idx) const
std::uint32_t numContainerObjects
Definition TESContainer.h:65
std::int32_t CountObjectsInContainer(TESBoundObject *a_object) const
~TESContainer() override
void ForEachContainerObject(std::function< BSContainer::ForEachResult(ContainerObject &)> a_fn) const
Definition TESContainer.h:44
ContainerObject ** containerObjects
Definition TESContainer.h:64
bool AddObjectToContainer(TESBoundObject *a_object, std::int32_t a_count, TESForm *a_owner)
std::uint32_t pad14
Definition TESContainer.h:66
std::optional< std::uint32_t > GetContainerObjectIndex(TESBoundObject *a_object, std::int32_t a_count) const
void InitializeDataComponent() override
Definition TESForm.h:35
ForEachResult
Definition BSContainer.h:6
Definition AbsorbEffect.h:6
constexpr REL::VariantID RTTI_TESContainer(513941, 392582, 0x1edb408)
Definition ContainerItemExtra.h:11
Definition TESContainer.h:14
~ContainerObject()=default
std::int32_t count
Definition TESContainer.h:25
ContainerItemExtra * itemExtra
Definition TESContainer.h:28
ContainerObject(TESBoundObject *a_obj, std::int32_t a_count, TESForm *a_owner)
std::uint32_t pad04
Definition TESContainer.h:26
TESBoundObject * obj
Definition TESContainer.h:27
ContainerObject(TESBoundObject *a_obj, std::int32_t a_count)