1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 07:53:52 +00:00
openmw/apps/opencs/model/world/infocollection.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.5 KiB
C++
Raw Normal View History

#ifndef CSM_WOLRD_INFOCOLLECTION_H
#define CSM_WOLRD_INFOCOLLECTION_H
#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>
#include "collection.hpp"
#include "info.hpp"
namespace ESM
{
2015-03-13 21:09:19 +00:00
struct Dialogue;
2022-10-19 17:02:00 +00:00
class ESMReader;
template <class T>
class InfoOrder;
}
namespace CSMWorld
{
2023-02-16 23:08:38 +00:00
using InfosRecordPtrByTopic = std::unordered_map<ESM::RefId, std::vector<const Record<Info>*>>;
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>>;
class InfoCollection : public Collection<Info>
{
2022-09-22 18:26:05 +00:00
private:
void load(const Info& value, bool base);
2022-09-22 18:26:05 +00:00
public:
void load(ESM::ESMReader& reader, bool base, const ESM::Dialogue& dialogue, InfoOrderByTopic& infoOrder);
void sort(const InfoOrderByTopic& infoOrders);
2023-02-16 23:08:38 +00:00
InfosRecordPtrByTopic getInfosByTopic() const;
int getAppendIndex(const ESM::RefId& id, UniversalId::Type type = UniversalId::Type_None) const override;
bool reorderRows(int baseIndex, const std::vector<int>& newOrder) override;
};
ESM::RefId makeCompositeInfoRefId(const ESM::RefId& topicId, const ESM::RefId& infoId);
}
2015-03-11 14:54:45 +00:00
#endif