-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathPackageData.h
More file actions
53 lines (42 loc) · 1.47 KB
/
PackageData.h
File metadata and controls
53 lines (42 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <sstream>
#include <boost/array.hpp>
#include <boost/container/flat_map.hpp>
#include "common/ICriticalSection.h"
#include "skse64/GameForms.h"
#include "skse64/GameObjects.h"
namespace PackageData {
class Packages{
public:
ICriticalSection s_dataLock;
//typedef boost::array<UInt32, 2> Flags;
typedef std::pair<UInt32, UInt32> Flags;
typedef boost::container::flat_map<UInt32, Flags> ActorPackages;
typedef boost::container::flat_map<UInt32, ActorPackages> PackageMap;
PackageMap Data;
inline ActorPackages* GetActor(TESForm* FormRef){
PackageMap::iterator itr = Data.find(FormRef->formID);
return itr == Data.end() ? NULL : &itr->second;
}
inline ActorPackages* GetActor(UInt32 &formID){
PackageMap::iterator itr = Data.find(formID);
return itr == Data.end() ? NULL : &itr->second;
}
// Interface
void AddPackage(Actor* ActorRef, TESPackage* PackageRef, UInt32 priority, UInt32 flags);
bool RemovePackage(Actor* ActorRef, TESPackage* PackageRef);
UInt32 CountPackages(Actor* ActorRef);
UInt32 ClearActor(Actor* ActorRef);
UInt32 ClearPackage(TESPackage* PackageRef);
// System Handling
void PackageEnded();
bool IsValidPackage(TESPackage *PackageID, Actor *ActorID);
TESPackage *DecidePackage(Actor *ActorID, TESPackage *PackageID);
// Serialization
void LoadStream(std::stringstream &ss);
void SaveStream(std::stringstream &ss);
void Revert();
};
Packages* GetPackages();
void InitPlugin();
}// PackageData