32 lines
643 B
C++
32 lines
643 B
C++
#include "precompile.h"
|
|
|
|
#include "mt/NpcStandard.h"
|
|
|
|
IMPL_TABLE(mt::NpcStandard)
|
|
|
|
std::map<long long, const mt::NpcStandard*> mt::NpcStandard::hero_lv_hash_;
|
|
|
|
namespace mt
|
|
{
|
|
|
|
void NpcStandard::Init1()
|
|
{
|
|
if (GetByHeroAndLv(hero_id(), level())) {
|
|
abort();
|
|
}
|
|
hero_lv_hash_[a8::MakeInt64(hero_id(), level())] = this;
|
|
}
|
|
|
|
void NpcStandard::StaticPostInit()
|
|
{
|
|
|
|
}
|
|
|
|
const mt::NpcStandard* NpcStandard::GetByHeroAndLv(int hero_id, int lv)
|
|
{
|
|
auto itr = hero_lv_hash_.find(a8::MakeInt64(hero_id, lv));
|
|
return itr != hero_lv_hash_.end() ? itr->second : nullptr;
|
|
}
|
|
|
|
}
|