diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 6df722934..45086093c 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -218,11 +218,9 @@ XS(XS__spawn) int npc_type = (int)SvIV(ST(0)); int grid = (int)SvIV(ST(1)); int unused = (int)SvIV(ST(2)); - float x = (float)SvNV(ST(3)); - float y = (float)SvNV(ST(4)); - float z = (float)SvNV(ST(5)); + auto position = xyz_heading((float)SvNV(ST(3)), (float)SvNV(ST(4)), (float)SvNV(ST(5)), 0.0f); - Mob *r = quest_manager.spawn2(npc_type, grid, unused, x, y, z, 0); + Mob *r = quest_manager.spawn2(npc_type, grid, unused, position); RETVAL = (r != nullptr) ? r->GetID() : 0; XSprePUSH; PUSHu((UV)RETVAL); @@ -242,12 +240,9 @@ XS(XS__spawn2) int npc_type = (int)SvIV(ST(0)); int grid = (int)SvIV(ST(1)); int unused = (int)SvIV(ST(2)); - float x = (float)SvNV(ST(3)); - float y = (float)SvNV(ST(4)); - float z = (float)SvNV(ST(5)); - float heading = (float)SvNV(ST(6)); + auto position = xyz_heading((float)SvNV(ST(3)), (float)SvNV(ST(4)), (float)SvNV(ST(5)), (float)SvNV(ST(6))); - Mob *r = quest_manager.spawn2(npc_type, grid, unused, x, y, z, heading); + Mob *r = quest_manager.spawn2(npc_type, grid, unused, position); RETVAL = (r != nullptr) ? r->GetID() : 0; XSprePUSH; PUSHu((UV)RETVAL); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 28dbba206..915efe780 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -251,8 +251,8 @@ void unregister_spell_event(int evt, int spell_id) { } Lua_Mob lua_spawn2(int npc_type, int grid, int unused, double x, double y, double z, double heading) { - return Lua_Mob(quest_manager.spawn2(npc_type, grid, unused, - static_cast(x), static_cast(y), static_cast(z), static_cast(heading))); + auto position = xyz_heading(x, y, z, heading); + return Lua_Mob(quest_manager.spawn2(npc_type, grid, unused, position)); } Lua_Mob lua_unique_spawn(int npc_type, int grid, int unused, double x, double y, double z, double heading = 0.0) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 25e43752e..48c94f1cc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -241,11 +241,11 @@ void QuestManager::write(const char *file, const char *str) { fclose (pFile); } -Mob* QuestManager::spawn2(int npc_type, int grid, int unused, float x, float y, float z, float heading) { +Mob* QuestManager::spawn2(int npc_type, int grid, int unused, const xyz_heading& position) { const NPCType* tmp = 0; if (tmp = database.GetNPCType(npc_type)) { - NPC* npc = new NPC(tmp, nullptr, xyz_heading(x, y, z, heading), FlyMode3); + NPC* npc = new NPC(tmp, nullptr, position, FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc,true,true); if(grid > 0) diff --git a/zone/questmgr.h b/zone/questmgr.h index d001beab4..072fceb31 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -56,7 +56,7 @@ public: void me(const char *str); void summonitem(uint32 itemid, int16 charges = -1); void write(const char *file, const char *str); - Mob* spawn2(int npc_type, int grid, int unused, float x, float y, float z, float heading); + Mob* spawn2(int npc_type, int grid, int unused, const xyz_heading& position); Mob* unique_spawn(int npc_type, int grid, int unused, float x, float y, float z, float heading = 0); Mob* spawn_from_spawn2(uint32 spawn2_id); void enable_spawn2(uint32 spawn2_id);