| 62 | SpawnArgs& _entity; |
| 63 | |
| 64 | void attachObserver(const std::string& key, KeyObserver& observer) |
| 65 | { |
| 66 | if (EntityKeyValuePtr keyValue = _entity.getEntityKeyValue(key); keyValue) { |
| 67 | // Attach immediately if the entity already has such a (non-inherited) |
| 68 | // spawnarg. This will automatically send the current value. |
| 69 | keyValue->attach(observer); |
| 70 | } |
| 71 | else { |
| 72 | // No current value, call the observer with the inherited value or |
| 73 | // the empty string. |
| 74 | observer.onKeyValueChanged(_entity.getKeyValue(key)); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void detachObserver(const std::string& key, KeyObserver& observer, bool sendEmptyValue) |
| 79 | { |
no test coverage detected