2019-06-14 12:59:38 +00:00
|
|
|
|
|
|
|
#include "UserData.hpp"
|
2019-06-14 20:21:33 +00:00
|
|
|
#include "UserDataStorage.hpp"
|
|
|
|
|
2019-06-17 16:35:12 +00:00
|
|
|
namespace Porygon::UserData {
|
|
|
|
extern "C" {
|
|
|
|
void RegisterUserDataType(uint32_t id) {
|
2019-06-14 20:21:33 +00:00
|
|
|
auto ud = new UserData({});
|
|
|
|
UserDataStorage::RegisterType(id, ud);
|
|
|
|
}
|
|
|
|
|
2019-06-17 16:35:12 +00:00
|
|
|
void RegisterUserDataField(uint32_t typeId, uint32_t fieldId, UserDataField *field) {
|
2019-06-14 20:21:33 +00:00
|
|
|
auto ud = UserDataStorage::GetUserDataType(typeId);
|
2019-08-25 09:53:37 +00:00
|
|
|
ud->Get()->CreateField(fieldId, field);
|
2019-06-14 20:21:33 +00:00
|
|
|
}
|
|
|
|
|
2019-06-17 16:35:12 +00:00
|
|
|
int32_t GetUserDataFieldCount(uint32_t typeId) {
|
2019-06-14 20:21:33 +00:00
|
|
|
auto ud = UserDataStorage::GetUserDataType(typeId);
|
2019-08-25 09:53:37 +00:00
|
|
|
return ud->Get()->GetFieldCount();
|
2019-06-17 16:35:12 +00:00
|
|
|
}
|
2019-06-14 20:21:33 +00:00
|
|
|
}
|
|
|
|
}
|