Przeglądaj źródła

doc: added a warning to registry::replace

Michele Caini 6 lat temu
rodzic
commit
58885854f1
2 zmienionych plików z 8 dodań i 0 usunięć
  1. 1 0
      TODO
  2. 7 0
      src/entt/entity/registry.hpp

+ 1 - 0
TODO

@@ -18,6 +18,7 @@
 
 Next:
 * replace observer class with observer functions
+* patch rather than replace, emplace rather then assign (when we have args... ofc)
 
 * WIP:
  - deprecate snapshot, loader, ...

+ 7 - 0
src/entt/entity/registry.hpp

@@ -704,6 +704,13 @@ public:
      * Temporary objects are returned for empty types though. Capture them by
      * copy or by const reference if needed.
      *
+     * @warning
+     * Attempting to use an invalid entity or to replace a component of an
+     * entity that doesn't own it results in undefined behavior.<br/>
+     * An assertion will abort the execution at runtime in debug mode in case of
+     * invalid entity or if the entity doesn't own an instance of the given
+     * component.
+     *
      * @tparam Component Type of component to replace.
      * @tparam Func Types of the function objects to invoke.
      * @param entity A valid entity identifier.