NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
f_line_mg.hpp
1#pragma once
2#include <types.h>
4#include <game/cLib/c_line.hpp>
6#include <game/framework/f_line_nd.hpp>
7
8class fBase_c;
9
10/// @brief A base list, made of fLiNdBa_c nodes.
11/// @ingroup framework
12/// @decompnote{The class name stands for "Line Manager (for) Bases".}
13class fLiMgBa_c : public cLineMg_c {
14public:
15
16 /**
17 * @brief Counts the number of bases using the given profile name.
18 *
19 * @param profName The profile name.
20 * @return How many bases were found.
21 */
22 int countNodeByProfName(ProfileName profName) const;
23
24 /**
25 * @brief Searches for a base with the given ID.
26 *
27 * @param id The ID to search for.
28 * @return The node belonging to such base, or @p nullptr.
29 */
30 const fLiNdBaLink_c *searchNodeByID(fBaseID_e id) const;
31
32 fLiNdBaLink_c *getFirst() const {
33 return (fLiNdBaLink_c *) cLineMg_c::getFirst();
34 }
35
36 fLiNdBaLink_c *getLast() const {
37 return (fLiNdBaLink_c *) cLineMg_c::getLast();
38 }
39};
40
41/// @brief A base list made of fLiMgBa_c nodes, with a reference to a process function.
42/// @ingroup framework
43class fLiMgBaFu_c : public fLiMgBa_c {
44public:
45
46 /// @brief Constructs a new list.
47 /// @param procFunc The process function, or @p nullptr.
48 fLiMgBaFu_c(int (fBase_c::*procFunc)()) : mpProcFunc(procFunc) {}
49
50 /// @brief Calls the @ref mpProcFunc "process function" on each base in the list.
51 /// @return Always returns true.
52 bool lineListProc();
53
54private:
55 int (fBase_c::*mpProcFunc)(); ///< The process function for the list.
56};
57
58/// @brief A base list like fLiMgBa_c, but with fLiNdBaPr_c nodes for priority-based ordering.
59/// @ingroup framework
60class fLiMgBaFuPr_c : public fLiMgBaFu_c {
61public:
62
63 /// @brief Constructs a new list.
64 /// @param procFunc The process function, or @p nullptr.
65 fLiMgBaFuPr_c(int (fBase_c::*procFunc)()) : fLiMgBaFu_c(procFunc) {}
66
67 /**
68 * @brief Adds a node to the list, according to its priority.
69 *
70 * @param node The node to insert.
71 * @return If the operation was successful.
72 */
74
75 fLiNdBaPr_c *getFirst() const {
76 return (fLiNdBaPr_c *) fLiMgBa_c::getFirst();
77 }
78
79 fLiNdBaPr_c *getLast() const {
80 return (fLiNdBaPr_c *) fLiMgBa_c::getLast();
81 }
82};
cLineMg_c()
Constructs a new list container.
Definition c_line.hpp:26
The base class for all scenes, actors and various other processes.
Definition f_base.hpp:17
fLiMgBaFuPr_c(int(fBase_c::*procFunc)())
Constructs a new list.
Definition f_line_mg.hpp:65
bool insertLineNodePriority(fLiNdBaPr_c *node)
Adds a node to the list, according to its priority.
Definition f_line.cpp:5
int(fBase_c::* mpProcFunc)()
The process function for the list.
Definition f_line_mg.hpp:55
fLiMgBaFu_c(int(fBase_c::*procFunc)())
Constructs a new list.
Definition f_line_mg.hpp:48
bool lineListProc()
Calls the process function on each base in the list.
Definition f_line.cpp:30
A base list, made of fLiNdBa_c nodes.
Definition f_line_mg.hpp:13
int countNodeByProfName(ProfileName profName) const
Counts the number of bases using the given profile name.
Definition f_line.cpp:61
const fLiNdBaLink_c * searchNodeByID(fBaseID_e id) const
Searches for a base with the given ID.
Definition f_line.cpp:47
A base line node, with priority fields for reordering.
Definition f_line_nd.hpp:33
fBaseID_e
A unique identifier for each base.
Definition f_base_id.hpp:6
u16 ProfileName
The name of a profile. Value is a fProf::PROFILE_NAME_e.
Definition f_profile.hpp:32