diff --git a/zone/command.cpp b/zone/command.cpp index b47ec1fac..bd1626f85 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -5635,8 +5635,7 @@ void command_wpadd(Client *c, const Seperator *sep) { int type1=0, type2=0, - pause=0, - heading=-1; // Defaults for a new grid + pause=0; // Defaults for a new grid Mob *t=c->GetTarget(); if (t && t->IsNPC()) @@ -5659,9 +5658,11 @@ void command_wpadd(Client *c, const Seperator *sep) return; } } - if (strcmp("-h",sep->arg[2]) == 0) - heading = c->GetHeading(); - uint32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), c->GetX(),c->GetY(),c->GetZ(), pause, type1, type2, zone->GetZoneID(), heading); + auto position = c->GetPosition(); + if (strcmp("-h",sep->arg[2]) != 0) + position.m_Heading = -1; + + uint32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), position, pause, type1, type2, zone->GetZoneID()); if (tmp_grid) t->CastToNPC()->SetGrid(tmp_grid); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index a8b123fc3..bd012daca 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1217,7 +1217,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num * Returns 0 if the function didn't have to create a new grid. If the function had to create a new grid for the spawn, then the ID of * the created grid is returned. */ -uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading) { +uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, const xyz_heading& position, uint32 pause, int type1, int type2, uint16 zoneid) { uint32 grid_num; // The grid number the spawn is assigned to (if spawn has no grid, will be the grid number we end up creating) uint32 next_wp_num; // The waypoint number we should be assigning to the new waypoint @@ -1280,7 +1280,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, query = StringFormat("INSERT INTO grid_entries(gridid, zoneid, `number`, x, y, z, pause, heading) " "VALUES (%i, %i, %i, %f, %f, %f, %i, %f)", - grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); + grid_num, zoneid, next_wp_num, position.m_X, position.m_Y, position.m_Z, pause, position.m_Heading); results = QueryDatabase(query); if(!results.Success()) LogFile->write(EQEMuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); diff --git a/zone/zonedb.h b/zone/zonedb.h index 832ad9f4b..4a563f2b9 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -364,7 +364,7 @@ public: void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too, uint16 zoneid); void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num, uint16 zoneid); void AddWP(Client *c, uint32 gridid, uint32 wpnum, const xyz_heading& position, uint32 pause, uint16 zoneid); - uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading); + uint32 AddWPForSpawn(Client *c, uint32 spawn2id, const xyz_heading& position, uint32 pause, int type1, int type2, uint16 zoneid); void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0, uint16 zoneid = 0); void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script = 0, uint16 zoneid = 0); uint8 GetGridType(uint32 grid, uint32 zoneid);