mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[6989] Always initilize WaypointBehavior pointer to NULL in WaypointNode. Small code Cleanup.
This commit is contained in:
parent
61063ad94c
commit
151e9e7012
3 changed files with 11 additions and 10 deletions
|
|
@ -300,7 +300,8 @@ void WaypointManager::CheckTextsExistance(std::set<int32>& ids)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < pmItr->second.size(); ++i)
|
for (int i = 0; i < pmItr->second.size(); ++i)
|
||||||
{
|
{
|
||||||
if (!pmItr->second[i].behavior)
|
WaypointBehavior* be = pmItr->second[i].behavior;
|
||||||
|
if (!be)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Now we check text existence and put all zero texts ids to the end of array
|
// Now we check text existence and put all zero texts ids to the end of array
|
||||||
|
|
@ -309,29 +310,29 @@ void WaypointManager::CheckTextsExistance(std::set<int32>& ids)
|
||||||
int zeroCount = 0;
|
int zeroCount = 0;
|
||||||
for (int j = 0; j < MAX_WAYPOINT_TEXT; ++j)
|
for (int j = 0; j < MAX_WAYPOINT_TEXT; ++j)
|
||||||
{
|
{
|
||||||
if (!pmItr->second[i].behavior->textid[j])
|
if (!be->textid[j])
|
||||||
{
|
{
|
||||||
++zeroCount;
|
++zeroCount;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!objmgr.GetMangosStringLocale(pmItr->second[i].behavior->textid[j]))
|
if (!objmgr.GetMangosStringLocale(be->textid[j]))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("ERROR: Some waypoint has textid%u with not existing %u text.", j, pmItr->second[i].behavior->textid[j]);
|
sLog.outErrorDb("ERROR: Some waypoint has textid%u with not existing %u text.", j, be->textid[j]);
|
||||||
pmItr->second[i].behavior->textid[j] = 0;
|
be->textid[j] = 0;
|
||||||
++zeroCount;
|
++zeroCount;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ids.erase(pmItr->second[i].behavior->textid[j]);
|
ids.erase(be->textid[j]);
|
||||||
|
|
||||||
// Shifting check
|
// Shifting check
|
||||||
if (zeroCount)
|
if (zeroCount)
|
||||||
{
|
{
|
||||||
// Correct textid but some zeros leading, so move it forward.
|
// Correct textid but some zeros leading, so move it forward.
|
||||||
pmItr->second[i].behavior->textid[j-zeroCount] = pmItr->second[i].behavior->textid[j];
|
be->textid[j-zeroCount] = be->textid[j];
|
||||||
pmItr->second[i].behavior->textid[j] = 0;
|
be->textid[j] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ struct WaypointNode
|
||||||
float orientation;
|
float orientation;
|
||||||
uint32 delay;
|
uint32 delay;
|
||||||
WaypointBehavior * behavior;
|
WaypointBehavior * behavior;
|
||||||
WaypointNode() {}
|
WaypointNode() : x(0.0f), y(0.0f), z(0.0f), orientation(0.0f), delay(0), behavior(NULL) {}
|
||||||
WaypointNode(float _x, float _y, float _z, float _o, uint32 _delay, WaypointBehavior * _behavior)
|
WaypointNode(float _x, float _y, float _z, float _o, uint32 _delay, WaypointBehavior * _behavior)
|
||||||
: x(_x), y(_y), z(_z), orientation(_o), delay(_delay), behavior(_behavior) {}
|
: x(_x), y(_y), z(_z), orientation(_o), delay(_delay), behavior(_behavior) {}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6988"
|
#define REVISION_NR "6989"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue