本文整理汇总了C++中Map::GetInstanceData方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetInstanceData方法的具体用法?C++ Map::GetInstanceData怎么用?C++ Map::GetInstanceData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::GetInstanceData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool GameObject::Create(uint32 guidlow, uint32 name_id, uint32 mapid, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 dynflags)
{
Relocate(x,y,z,ang);
SetMapId(mapid);
if(!IsPositionValid())
{
sLog.outError("ERROR: Gameobject (GUID: %u Entry: %u ) not created. Suggested coordinates isn't valid (X: %f Y: %f)",guidlow,name_id,x,y);
return false;
}
Object::_Create(guidlow, HIGHGUID_GAMEOBJECT);
m_DBTableGuid = guidlow;
GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(name_id);
if (!goinfo)
{
sLog.outErrorDb("Gameobject (GUID: %u Entry: %u) not created: it have not exist entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f) ang: %f rotation0: %f rotation1: %f rotation2: %f rotation3: %f",guidlow, name_id, mapid, x, y, z, ang, rotation0, rotation1, rotation2, rotation3);
return false;
}
if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
{
sLog.outErrorDb("Gameobject (GUID: %u Entry: %u) not created: it have not exist GO type '%u' in `gameobject_template`. It's will crash client if created.",guidlow,name_id,goinfo->type);
return false;
}
// SetUInt32Value(GAMEOBJECT_TIMESTAMP, (uint32)time(NULL));
SetFloatValue(GAMEOBJECT_POS_X, x);
SetFloatValue(GAMEOBJECT_POS_Y, y);
SetFloatValue(GAMEOBJECT_POS_Z, z);
SetFloatValue(GAMEOBJECT_FACING, ang); //this is not facing angle
SetFloatValue (GAMEOBJECT_ROTATION, rotation0);
SetFloatValue (GAMEOBJECT_ROTATION+1, rotation1);
SetFloatValue (GAMEOBJECT_ROTATION+2, rotation2);
SetFloatValue (GAMEOBJECT_ROTATION+3, rotation3);
SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
m_flags = goinfo->flags;
SetUInt32Value (OBJECT_FIELD_ENTRY, goinfo->id);
SetUInt32Value (GAMEOBJECT_DISPLAYID, goinfo->displayId);
SetUInt32Value (GAMEOBJECT_STATE, 1);
SetUInt32Value (GAMEOBJECT_TYPE_ID, goinfo->type);
SetUInt32Value (GAMEOBJECT_ANIMPROGRESS, animprogress);
SetUInt32Value (GAMEOBJECT_DYN_FLAGS, dynflags);
//Notify the map's instance data.
//Only works if you create the object in it, not if it is moves to that map.
//Normally non-players do not teleport to other maps.
Map *map = MapManager::Instance().GetMap(GetMapId(), this);
if(map && map->GetInstanceData())
{
map->GetInstanceData()->OnObjectCreate(this);
}
return true;
}