My knowledge of c++ is limited and I would like to ask how that works:
The declaration of creating a gameobject is in GameObject.h (line 687) like that:
[FONT=‘Courier New’]bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);[/FONT]
After phasemask the function is asking for a struct Position.
But in the script for spawning gameobjects (cs_gobject.cpp, ) there is a piece of code like that:
[FONT=‘Courier New’] Player* player = handler->GetSession()->GetPlayer();
Map* map = player->GetMap();[/FONT]
[FONT=‘Courier New’] GameObject* object = new GameObject();
ObjectGuid::LowType guidLow = map->GenerateLowGuidHighGuid::GameObject();[/FONT]
[FONT=‘Courier New’] G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f);
if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), *player, rot, 255, GO_STATE_READY))
{
delete object;
return false;
}[/FONT]
As you see instead to send a position struct there is a pointer to player.
How does this trick work ? There is no compiler complaint and I also couldn’t find an overload.