48{
50
52 {
53 delete itr.second;
54 }
55
57
60
61 if (!result)
62 {
63 LOG_WARN(
"server.loading",
">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
65 return;
66 }
67
72
73 do
74 {
75 Field* fields = result->Fetch();
78 float x = fields[2].
Get<
float>();
79 float y = fields[3].
Get<
float>();
80 float z = fields[4].
Get<
float>();
82 if (!fields[5].IsNull())
83 o = fields[5].Get<float>();
85
86 if (last_entry != entry)
87 {
89 last_id = 1;
90 count++;
91 }
92
93 if (last_id != id)
94 LOG_ERROR(
"sql.sql",
"SmartWaypointMgr::LoadFromDB: Path entry {}, unexpected point id {}, expected {}.", entry,
id, last_id);
95
96 last_id++;
106
107 last_entry = entry;
108 total++;
109 } while (result->NextRow());
110
111 LOG_INFO(
"server.loading",
">> Loaded {} SmartAI waypoint paths (total {} waypoints) in {} ms", count, total,
GetMSTimeDiffToNow(oldMSTime));
113}
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
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:24
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:131
uint32 getMSTime()
Definition Timer.h:103
@ WAYPOINT_MOVE_TYPE_MAX
Definition WaypointMgr.h:34
std::map< uint32, WaypointData > WaypointPath
Definition WaypointMgr.h:48
@ 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 WaypointMgr.h:38
float z
Definition WaypointMgr.h:40
float x
Definition WaypointMgr.h:40
float y
Definition WaypointMgr.h:40
std::optional< float > orientation
Definition WaypointMgr.h:41
uint32 delay
Definition WaypointMgr.h:42
uint32 id
Definition WaypointMgr.h:39
uint32 move_type
Definition WaypointMgr.h:44