-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3018ad7
commit 98c0825
Showing
9 changed files
with
107 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include "RecordCollection.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#include "Records/CLMT.h" | ||
#include "Records/CONT.h" | ||
#include "Records/NPC.h" | ||
#include "Records/REFR.h" | ||
|
||
class RecordCollection | ||
{ | ||
friend class TESFile; | ||
|
||
public: | ||
FormEnum GetFormType(uint32_t aFormId) const noexcept | ||
{ | ||
auto record = m_allRecords.find(aFormId); | ||
if (record == std::end(m_allRecords)) | ||
{ | ||
spdlog::error("Record not found for form id {:X}", aFormId); | ||
return FormEnum::EMPTY_ID; | ||
} | ||
|
||
return record->second.GetType(); | ||
} | ||
|
||
REFR& GetObjectRefById(uint32_t aFormId) noexcept | ||
{ | ||
return m_objectReferences[aFormId]; | ||
} | ||
CLMT& GetClimateById(uint32_t aFormId) noexcept | ||
{ | ||
return m_climates[aFormId]; | ||
} | ||
NPC& GetNpcById(uint32_t aFormId) noexcept | ||
{ | ||
return m_npcs[aFormId]; | ||
} | ||
CONT& GetContainerById(uint32_t aFormId) noexcept | ||
{ | ||
return m_containers[aFormId]; | ||
} | ||
|
||
private: | ||
Map<uint32_t, Record> m_allRecords{}; | ||
Map<uint32_t, REFR> m_objectReferences{}; | ||
Map<uint32_t, CLMT> m_climates{}; | ||
Map<uint32_t, NPC> m_npcs{}; | ||
Map<uint32_t, CONT> m_containers{}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters