This commit is contained in:
aozhiwei 2023-02-20 16:24:25 +08:00
parent 8303910e1a
commit 581315e18e
2 changed files with 17 additions and 5 deletions

View File

@ -3,14 +3,13 @@
#include "mt/Grasp.h" #include "mt/Grasp.h"
IMPL_TABLE(mt::Grasp) IMPL_TABLE(mt::Grasp)
std::map<long long, std::map<int, std::vector<mt::GraspBuff*>>> mt::Grasp:: hero_weapon_hash_; std::map<long long, std::map<int, std::vector<const mt::GraspBuff*>>> mt::Grasp:: hero_weapon_hash_;
namespace mt namespace mt
{ {
void Grasp::Init1() void Grasp::Init1()
{ {
} }
void Grasp::Init2() void Grasp::Init2()
@ -18,7 +17,19 @@ namespace mt
} }
std::vector<mt::GraspBuff*>* Grasp::GetGrasp(int hero_id, int hero_lv, int weapon_id) void Grasp::StaticPreInit()
{
Traverse
(
[] (const mt::Grasp* meta, bool& stop)
{
auto itr = hero_weapon_hash_.find(a8::MakeInt64(meta->hero_id(), meta->weapon_id()));
if (itr != hero_weapon_hash_.end()) {
}
});
}
std::vector<const mt::GraspBuff*>* Grasp::GetGrasp(int hero_id, int hero_lv, int weapon_id)
{ {
auto itr = hero_weapon_hash_.find(a8::MakeInt64(hero_id, weapon_id)); auto itr = hero_weapon_hash_.find(a8::MakeInt64(hero_id, weapon_id));
if (itr != hero_weapon_hash_.end()) { if (itr != hero_weapon_hash_.end()) {

View File

@ -14,15 +14,16 @@ namespace mt
void Init1(); void Init1();
void Init2(); void Init2();
void StaticPreInit();
const mt::GraspBuff* buff1_meta = nullptr; const mt::GraspBuff* buff1_meta = nullptr;
const mt::GraspBuff* floor2_buff_meta = nullptr; const mt::GraspBuff* floor2_buff_meta = nullptr;
const mt::GraspBuff* buff2_meta = nullptr; const mt::GraspBuff* buff2_meta = nullptr;
static std::vector<mt::GraspBuff*>* GetGrasp(int hero_id, int hero_lv, int weapon_id); static std::vector<const mt::GraspBuff*>* GetGrasp(int hero_id, int hero_lv, int weapon_id);
private: private:
static std::map<long long, std::map<int, std::vector<mt::GraspBuff*>>> hero_weapon_hash_; static std::map<long long, std::map<int, std::vector<const mt::GraspBuff*>>> hero_weapon_hash_;
}; };
} }