NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
f_tree_mg.hpp
1#pragma once
2#include <types.h>
3#include <game/cLib/c_tree.hpp>
5#include <game/framework/f_tree_nd.hpp>
6
7class fBase_c;
8
9/// @brief A base tree, made of fTrNdBa_c nodes.
10/// @ingroup framework
11/// @decompnote{The class name stands for "Tree Manager (for) Bases".}
12class fTrMgBa_c : public cTreeMg_c {
13public:
14
15 /**
16 * @brief Searches for a base with a given profile name, optionally under a given parent.
17 *
18 * @param profName The profile name.
19 * @param parent The parent node to start searching from, or @p nullptr to use the tree's root node.
20 * @return The node of the first base matching this criteria, or @p nullptr if none was found.
21 */
22 const fTrNdBa_c *searchNodeByProfName(ProfileName profName, const fTrNdBa_c *parent) const;
23
24 /**
25 * @brief Searches for a base with a given group type, optionally under a given parent.
26 *
27 * @param groupType The group type. Value is a fBase_c::GROUP_TYPE_e.
28 * @param parent The parent node to start searching from, or @p nullptr to use the tree's root node.
29 * @return The node of the first base matching this criteria, or @p nullptr if none was found.
30 */
31 const fTrNdBa_c *searchNodeByGroupType(u8 groupType, const fTrNdBa_c *parent) const;
32};
33
34/// @brief A base tree made of fTrNdBa_c nodes, with a reference to a process function.
35/// @ingroup framework
36class fTrMgBaFu_c : public fTrMgBa_c {
37public:
38
39 /// @brief Constructs a new tree.
40 /// @param procFunc The process function, or @p nullptr .
41 fTrMgBaFu_c(int (fBase_c::*procFunc)()) : mpProcFunc(procFunc) {}
42
43 /// @brief Calls @ref mpProcFunc "the process function" on each base in the tree.
44 /// @return Always returns true.
45 bool treeListProc();
46
47private:
48 int (fBase_c::*mpProcFunc)(); ///< The process function for the tree.
49};
cTreeMg_c()
Constructs a new tree container.
Definition c_tree.hpp:40
The base class for all scenes, actors and various other processes.
Definition f_base.hpp:17
bool treeListProc()
Calls the process function on each base in the tree.
Definition f_tree.cpp:6
fTrMgBaFu_c(int(fBase_c::*procFunc)())
Constructs a new tree.
Definition f_tree_mg.hpp:41
int(fBase_c::* mpProcFunc)()
The process function for the tree.
Definition f_tree_mg.hpp:48
A base tree, made of fTrNdBa_c nodes.
Definition f_tree_mg.hpp:12
const fTrNdBa_c * searchNodeByProfName(ProfileName profName, const fTrNdBa_c *parent) const
Searches for a base with a given profile name, optionally under a given parent.
Definition f_tree.cpp:23
const fTrNdBa_c * searchNodeByGroupType(u8 groupType, const fTrNdBa_c *parent) const
Searches for a base with a given group type, optionally under a given parent.
Definition f_tree.cpp:40
A base tree node.
Definition f_tree_nd.hpp:12
u16 ProfileName
The name of a profile. Value is a fProf::PROFILE_NAME_e.
Definition f_profile.hpp:32