RedCore
Loading...
Searching...
No Matches
ProfileCreateBuilder.h
Go to the documentation of this file.
1
#
pragma
once
2
3
#
include
<
concepts
>
4
#
include
<
actor
/
ProfileInfo
.
h
>
5
#
include
<
actor
/
Actor
.
h
>
6
#
include
<
red
/
registry
/
builder
/
ProfileBuilder
.
h
>
7
#
include
<
red
/
profile
/
ProfileEx
.
h
>
8
9
namespace
red
{
10
11
/**
12
* Builder for creating new custom profiles to be registered by string-identifier.
13
* @tparam T Target actor class that this profile represents and will instantiate.
14
* @details Only intended to be constructed via a per-mod @c red::Registrar object which passes the namespace.
15
*/
16
template
<
class
T
>
requires
std
::
derived_from
<
T
,
ActorBase
>
17
class
ProfileCreateBuilder
:
public
ProfileBuilder
<
ProfileCreateBuilder
<
T
>> {
18
public
:
19
/**
20
* Begins creating a new custom profile.
21
* @param identifier The namespaced identifier of this profile.
22
*/
23
explicit
ProfileCreateBuilder
(
const
sead
::
SafeString
*
identifier
)
24
:
ProfileBuilder
<
ProfileCreateBuilder
<
T
>>()
25
,
mIdentifier
(
identifier
)
26
{ }
27
28
/**
29
* Completes the builder by registering the new profile.
30
* @return The newly constructed profile object.
31
*/
32
Profile
*
build
() {
33
static
Profile
sProfile
=
Profile
(&
TActorFactory
<
T
>, -1, *
mIdentifier
,
this
->
mCreateInfo
,
this
->
mFlag
);
34
ProfileEx
::
setDrawPriority
(*
mIdentifier
,
this
->
mDrawPriority
);
35
ProfileEx
::
setExecutePriority
(*
mIdentifier
,
this
->
mExecutePriority
);
36
ProfileEx
::
setResources
(*
mIdentifier
,
this
->
mResourceType
,
this
->
mResources
,
this
->
mResourceCount
);
37
38
return
&
sProfile
;
39
}
40
41
private
:
42
const
sead
::
SafeString
*
mIdentifier
;
///< The namespaced identifier of the new profile to register.
43
};
44
45
}
red
Definition
ActorDonutBlock.h:5
include
red
registry
builder
ProfileCreateBuilder.h
Generated by
1.14.0