Fix ActorList.Filter(...) method
- change return type to SharedPtr<ActorList> - this fixes tr1::bad_weak_ptr when using / iterating filtered list
This commit is contained in:
parent
ad9c773188
commit
9c0317a749
|
@ -1,5 +1,6 @@
|
||||||
## Latest Changes
|
## Latest Changes
|
||||||
|
|
||||||
|
* Fix ActorList returned by ActorList.Filter(...)
|
||||||
* Add --rolename to manual_control.py
|
* Add --rolename to manual_control.py
|
||||||
* Migrate Content to AWS
|
* Migrate Content to AWS
|
||||||
* Adding a parser to represent the map as a connected graph of waypoints.
|
* Adding a parser to represent the map as a connected graph of waypoints.
|
||||||
|
|
|
@ -29,11 +29,11 @@ namespace client {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActorList ActorList::Filter(const std::string &wildcard_pattern) const {
|
SharedPtr<ActorList> ActorList::Filter(const std::string &wildcard_pattern) const {
|
||||||
ActorList filtered{_episode, {}};
|
SharedPtr<ActorList> filtered (new ActorList(_episode, {}));
|
||||||
for (auto &&actor : _actors) {
|
for (auto &&actor : _actors) {
|
||||||
if (StringUtil::Match(actor.GetTypeId(), wildcard_pattern)) {
|
if (StringUtil::Match(actor.GetTypeId(), wildcard_pattern)) {
|
||||||
filtered._actors.push_back(actor);
|
filtered->_actors.push_back(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filtered;
|
return filtered;
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace client {
|
||||||
SharedPtr<Actor> Find(ActorId actor_id) const;
|
SharedPtr<Actor> Find(ActorId actor_id) const;
|
||||||
|
|
||||||
/// Filters a list of Actor with type id matching @a wildcard_pattern.
|
/// Filters a list of Actor with type id matching @a wildcard_pattern.
|
||||||
ActorList Filter(const std::string &wildcard_pattern) const;
|
SharedPtr<ActorList> Filter(const std::string &wildcard_pattern) const;
|
||||||
|
|
||||||
SharedPtr<Actor> operator[](size_t pos) const {
|
SharedPtr<Actor> operator[](size_t pos) const {
|
||||||
return _actors[pos].Get(_episode, shared_from_this());
|
return _actors[pos].Get(_episode, shared_from_this());
|
||||||
|
|
Loading…
Reference in New Issue