mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Private member prefixes for proximities and goal lists
This commit is contained in:
parent
01f69bcc51
commit
00902d8a7e
@ -11,15 +11,15 @@
|
||||
|
||||
TaskGoalListManager::TaskGoalListManager()
|
||||
{
|
||||
goal_lists_count = 0;
|
||||
m_goal_lists_count = 0;
|
||||
}
|
||||
|
||||
TaskGoalListManager::~TaskGoalListManager() {}
|
||||
|
||||
bool TaskGoalListManager::LoadLists()
|
||||
{
|
||||
task_goal_lists.clear();
|
||||
goal_lists_count = 0;
|
||||
m_task_goal_lists.clear();
|
||||
m_goal_lists_count = 0;
|
||||
|
||||
std::string query = "SELECT `listid`, COUNT(`entry`) FROM `goallists` GROUP by `listid` ORDER BY `listid`";
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
@ -27,39 +27,39 @@ bool TaskGoalListManager::LoadLists()
|
||||
return false;
|
||||
}
|
||||
|
||||
goal_lists_count = results.RowCount();
|
||||
LogTasks("Loaded [{}] GoalLists", goal_lists_count);
|
||||
m_goal_lists_count = results.RowCount();
|
||||
LogTasks("Loaded [{}] GoalLists", m_goal_lists_count);
|
||||
|
||||
task_goal_lists.reserve(goal_lists_count);
|
||||
m_task_goal_lists.reserve(m_goal_lists_count);
|
||||
|
||||
int list_index = 0;
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
int list_id = atoi(row[0]);
|
||||
int list_size = atoi(row[1]);
|
||||
|
||||
task_goal_lists.push_back({list_id, 0, 0});
|
||||
m_task_goal_lists.push_back({list_id, 0, 0});
|
||||
|
||||
task_goal_lists[list_index].GoalItemEntries.reserve(list_size);
|
||||
m_task_goal_lists[list_index].GoalItemEntries.reserve(list_size);
|
||||
|
||||
list_index++;
|
||||
}
|
||||
|
||||
auto goal_lists = GoallistsRepository::GetWhere(content_db, "TRUE ORDER BY listid, entry ASC");
|
||||
for (list_index = 0; list_index < goal_lists_count; list_index++) {
|
||||
for (list_index = 0; list_index < m_goal_lists_count; list_index++) {
|
||||
|
||||
int list_id = task_goal_lists[list_index].ListID;
|
||||
int list_id = m_task_goal_lists[list_index].ListID;
|
||||
|
||||
for (auto &entry: goal_lists) {
|
||||
if (entry.listid == list_id) {
|
||||
if (entry.entry < task_goal_lists[list_index].Min) {
|
||||
task_goal_lists[list_index].Min = entry.entry;
|
||||
if (entry.entry < m_task_goal_lists[list_index].Min) {
|
||||
m_task_goal_lists[list_index].Min = entry.entry;
|
||||
}
|
||||
|
||||
if (entry.entry > task_goal_lists[list_index].Max) {
|
||||
task_goal_lists[list_index].Max = entry.entry;
|
||||
if (entry.entry > m_task_goal_lists[list_index].Max) {
|
||||
m_task_goal_lists[list_index].Max = entry.entry;
|
||||
}
|
||||
|
||||
task_goal_lists[list_index].GoalItemEntries.push_back(entry.entry);
|
||||
m_task_goal_lists[list_index].GoalItemEntries.push_back(entry.entry);
|
||||
|
||||
LogTasksDetail(
|
||||
"Goal list index [{}] loading list [{}] entry [{}]",
|
||||
@ -80,31 +80,31 @@ int TaskGoalListManager::GetListByID(int list_id)
|
||||
|
||||
// Find the list with the specified ListID and return the index
|
||||
auto it = std::find_if(
|
||||
task_goal_lists.begin(),
|
||||
task_goal_lists.end(),
|
||||
m_task_goal_lists.begin(),
|
||||
m_task_goal_lists.end(),
|
||||
[list_id](const TaskGoalList_Struct &t) { return t.ListID == list_id; }
|
||||
);
|
||||
|
||||
if (it == task_goal_lists.end()) {
|
||||
if (it == m_task_goal_lists.end()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return std::distance(task_goal_lists.begin(), it);
|
||||
return std::distance(m_task_goal_lists.begin(), it);
|
||||
}
|
||||
|
||||
int TaskGoalListManager::GetFirstEntry(int list_id)
|
||||
{
|
||||
int list_by_id = GetListByID(list_id);
|
||||
|
||||
if ((list_by_id < 0) || (list_by_id >= goal_lists_count)) {
|
||||
if ((list_by_id < 0) || (list_by_id >= m_goal_lists_count)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (task_goal_lists[list_by_id].GoalItemEntries.empty()) {
|
||||
if (m_task_goal_lists[list_by_id].GoalItemEntries.empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return task_goal_lists[list_by_id].GoalItemEntries[0];
|
||||
return m_task_goal_lists[list_by_id].GoalItemEntries[0];
|
||||
}
|
||||
|
||||
std::vector<int> TaskGoalListManager::GetListContents(int list_index)
|
||||
@ -112,11 +112,11 @@ std::vector<int> TaskGoalListManager::GetListContents(int list_index)
|
||||
std::vector<int> list_contents;
|
||||
int list_by_id = GetListByID(list_index);
|
||||
|
||||
if ((list_by_id < 0) || (list_by_id >= goal_lists_count)) {
|
||||
if ((list_by_id < 0) || (list_by_id >= m_goal_lists_count)) {
|
||||
return list_contents;
|
||||
}
|
||||
|
||||
list_contents = task_goal_lists[list_by_id].GoalItemEntries;
|
||||
list_contents = m_task_goal_lists[list_by_id].GoalItemEntries;
|
||||
|
||||
return list_contents;
|
||||
}
|
||||
@ -127,16 +127,16 @@ bool TaskGoalListManager::IsInList(int list_id, int entry)
|
||||
|
||||
int list_index = GetListByID(list_id);
|
||||
|
||||
if ((list_index < 0) || (list_index >= goal_lists_count)) {
|
||||
if ((list_index < 0) || (list_index >= m_goal_lists_count)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((entry < task_goal_lists[list_index].Min) || (entry > task_goal_lists[list_index].Max)) {
|
||||
if ((entry < m_task_goal_lists[list_index].Min) || (entry > m_task_goal_lists[list_index].Max)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int first_entry = 0;
|
||||
auto &task = task_goal_lists[list_index];
|
||||
auto &task = m_task_goal_lists[list_index];
|
||||
auto it = std::find(task.GoalItemEntries.begin(), task.GoalItemEntries.end(), entry);
|
||||
|
||||
if (it == task.GoalItemEntries.end()) {
|
||||
|
||||
@ -29,8 +29,8 @@ public:
|
||||
std::vector<int> GetListContents(int list_index);
|
||||
|
||||
private:
|
||||
std::vector<TaskGoalList_Struct> task_goal_lists;
|
||||
int goal_lists_count;
|
||||
std::vector<TaskGoalList_Struct> m_task_goal_lists;
|
||||
int m_goal_lists_count;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ TaskProximityManager::~TaskProximityManager()
|
||||
bool TaskProximityManager::LoadProximities(int zone_id)
|
||||
{
|
||||
TaskProximity proximity{};
|
||||
task_proximities.clear();
|
||||
m_task_proximities.clear();
|
||||
|
||||
auto proximities = ProximitiesRepository::GetWhere(
|
||||
content_db,
|
||||
@ -39,7 +39,7 @@ bool TaskProximityManager::LoadProximities(int zone_id)
|
||||
proximity.min_z = row.minz;
|
||||
proximity.max_z = row.maxz;
|
||||
|
||||
task_proximities.push_back(proximity);
|
||||
m_task_proximities.push_back(proximity);
|
||||
}
|
||||
|
||||
LogTasks("Loaded [{}] Task Proximities", proximities.size());
|
||||
@ -49,7 +49,7 @@ bool TaskProximityManager::LoadProximities(int zone_id)
|
||||
|
||||
int TaskProximityManager::CheckProximities(float x, float y, float z)
|
||||
{
|
||||
for (auto &task_proximity : task_proximities) {
|
||||
for (auto &task_proximity : m_task_proximities) {
|
||||
|
||||
TaskProximity *p_proximity = &task_proximity;
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ public:
|
||||
int CheckProximities(float x, float y, float z);
|
||||
|
||||
private:
|
||||
std::vector <TaskProximity> task_proximities;
|
||||
std::vector <TaskProximity> m_task_proximities;
|
||||
};
|
||||
|
||||
#endif //EQEMU_TASK_PROXIMITY_MANAGER_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user