Удалил UType::object_ptr и заменил его на комбинацию из std::shared_ptr и std::weak_ptr из-за ужасной реализации.

This commit is contained in:
2026-05-31 20:38:30 +07:00
parent fa3e987e93
commit 6389e6b25f
14 changed files with 67 additions and 311 deletions
+6 -7
View File
@@ -2,7 +2,6 @@
#include "Game/SaveMap/SaveMap.hpp"
#include "Game/World/World.hpp"
#include "Log/Log.hpp"
void Actor::OnDestroy()
{
@@ -16,17 +15,17 @@ Actor::Actor() : loc_(new Vector3D), rot_(new Vector3D), scale_(new Vector3D)
std::shared_ptr<SaveMap> Actor::save()
{
return std::make_shared<SaveMap>("Actor")
->SaveObject("loc", static_cast<UType::object_ptr<ISave>>(loc_))
->SaveObject("rot", static_cast<UType::object_ptr<ISave>>(rot_))
->SaveObject("scale", UType::object_ptr<ISave>(scale_))
->SaveObject("loc", loc_)
->SaveObject("rot", rot_)
->SaveObject("scale", scale_)
->SaveListStrings("tags", std::move(tags));
}
void Actor::load(std::shared_ptr<SaveMap> save)
{
loc_ = static_cast<UType::object_ptr<Vector3D>>(save->GetObject("loc"));
rot_ = static_cast<UType::object_ptr<Vector3D>>(save->GetObject("rot"));
scale_ = static_cast<UType::object_ptr<Vector3D>>(save->GetObject("scale"));
loc_ = std::static_pointer_cast<Vector3D>(save->GetObject("loc"));
rot_ = std::static_pointer_cast<Vector3D>(save->GetObject("rot"));
scale_ = std::static_pointer_cast<Vector3D>(save->GetObject("scale"));
tags = std::move(save->GetListString("tags"));
}