This commit is contained in:
aozhiwei 2022-12-26 10:35:40 +08:00
parent 4e26fbb58b
commit acb4e585e6
2 changed files with 17 additions and 3 deletions

View File

@ -3,6 +3,7 @@
#include "mt/PveGeminiContent.h"
IMPL_TABLE(mt::PveGeminiContent)
std::map<int, std::vector<const mt::PveGeminiContent*>> mt::PveGeminiContent::mode_hash_;
namespace mt
{
@ -14,11 +15,20 @@ namespace mt
for (auto& str : strings) {
_enemys.push_back(a8::XValue(str));
}
{
auto itr = mode_hash_.find(mode_id());
if (itr != mode_hash_.end()) {
itr->second.push_back(this);
} else {
mode_hash_[mode_id()] = std::vector<const mt::PveGeminiContent*>({this});
}
}
}
std::vector<const mt::PveGeminiContent*>* PveGeminiContent::GetContentsByMode(int mode)
const std::vector<const mt::PveGeminiContent*>* PveGeminiContent::GetContentsByMode(int mode)
{
return nullptr;
auto itr = mode_hash_.find(mode);
return itr != mode_hash_.end() ? &itr->second : nullptr;
}
}

View File

@ -15,7 +15,11 @@ namespace mt
std::vector<int> _enemys;
void Init1();
static std::vector<const mt::PveGeminiContent*>* GetContentsByMode(int mode);
static const std::vector<const mt::PveGeminiContent*>* GetContentsByMode(int mode);
private:
static std::map<int, std::vector<const mt::PveGeminiContent*>> mode_hash_;
};
}