aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2014-07-25 19:04:38 -0500
committerSubv <subv2112@gmail.com>2014-07-25 19:05:25 -0500
commitb5d025938e78ade2033ed2ce23f6ece3a3c27d4d (patch)
treeaf8328ce61bc88d6a1528efcd1b9710c5b5dba2c
parenta98737d5d97f3001f670020d71772ece1e1d917f (diff)
Core/Waypoints: Allow the table waypoint_data to use Takeoff and Land waypoints.
-rw-r--r--sql/updates/world/2014_07_25_03_world_waypoint_data.sql1
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp19
-rw-r--r--src/server/game/Movement/Waypoints/WaypointManager.cpp20
-rw-r--r--src/server/game/Movement/Waypoints/WaypointManager.h12
-rw-r--r--src/server/shared/Database/Implementation/WorldDatabase.cpp2
5 files changed, 47 insertions, 7 deletions
diff --git a/sql/updates/world/2014_07_25_03_world_waypoint_data.sql b/sql/updates/world/2014_07_25_03_world_waypoint_data.sql
new file mode 100644
index 00000000000..008248d8395
--- /dev/null
+++ b/sql/updates/world/2014_07_25_03_world_waypoint_data.sql
@@ -0,0 +1 @@
+ALTER TABLE `waypoint_data` CHANGE `move_flag` `move_type` INT(11) NOT NULL DEFAULT 0;
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 7eb0f5c4b77..4061998d47a 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -161,13 +161,28 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
if (node->orientation && node->delay)
init.SetFacing(node->orientation);
- init.SetWalk(!node->run);
+ switch (node->move_type)
+ {
+ case WAYPOINT_MOVE_TYPE_LAND:
+ init.SetAnimation(Movement::ToGround);
+ break;
+ case WAYPOINT_MOVE_TYPE_TAKEOFF:
+ init.SetAnimation(Movement::ToFly);
+ break;
+ case WAYPOINT_MOVE_TYPE_RUN:
+ init.SetWalk(false);
+ break;
+ case WAYPOINT_MOVE_TYPE_WALK:
+ init.SetWalk(true);
+ break;
+ }
+
init.Launch();
//Call for creature group update
if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature)
{
- creature->SetWalk(!node->run);
+ creature->SetWalk(node->move_type != WAYPOINT_MOVE_TYPE_RUN);
creature->GetFormation()->LeaderMoveTo(formationDest.x, formationDest.y, formationDest.z);
}
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index f7cb147a148..2820c5dee17 100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -42,7 +42,7 @@ void WaypointMgr::Load()
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7 8 9
- QueryResult result = WorldDatabase.Query("SELECT id, point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data ORDER BY id, point");
+ QueryResult result = WorldDatabase.Query("SELECT id, point, position_x, position_y, position_z, orientation, move_type, delay, action, action_chance FROM waypoint_data ORDER BY id, point");
if (!result)
{
@@ -73,7 +73,14 @@ void WaypointMgr::Load()
wp->y = y;
wp->z = z;
wp->orientation = o;
- wp->run = fields[6].GetBool();
+ wp->move_type = fields[6].GetUInt32();
+
+ if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
+ {
+ 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();
@@ -126,7 +133,14 @@ void WaypointMgr::ReloadPath(uint32 id)
wp->y = y;
wp->z = z;
wp->orientation = o;
- wp->run = fields[5].GetBool();
+ wp->move_type = fields[5].GetUInt32();
+
+ if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX)
+ {
+ 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();
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.h b/src/server/game/Movement/Waypoints/WaypointManager.h
index 385f4809729..8e5dd1f64c7 100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.h
+++ b/src/server/game/Movement/Waypoints/WaypointManager.h
@@ -21,13 +21,23 @@
#include <vector>
+enum WaypointMoveType
+{
+ WAYPOINT_MOVE_TYPE_WALK,
+ WAYPOINT_MOVE_TYPE_RUN,
+ WAYPOINT_MOVE_TYPE_LAND,
+ WAYPOINT_MOVE_TYPE_TAKEOFF,
+
+ WAYPOINT_MOVE_TYPE_MAX
+};
+
struct WaypointData
{
uint32 id;
float x, y, z, orientation;
uint32 delay;
uint32 event_id;
- bool run;
+ uint32 move_type;
uint8 event_chance;
};
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index d0e9c463ad7..b06df155a07 100644
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -51,7 +51,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID, "UPDATE waypoint_data SET wpguid = ? WHERE id = ? and point = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_SEL_WAYPOINT_DATA_MAX_ID, "SELECT MAX(id) FROM waypoint_data", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_DATA_MAX_POINT, "SELECT MAX(point) FROM waypoint_data WHERE id = ?", CONNECTION_SYNCH);
- PrepareStatement(WORLD_SEL_WAYPOINT_DATA_BY_ID, "SELECT point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data WHERE id = ? ORDER BY point", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_SEL_WAYPOINT_DATA_BY_ID, "SELECT point, position_x, position_y, position_z, orientation, move_type, delay, action, action_chance FROM waypoint_data WHERE id = ? ORDER BY point", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_DATA_POS_BY_ID, "SELECT point, position_x, position_y, position_z FROM waypoint_data WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID, "SELECT position_x, position_y, position_z FROM waypoint_data WHERE point = 1 AND id = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID, "SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE id = ? ORDER BY point DESC LIMIT 1", CONNECTION_SYNCH);