本文整理汇总了C++中NPC::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ NPC::GetID方法的具体用法?C++ NPC::GetID怎么用?C++ NPC::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPC
的用法示例。
在下文中一共展示了NPC::GetID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unique_spawn
int16 QuestManager::unique_spawn(int npc_type, int grid, int unused, float x, float y, float z, float heading) {
Mob *other = entity_list.GetMobByNpcTypeID(npc_type);
if(other != NULL) {
return(other->GetID());
}
NPCType* tmp = 0;
if ((tmp = Database::Instance()->GetNPCType(npc_type)))
{
NPC* npc = new NPC(tmp, 0, x, y, z, heading);
npc->AddLootTable();
entity_list.AddNPC(npc,true);
// Quag: Sleep in main thread? ICK!
// Sleep(200);
// Quag: check is irrelevent, it's impossible for npc to be 0 here
// (we're in main thread, nothing else can possibly modify it)
// if(npc != 0) {
if(grid > 0)
{
// HarakiriFIXME npc->AssignWaypoints(grid);
}
npc->SendPosUpdate();
// }
return(npc->GetID());
}
return(0);
}
示例2: ProcessNpcProp
//----------------------------------------------------------------------------
void DataBaseEngine::ProcessNpcProp(const EngineEvent &ent)
{
EngineEvent e;
std::map<std::string, int>::const_iterator npcID =
ent.miData.find("NPC_ID_REQ");
std::map<std::string, int>::const_iterator id = ent.miData.find("ID");
assert(npcID != ent.miData.end() && id != ent.miData.end());
NPC n = GetNPCByID(npcID->second);
std::ostringstream archiveStream;
boost::archive::text_oarchive archive(archiveStream);
archive << n;
const std::string &s = archiveStream.str();
e.mType = EngineEvent::NPC_PROP;
e.msData["NPC_PROP"] = s;
e.miData["ID"] = id->second;
e.miData["NPC_ID"] = n.GetID();
SendMessageToNet(e);
}