This commit is contained in:
aozhiwei 2023-06-14 19:39:19 +08:00
parent fd2489f0d4
commit 4d7268ef43
2 changed files with 17 additions and 5 deletions

View File

@ -4,15 +4,25 @@
IMPL_TABLE(mt::SafeArea)
std::map<int, mt::SafeArea*> mt::SafeArea::type_hash_;
std::map<int, std::vector<mt::SafeArea*>> mt::SafeArea::type_hash_;
namespace mt
{
void SafeArea::Init1()
{
if (!GetByType(type())) {
type_hash_[type()] = this;
{
auto itr = type_hash_.find(type());
if (itr == type_hash_.end()) {
type_hash_[type()] = std::vector<mt::SafeArea*>({this});
} else {
if (itr->second.empty()) {
abort();
}
if (itr->second.at(itr->second.size() - 1)->id() + 1 != id()) {
abort();
}
}
}
if (!boss().empty()) {
std::vector<std::string> strings;
@ -34,13 +44,15 @@ namespace mt
void SafeArea::StaticPostInit()
{
for (auto& pair : type_hash_) {
}
}
const SafeArea* SafeArea::GetByType(int type)
{
auto itr = type_hash_.find(type);
return itr != type_hash_.end() ? itr->second : nullptr;
return itr != type_hash_.end() ? itr->second.at(0) : nullptr;
}
}

View File

@ -21,7 +21,7 @@ namespace mt
private:
static std::map<int, mt::SafeArea*> type_hash_;
static std::map<int, std::vector<mt::SafeArea*>> type_hash_;
int small_ring_count_ = 0;
const mt::SafeArea* last_area_ = nullptr;
std::shared_ptr<std::tuple<glm::vec3, float, int>> _boss;