48{
50
52
55
56 if (!result)
57 {
58 LOG_WARN(
"server.loading",
">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
60 return;
61 }
62
67
68 do
69 {
70 Field* fields = result->Fetch();
73 float x = fields[2].
Get<
float>();
74 float y = fields[3].
Get<
float>();
75 float z = fields[4].
Get<
float>();
76 std::optional<float> o;
77 if (!fields[5].IsNull())
78 o = fields[5].Get<float>();
80
81 if (last_entry != entry)
82 {
85 last_id = 1;
86 count++;
87 }
88
89 if (last_id != id)
90 LOG_ERROR(
"sql.sql",
"SmartWaypointMgr::LoadFromDB: Path entry {}, unexpected point id {}, expected {}.", entry,
id, last_id);
91
92 last_id++;
102
103 last_entry = entry;
104 total++;
105 } while (result->NextRow());
106
107 LOG_INFO(
"server.loading",
">> Loaded {} SmartAI waypoint paths (total {} waypoints) in {} ms", count, total,
GetMSTimeDiffToNow(oldMSTime));
109}
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition DatabaseEnvFwd.h:45
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition DatabaseEnv.cpp:20
std::uint32_t uint32
Definition Define.h:107
#define LOG_INFO(filterType__,...)
Definition Log.h:166
#define LOG_ERROR(filterType__,...)
Definition Log.h:158
#define LOG_WARN(filterType__,...)
Definition Log.h:162
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:131
uint32 getMSTime()
Definition Timer.h:103
@ WAYPOINT_MOVE_TYPE_MAX
Definition WaypointDefines.h:33
@ WORLD_SEL_SMARTAI_WP
Definition WorldDatabase.h:36
Class used to access individual fields of database query result.
Definition Field.h:98
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112
Definition PreparedStatement.h:157
Definition WaypointDefines.h:37
uint32 Delay
Definition WaypointDefines.h:51
std::optional< float > Orientation
Definition WaypointDefines.h:49
float X
Definition WaypointDefines.h:48
float Z
Definition WaypointDefines.h:48
float Y
Definition WaypointDefines.h:48
uint32 Id
Definition WaypointDefines.h:47
uint32 MoveType
Definition WaypointDefines.h:53
Definition WaypointDefines.h:60