This commit is contained in:
aozhiwei 2023-03-16 21:46:18 +08:00
parent d331a1a445
commit 9eff18ca83
2 changed files with 11 additions and 6 deletions

View File

@ -3,7 +3,7 @@
#include "mt/Grasp.h"
IMPL_TABLE(mt::Grasp)
std::map<long long, std::set<int>> mt::Grasp::hero_id_lv_hash_;
std::map<long long, std::tuple<int, std::set<int>>> mt::Grasp::hero_id_lv_gun_hash_;
namespace mt
{
@ -35,11 +35,16 @@ namespace mt
{
}
std::set<int>* Grasp::GetBuffs(int hero_id, int hero_lv)
std::set<int>* Grasp::GetBuffs(int hero_id, int hero_lv, int gun_id)
{
long long key = a8::MakeInt64(hero_id, hero_lv);
auto itr = hero_id_lv_hash_.find(key);
return itr != hero_id_lv_hash_.end() ? &itr->second : nullptr;
auto itr = hero_id_lv_gun_hash_.find(key);
if (itr != hero_id_lv_gun_hash_.end()) {
if (std::get<0>(itr->second) == gun_id) {
return &std::get<1>(itr->second);
}
}
return nullptr;
}
}

View File

@ -17,10 +17,10 @@ namespace mt
void StaticPreInit();
std::set<int>* GetBuffs(int hero_id, int hero_lv);
std::set<int>* GetBuffs(int hero_id, int hero_lv, int gun_id);
private:
static std::map<long long, std::set<int>> hero_id_lv_hash_;
static std::map<long long, std::tuple<int, std::set<int>>> hero_id_lv_gun_hash_;
std::set<int> _add_buff_list;
std::set<int> _remove_buff_list;