Навёл порядок в тестах. Добавил тесты для мира. Исправил ошибку в SpawnActorFromClass
This commit is contained in:
@@ -49,7 +49,7 @@ public:
|
||||
std::shared_ptr<T> object = std::make_shared<T>();
|
||||
object->SetActorLocate(loc);
|
||||
object->SetActorRotate(rot);
|
||||
std::static_pointer_cast<Actor>(object)->world_ = this;
|
||||
std::static_pointer_cast<Actor>(object)->world_ = std::static_pointer_cast<World>(shared_from_this());
|
||||
std::static_pointer_cast<Actor>(object)->name_ = name;
|
||||
actors_map.try_emplace(name, object);
|
||||
return object;
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
void DestroyActor(std::weak_ptr<Actor> ptr);
|
||||
|
||||
template<class T, class Container = std::vector<T*>>
|
||||
template<class T, class Container = std::vector<std::weak_ptr<T>>>
|
||||
Container GetActorsByTag(std::string tag)
|
||||
{
|
||||
Container container;
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
for (auto& j : tags)
|
||||
{
|
||||
if (j == tag)
|
||||
container.push_back(i);
|
||||
container.push_back(i.second);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ public:
|
||||
}
|
||||
|
||||
template<class T>
|
||||
std::weak_ptr<T> GetActorByID(const std::string& id)
|
||||
std::weak_ptr<T> GetActorByName(const std::string& name)
|
||||
{
|
||||
auto it = actors_map.find(id);
|
||||
auto it = actors_map.find(name);
|
||||
if (it == actors_map.end() || it->second == nullptr)
|
||||
return {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user