mirror of
https://github.com/mangosfour/server.git
synced 2026-01-01 16:37:12 +00:00
Rebase resync
This commit is contained in:
parent
a0797532e8
commit
1997c1e903
3106 changed files with 11118 additions and 627576 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/**
|
||||
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include "WaypointManager.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "GridDefines.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
|
@ -153,7 +153,7 @@ void WaypointManager::Load()
|
|||
|
||||
if (result1)
|
||||
{
|
||||
node.z = sTerrainMgr.LoadTerrain(result1->Fetch()[1].GetUInt32())->GetHeight(node.x, node.y, node.z);
|
||||
node.z = sTerrainMgr.LoadTerrain(result1->Fetch()[1].GetUInt32())->GetHeightStatic(node.x, node.y, node.z);
|
||||
delete result1;
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ void WaypointManager::Load()
|
|||
{
|
||||
if (sCreatureMovementScripts.second.find(node.script_id) == sCreatureMovementScripts.second.end())
|
||||
{
|
||||
sLog.outErrorDb("Table creature_movement for id %u, point %u have script_id %u that does not exist in `creature_movement_scripts`, ignoring", id, point, node.script_id);
|
||||
sLog.outErrorDb("Table creature_movement for id %u, point %u have script_id %u that does not exist in `dbscripts_on_creature_movement`, ignoring", id, point, node.script_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -181,14 +181,14 @@ void WaypointManager::Load()
|
|||
|
||||
for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
|
||||
{
|
||||
be.textid[i] = fields[7 + i].GetUInt32();
|
||||
be.textid[i] = fields[7 + i].GetInt32();
|
||||
|
||||
if (be.textid[i])
|
||||
{
|
||||
if (be.textid[i] < MIN_DB_SCRIPT_STRING_ID || be.textid[i] >= MAX_DB_SCRIPT_STRING_ID)
|
||||
{
|
||||
sLog.outErrorDb("Table `db_script_string` not have string id %u", be.textid[i]);
|
||||
continue;
|
||||
sLog.outErrorDb("Table `creature_movement` Id %u, point %u has textid%u has value %d out of range. Must be in %u-%u", id, point, i + 1, be.textid[i], MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID - 1);
|
||||
be.textid[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -329,7 +329,7 @@ void WaypointManager::Load()
|
|||
{
|
||||
if (sCreatureMovementScripts.second.find(node.script_id) == sCreatureMovementScripts.second.end())
|
||||
{
|
||||
sLog.outErrorDb("Table creature_movement_template for entry %u, point %u have script_id %u that does not exist in `creature_movement_scripts`, ignoring", entry, point, node.script_id);
|
||||
sLog.outErrorDb("Table creature_movement_template for entry %u, point %u have script_id %u that does not exist in `dbscripts_on_creature_movement`, ignoring", entry, point, node.script_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -350,8 +350,8 @@ void WaypointManager::Load()
|
|||
{
|
||||
if (be.textid[i] < MIN_DB_SCRIPT_STRING_ID || be.textid[i] >= MAX_DB_SCRIPT_STRING_ID)
|
||||
{
|
||||
sLog.outErrorDb("Table `db_script_string` not have string id %u", be.textid[i]);
|
||||
continue;
|
||||
sLog.outErrorDb("Table `creature_movement_template` Entry %u, point %u has textid%u has value %d out of range. Must be in %u-%u", entry, point, i + 1, be.textid[i], MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID - 1);
|
||||
be.textid[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ void WaypointManager::Load()
|
|||
if (!movementScriptSet.empty())
|
||||
{
|
||||
for (std::set<uint32>::const_iterator itr = movementScriptSet.begin(); itr != movementScriptSet.end(); ++itr)
|
||||
sLog.outErrorDb("Table `creature_movement_scripts` contain unused script, id %u.", *itr);
|
||||
sLog.outErrorDb("Table `dbscripts_on_creature_movement` contain unused script, id %u.", *itr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -433,6 +433,10 @@ void WaypointManager::Unload()
|
|||
for (WaypointPathMap::iterator itr = m_pathMap.begin(); itr != m_pathMap.end(); ++itr)
|
||||
_clearPath(itr->second);
|
||||
m_pathMap.clear();
|
||||
|
||||
for (WaypointPathMap::iterator itr = m_pathTemplateMap.begin(); itr != m_pathTemplateMap.end(); ++itr)
|
||||
_clearPath(itr->second);
|
||||
m_pathTemplateMap.clear();
|
||||
}
|
||||
|
||||
void WaypointManager::_clearPath(WaypointPath& path)
|
||||
|
|
@ -556,93 +560,49 @@ void WaypointManager::SetNodeText(uint32 id, uint32 point, const char* text_fiel
|
|||
}
|
||||
}
|
||||
|
||||
void WaypointManager::CheckTextsExistance(std::set<int32>& ids)
|
||||
inline void CheckWPText(bool isTemplate, uint32 entryOrGuid, size_t point, WaypointBehavior* be, std::set<int32>& ids)
|
||||
{
|
||||
WaypointPathMap::const_iterator pmItr = m_pathMap.begin();
|
||||
for (; pmItr != m_pathMap.end(); ++pmItr)
|
||||
int zeroCount = 0; // Counting leading zeros for futher textid shift
|
||||
for (int j = 0; j < MAX_WAYPOINT_TEXT; ++j)
|
||||
{
|
||||
for (size_t i = 0; i < pmItr->second.size(); ++i)
|
||||
if (!be->textid[j])
|
||||
{
|
||||
WaypointBehavior* be = pmItr->second[i].behavior;
|
||||
if (!be)
|
||||
continue;
|
||||
|
||||
// Now we check text existence and put all zero texts ids to the end of array
|
||||
|
||||
// Counting leading zeros for futher textid shift
|
||||
int zeroCount = 0;
|
||||
for (int j = 0; j < MAX_WAYPOINT_TEXT; ++j)
|
||||
{
|
||||
if (!be->textid[j])
|
||||
{
|
||||
++zeroCount;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sObjectMgr.GetMangosStringLocale(be->textid[j]))
|
||||
{
|
||||
sLog.outErrorDb("Some waypoint has textid%u with not existing %u text.", j, be->textid[j]);
|
||||
be->textid[j] = 0;
|
||||
++zeroCount;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ids.erase(be->textid[j]);
|
||||
|
||||
// Shifting check
|
||||
if (zeroCount)
|
||||
{
|
||||
// Correct textid but some zeros leading, so move it forward.
|
||||
be->textid[j - zeroCount] = be->textid[j];
|
||||
be->textid[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
++zeroCount;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
WaypointPathTemplateMap::const_iterator wptItr = m_pathTemplateMap.begin();
|
||||
for (; wptItr != m_pathTemplateMap.end(); ++wptItr)
|
||||
{
|
||||
for (size_t i = 0; i < wptItr->second.size(); ++i)
|
||||
if (!sObjectMgr.GetMangosStringLocale(be->textid[j]))
|
||||
{
|
||||
WaypointBehavior* be = wptItr->second[i].behavior;
|
||||
if (!be)
|
||||
continue;
|
||||
sLog.outErrorDb("Table `creature_movement%s %u, PointId %u has textid%u with non existing textid %i.",
|
||||
isTemplate ? "_template` Entry:" : "` Id:", entryOrGuid, point + 1, j, be->textid[j]);
|
||||
be->textid[j] = 0;
|
||||
++zeroCount;
|
||||
continue;
|
||||
}
|
||||
ids.erase(uint32(be->textid[j]));
|
||||
|
||||
// Now we check text existence and put all zero texts ids to the end of array
|
||||
|
||||
// Counting leading zeros for futher textid shift
|
||||
int zeroCount = 0;
|
||||
for (int j = 0; j < MAX_WAYPOINT_TEXT; ++j)
|
||||
{
|
||||
if (!be->textid[j])
|
||||
{
|
||||
++zeroCount;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sObjectMgr.GetMangosStringLocale(be->textid[j]))
|
||||
{
|
||||
sLog.outErrorDb("Some waypoint has textid%u with not existing %u text.", j, be->textid[j]);
|
||||
be->textid[j] = 0;
|
||||
++zeroCount;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ids.erase(be->textid[j]);
|
||||
|
||||
// Shifting check
|
||||
if (zeroCount)
|
||||
{
|
||||
// Correct textid but some zeros leading, so move it forward.
|
||||
be->textid[j - zeroCount] = be->textid[j];
|
||||
be->textid[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Shifting check
|
||||
if (zeroCount)
|
||||
{
|
||||
// Correct textid but some zeros leading, so move it forward.
|
||||
be->textid[j - zeroCount] = be->textid[j];
|
||||
be->textid[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaypointManager::CheckTextsExistance(std::set<int32>& ids)
|
||||
{
|
||||
for (WaypointPathMap::const_iterator pmItr = m_pathMap.begin(); pmItr != m_pathMap.end(); ++pmItr)
|
||||
{
|
||||
for (size_t i = 0; i < pmItr->second.size(); ++i)
|
||||
if (pmItr->second[i].behavior)
|
||||
CheckWPText(false, pmItr->first, i, pmItr->second[i].behavior, ids);
|
||||
}
|
||||
|
||||
for (WaypointPathMap::const_iterator wptItr = m_pathTemplateMap.begin(); wptItr != m_pathTemplateMap.end(); ++wptItr)
|
||||
{
|
||||
for (size_t i = 0; i < wptItr->second.size(); ++i)
|
||||
if (wptItr->second[i].behavior)
|
||||
CheckWPText(true, wptItr->first, i, wptItr->second[i].behavior, ids);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue