QuestManager::spawn2 converted to xyz_heading

This commit is contained in:
Arthur Ice 2014-12-02 13:26:55 -08:00
parent 0ad62461f0
commit 2e0cfa86bf
4 changed files with 9 additions and 14 deletions

View File

@ -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);

View File

@ -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<float>(x), static_cast<float>(y), static_cast<float>(z), static_cast<float>(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) {

View File

@ -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)

View File

@ -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);