diff --git a/soh/soh/ShipInit.hpp b/soh/soh/ShipInit.hpp index b7612eb06..b5351cdc0 100644 --- a/soh/soh/ShipInit.hpp +++ b/soh/soh/ShipInit.hpp @@ -26,6 +26,37 @@ struct ShipInit { } }; +/** + * @brief Register a function to execute on boot and (optionally) in other situations + * + * @param initFunc The function to execute + * @param updatePaths Strings to specify additional situations in which to execute the function + * + * ### Examples: + * + * #### Execute function `bar` on boot + * + * ```cpp + * static RegisterShipInitFunc foo(bar); + * ``` + * + * #### Execute function `bar` on boot and when the CVar `baz` might have changed + * + * ```cpp + * static RegisterShipInitFunc foo(bar, { "baz" }); + * ``` + * + * #### Execute function `bar` on boot and when `IS_RANDO` might have changed + * + * ```cpp + * static RegisterShipInitFunc foo(bar, { "IS_RANDO" }); + * ``` + * + * ### Additional Information: + * + * To get a better sense of when your function will be executed + * you can look for `ShipInit::Init` calls throughout the codebase + */ struct RegisterShipInitFunc { RegisterShipInitFunc(std::function initFunc, const std::set& updatePaths = {}) { auto& shipInitFuncs = ShipInit::GetAll();