2013-10-29 12:18:22 +00:00
|
|
|
#ifndef CSM_WOLRD_INFOCOLLECTION_H
|
|
|
|
#define CSM_WOLRD_INFOCOLLECTION_H
|
|
|
|
|
2023-03-08 01:17:15 +00:00
|
|
|
#include <map>
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <string>
|
2021-08-01 11:13:47 +00:00
|
|
|
#include <unordered_map>
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2013-10-29 12:18:22 +00:00
|
|
|
#include "collection.hpp"
|
2013-11-01 16:43:45 +00:00
|
|
|
#include "info.hpp"
|
2013-10-29 12:18:22 +00:00
|
|
|
|
2013-10-31 11:16:45 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2015-03-13 21:09:19 +00:00
|
|
|
struct Dialogue;
|
2022-10-19 17:02:00 +00:00
|
|
|
class ESMReader;
|
2023-03-08 01:17:15 +00:00
|
|
|
|
|
|
|
template <class T>
|
|
|
|
class InfoOrder;
|
2013-10-31 11:16:45 +00:00
|
|
|
}
|
|
|
|
|
2021-07-23 06:05:58 +00:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
2023-02-16 23:08:38 +00:00
|
|
|
using InfosRecordPtrByTopic = std::unordered_map<ESM::RefId, std::vector<const Record<Info>*>>;
|
2021-07-23 06:05:58 +00:00
|
|
|
|
2023-03-08 01:17:15 +00:00
|
|
|
struct OrderedInfo
|
|
|
|
{
|
|
|
|
ESM::RefId mId;
|
|
|
|
ESM::RefId mNext;
|
|
|
|
ESM::RefId mPrev;
|
|
|
|
|
|
|
|
explicit OrderedInfo(const Info& info)
|
|
|
|
: mId(info.mOriginalId)
|
|
|
|
, mNext(info.mNext)
|
|
|
|
, mPrev(info.mPrev)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
using InfoOrder = ESM::InfoOrder<OrderedInfo>;
|
|
|
|
using InfoOrderByTopic = std::map<ESM::RefId, ESM::InfoOrder<OrderedInfo>>;
|
|
|
|
|
2023-02-25 12:11:31 +00:00
|
|
|
class InfoCollection : public Collection<Info>
|
2013-10-29 12:18:22 +00:00
|
|
|
{
|
2022-09-22 18:26:05 +00:00
|
|
|
private:
|
2023-03-08 01:17:15 +00:00
|
|
|
void load(const Info& value, bool base);
|
2013-10-29 12:18:22 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
2023-03-08 01:17:15 +00:00
|
|
|
void load(ESM::ESMReader& reader, bool base, const ESM::Dialogue& dialogue, InfoOrderByTopic& infoOrder);
|
|
|
|
|
|
|
|
void sort(const InfoOrderByTopic& infoOrders);
|
2021-07-23 06:05:58 +00:00
|
|
|
|
2023-02-16 23:08:38 +00:00
|
|
|
InfosRecordPtrByTopic getInfosByTopic() const;
|
2023-03-08 01:17:15 +00:00
|
|
|
|
|
|
|
int getAppendIndex(const ESM::RefId& id, UniversalId::Type type = UniversalId::Type_None) const override;
|
|
|
|
|
|
|
|
bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override;
|
2013-10-29 12:18:22 +00:00
|
|
|
};
|
2023-06-01 21:08:47 +00:00
|
|
|
|
|
|
|
ESM::RefId makeCompositeInfoRefId(const ESM::RefId& topicId, const ESM::RefId& infoId);
|
2013-10-29 12:18:22 +00:00
|
|
|
}
|
|
|
|
|
2015-03-11 14:54:45 +00:00
|
|
|
#endif
|