RedCore
Loading...
Searching...
No Matches
ProfileEditBuilder.h
Go to the documentation of this file.
1#pragma once
2
3#include <red/public/ProfileInfo.h>
4#include <telkin/Privilege.h>
5#include <red/registry/builder/ProfileBuilder.h>
6#include <red/public/Profile.h>
7
8namespace red {
9
10/**
11 * @brief Builder for partially modifying fields on a vanilla profile by its numeric ID.
12 * @details Intended to be constructed via a per-mod @c red::Registrar object.
13 */
15public:
16 /**
17 * @brief Begins editing a vanilla profile.
18 * @param id The target profile ID to modify.
19 */
20 explicit ProfileEditBuilder(s32 id)
21 : mID(id)
22 { }
23
24 /**
25 * @brief Completes the builder by applying the changes to the vanilla profile.
26 * @return The vanilla profile which was modified.
27 */
29 pub::Profile* profile = static_cast<pub::Profile*>(Profile::get(mID));
30
31 if (mCreateInfoModified) {
32 profile->mActorCreateInfo = mCreateInfo;
33 }
34
35 if (mFlagModified) {
36 profile->mFlag = mFlag;
37 }
38
39 if (mDrawPriorityModified) {
40 //s16* priorities = const_cast<s16*>(ProfileInfo::cDrawPriority);
41 //priorities[mID] = mDrawPriority;
42 tk::privilegedWrite(pub::ProfileInfo::cDrawPriority + mID, &mDrawPriority, sizeof(s16));
43 }
44
45 if (mExecutePriorityModified) {
46 ProfileEx::setExecutePriority(mID, mExecutePriority);
47 }
48
49 return profile;
50 }
51
52private:
53 s32 mID; ///< The target profile ID to modify.
54};
55
56}
Builder for partially modifying fields on a vanilla profile by its numeric ID.
Definition ProfileEditBuilder.h:14
Profile * build()
Completes the builder by applying the changes to the vanilla profile.
Definition ProfileEditBuilder.h:28
ProfileEditBuilder(s32 id)
Begins editing a vanilla profile.
Definition ProfileEditBuilder.h:20
Definition ActorDonutBlock.h:5