From ca0617b035923e001acf0f6583e720e36dca1174 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 6 Feb 2025 18:47:06 -0800 Subject: [PATCH] add some documentation to `RegisterShipInitFunc` (#4995) --- soh/soh/ShipInit.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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();