Core/Movement: merged smooth waypoints (commit: 05fb27dae4e8af859e01e5b9e52b082cba217657)

This commit is contained in:
Ovalord committed 2018-02-15 13:28:36 +01:00
1 parent 9b8b296b8a
commit 6dddfc812c
16 files changed
+618 -642

No files matched your search

@@ -24,19 +24,6 @@
WaypointMgr::WaypointMgr() { }
WaypointMgr::~WaypointMgr()
{
for (WaypointPathContainer::iterator itr = _waypointStore.begin(); itr != _waypointStore.end(); ++itr)
{
for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
delete *it;
itr->second.clear();
}
_waypointStore.clear();
}
void WaypointMgr::Load()
{
uint32 oldMSTime = getMSTime();
@@ -55,7 +42,6 @@ void WaypointMgr::Load()
do
{
Field* fields = result->Fetch();
WaypointData* wp = new WaypointData();
uint32 pathId = fields[0].GetUInt32();
WaypointPath& path = _waypointStore[pathId];
@@ -68,25 +54,25 @@ void WaypointMgr::Load()
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
wp->id = fields[1].GetUInt32();
wp->x = x;
wp->y = y;
wp->z = z;
wp->orientation = o;
wp->move_type = fields[6].GetUInt32();
WaypointNode wp;
wp.id = fields[1].GetUInt32();
wp.x = x;
wp.y = y;
wp.z = z;
wp.orientation = o;
wp.moveType = fields[6].GetUInt32();
if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
if (wp.moveType >= WAYPOINT_MOVE_TYPE_MAX)
{
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id);
delete wp;
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp.id);
continue;
}
wp->delay = fields[7].GetUInt32();
wp->event_id = fields[8].GetUInt32();
wp->event_chance = fields[9].GetInt16();
wp.delay = fields[7].GetUInt32();
wp.eventId = fields[8].GetUInt32();
wp.eventChance = fields[9].GetInt16();
path.push_back(wp);
path.nodes.push_back(std::move(wp));
++count;
}
while (result->NextRow());
@@ -105,9 +91,6 @@ void WaypointMgr::ReloadPath(uint32 id)
WaypointPathContainer::iterator itr = _waypointStore.find(id);
if (itr != _waypointStore.end())
{
for (WaypointPath::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
delete *it;
_waypointStore.erase(itr);
}
@@ -125,7 +108,6 @@ void WaypointMgr::ReloadPath(uint32 id)
do
{
Field* fields = result->Fetch();
WaypointData* wp = new WaypointData();
float x = fields[1].GetFloat();
float y = fields[2].GetFloat();
@@ -135,25 +117,25 @@ void WaypointMgr::ReloadPath(uint32 id)
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
wp->id = fields[0].GetUInt32();
wp->x = x;
wp->y = y;
wp->z = z;
wp->orientation = o;
wp->move_type = fields[5].GetUInt32();
WaypointNode wp;
wp.id = fields[0].GetUInt32();
wp.x = x;
wp.y = y;
wp.z = z;
wp.orientation = o;
wp.moveType = fields[5].GetUInt32();
if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
if (wp.moveType >= WAYPOINT_MOVE_TYPE_MAX)
{
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id);
delete wp;
TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp.id);
continue;
}
wp->delay = fields[6].GetUInt32();
wp->event_id = fields[7].GetUInt32();
wp->event_chance = fields[8].GetUInt8();
wp.delay = fields[6].GetUInt32();
wp.eventId = fields[7].GetUInt32();
wp.eventChance = fields[8].GetUInt8();
path.push_back(wp);
path.nodes.push_back(std::move(wp));
}
while (result->NextRow());