mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-24 14:51:46 -05:00
add some documentation to RegisterShipInitFunc
(#4995)
This commit is contained in:
parent
f2a3ac1740
commit
ca0617b035
@ -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<void()> initFunc, const std::set<std::string>& updatePaths = {}) {
|
||||
auto& shipInitFuncs = ShipInit::GetAll();
|
||||
|
Loading…
x
Reference in New Issue
Block a user