From 2ec9a2addde9b76ac60307ae4d2e75f7b75dabfd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 25 May 2020 23:05:05 -0500 Subject: [PATCH] Zone point logging --- common/eqemu_logsys.h | 2 ++ common/eqemu_logsys_log_aliases.h | 18 +++++++++++++++++- zone/client.cpp | 26 +++++++++++++++++++------- zone/zone.cpp | 12 +++++++++--- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 51ec48bfc..6c3aca086 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -116,6 +116,7 @@ namespace Logs { Aura, HotReload, Merchants, + ZonePoints, MaxCategoryID /* Don't Remove this */ }; @@ -191,6 +192,7 @@ namespace Logs { "Aura", "HotReload", "Merchants", + "ZonePoints" }; } diff --git a/common/eqemu_logsys_log_aliases.h b/common/eqemu_logsys_log_aliases.h index 42f973e79..ceb45c1a7 100644 --- a/common/eqemu_logsys_log_aliases.h +++ b/common/eqemu_logsys_log_aliases.h @@ -581,6 +581,16 @@ OutF(LogSys, Logs::Detail, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ } while (0) +#define LogZonePoints(message, ...) do {\ + if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\ + OutF(LogSys, Logs::General, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ +} while (0) + +#define LogZonePointsDetail(message, ...) do {\ + if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\ + OutF(LogSys, Logs::Detail, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ +} while (0) + #define Log(debug_level, log_category, message, ...) do {\ if (LogSys.log_settings[log_category].is_category_enabled == 1)\ LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ @@ -926,6 +936,12 @@ #define LogMerchantsDetail(message, ...) do {\ } while (0) +#define LogZonePoints(message, ...) do {\ +} while (0) + +#define LogZonePointsDetail(message, ...) do {\ +} while (0) + #define Log(debug_level, log_category, message, ...) do {\ } while (0) @@ -933,4 +949,4 @@ } while (0) #endif -#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H \ No newline at end of file +#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H diff --git a/zone/client.cpp b/zone/client.cpp index 6796f9336..406382662 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6124,16 +6124,16 @@ void Client::MarkSingleCompassLoc(float in_x, float in_y, float in_z, uint8 coun void Client::SendZonePoints() { - int count = 0; - LinkedListIterator iterator(zone->zone_point_list); + int count = 0; + LinkedListIterator iterator(zone->zone_point_list); iterator.Reset(); - while(iterator.MoreElements()) - { - ZonePoint* data = iterator.GetData(); - if(ClientVersionBit() & data->client_version_mask) - { + while (iterator.MoreElements()) { + ZonePoint *data = iterator.GetData(); + + if (ClientVersionBit() & data->client_version_mask) { count++; } + iterator.Advance(); } @@ -6147,6 +6147,17 @@ void Client::SendZonePoints() while(iterator.MoreElements()) { ZonePoint* data = iterator.GetData(); + + LogZonePoints( + "Sending zone point to client [{}] mask [{}] x [{}] y [{}] z [{}] number [{}]", + GetCleanName(), + ClientVersionBit() & data->client_version_mask ? "true" : "false", + data->x, + data->y, + data->z, + data->number + ); + if(ClientVersionBit() & data->client_version_mask) { zp->zpe[i].iterator = data->number; @@ -6160,6 +6171,7 @@ void Client::SendZonePoints() } iterator.Advance(); } + FastQueuePacket(&outapp); } diff --git a/zone/zone.cpp b/zone/zone.cpp index 828557151..f7891a1fc 100755 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1310,7 +1310,14 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id) strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - LogInfo("Successfully loaded Zone Config"); + LogInfo( + "Successfully loaded Zone Config for Zone [{}] ({}) Version [{}] Instance ID [{}]", + GetShortName(), + GetLongName(), + GetInstanceVersion(), + instance_id + ); + return true; } @@ -1864,8 +1871,7 @@ ZonePoint* Zone::GetClosestZonePoint(const glm::vec3& location, uint32 to, Clien { ZonePoint* zp = iterator.GetData(); uint32 mask_test = client->ClientVersionBit(); - if(!(zp->client_version_mask & mask_test)) - { + if (!(zp->client_version_mask & mask_test)) { iterator.Advance(); continue; }