Quellcode durchsuchen

doc: updated ecs part

Michele Caini vor 6 Jahren
Ursprung
Commit
ba8e738f40
1 geänderte Dateien mit 7 neuen und 4 gelöschten Zeilen
  1. 7 4
      docs/md/entity.md

+ 7 - 4
docs/md/entity.md

@@ -205,8 +205,8 @@ vel.dx = 0.;
 vel.dy = 0.;
 vel.dy = 0.;
 ```
 ```
 
 
-This function is overloaded and can receive also a couple of iterators to be
-used to assign the same component to multiple entities at once.
+This function is overloaded and accepts also a couple of iterators to be used to
+assign the same component to multiple entities at once.
 
 
 If an entity already has the given component, the `replace` member function
 If an entity already has the given component, the `replace` member function
 template can be used to replace it:
 template can be used to replace it:
@@ -238,9 +238,9 @@ This is a slightly faster alternative for the following snippet:
 
 
 ```cpp
 ```cpp
 if(registry.has<comp>(entity)) {
 if(registry.has<comp>(entity)) {
-    registry.replace<comp>(entity, arg1, argN);
+    registry.replace<velocity>(entity, 0., 0.);
 } else {
 } else {
-    registry.assign<comp>(entity, arg1, argN);
+    registry.assign<velocity>(entity, 0., 0.);
 }
 }
 ```
 ```
 
 
@@ -368,6 +368,9 @@ There are also some limitations on what a listener can and cannot do:
 * Connecting and disconnecting other functions from within the body of a
 * Connecting and disconnecting other functions from within the body of a
   listener should be avoided. It can lead to undefined behavior in some cases.
   listener should be avoided. It can lead to undefined behavior in some cases.
 
 
+* Removing the component from within the body of a listener that observes the
+  construction or replacement of instances of a given type isn't allowed.
+
 * Assigning and removing components from within the body of a listener that
 * Assigning and removing components from within the body of a listener that
   observes the destruction of instances of a given type should be avoided. It
   observes the destruction of instances of a given type should be avoided. It
   can lead to undefined behavior in some cases. This type of listeners is
   can lead to undefined behavior in some cases. This type of listeners is