fixed duplicate names after multiple level changes
This commit is contained in:
parent
5e73326033
commit
eab08307da
3 changed files with 52 additions and 8 deletions
|
|
@ -941,12 +941,13 @@ PriorityQueue::PriorityQueue (void)
|
|||
{
|
||||
m_size = 0;
|
||||
m_heapSize = MAX_WAYPOINTS * 4;
|
||||
m_heap = new HeapNode_t[sizeof (HeapNode_t) * m_heapSize];
|
||||
m_heap = (HeapNode_t *) malloc (sizeof (HeapNode_t) * m_heapSize);
|
||||
}
|
||||
|
||||
PriorityQueue::~PriorityQueue (void)
|
||||
{
|
||||
delete [] m_heap;
|
||||
free (m_heap);
|
||||
|
||||
m_heap = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1149,7 +1150,7 @@ int gfunctionKillsCTWithHostage (int currentIndex, int parentIndex)
|
|||
Path *current = g_waypoint->GetPath (currentIndex);
|
||||
|
||||
if (current->flags & FLAG_NOHOSTAGE)
|
||||
return 65536;
|
||||
return 65355;
|
||||
|
||||
else if (current->flags & (FLAG_CROUCH | FLAG_LADDER))
|
||||
return gfunctionKillsDistCT (currentIndex, parentIndex) * 500;
|
||||
|
|
@ -1157,6 +1158,40 @@ int gfunctionKillsCTWithHostage (int currentIndex, int parentIndex)
|
|||
return gfunctionKillsCT (currentIndex, parentIndex);
|
||||
}
|
||||
|
||||
int gfunctionPathDist (int currentIndex, int parentIndex)
|
||||
{
|
||||
if (parentIndex == -1)
|
||||
return 0;
|
||||
|
||||
Path *parent = g_waypoint->GetPath (parentIndex);
|
||||
Path *current = g_waypoint->GetPath (currentIndex);
|
||||
|
||||
for (int i = 0; i < MAX_PATH_INDEX; i++)
|
||||
{
|
||||
if (parent->index[i] == currentIndex)
|
||||
{
|
||||
// we don't like ladder or crouch point
|
||||
if (current->flags & (FLAG_CROUCH | FLAG_LADDER))
|
||||
return parent->distances[i] * 1.5;
|
||||
|
||||
return parent->distances[i];
|
||||
}
|
||||
}
|
||||
return 65355;
|
||||
}
|
||||
|
||||
int gfunctionPathDistWithHostage (int currentIndex, int parentIndex)
|
||||
{
|
||||
Path *current = g_waypoint->GetPath (currentIndex);
|
||||
|
||||
if (current->flags & FLAG_NOHOSTAGE)
|
||||
return 65355;
|
||||
else if (current->flags & (FLAG_CROUCH | FLAG_LADDER))
|
||||
return gfunctionPathDist (currentIndex, parentIndex) * 500;
|
||||
|
||||
return gfunctionPathDist (currentIndex, parentIndex);
|
||||
}
|
||||
|
||||
int hfunctionSquareDist (int startIndex, int goalIndex)
|
||||
{
|
||||
// square distance heuristic
|
||||
|
|
@ -1186,6 +1221,12 @@ int hfunctionNone (int startIndex, int goalIndex)
|
|||
return hfunctionSquareDist (startIndex, goalIndex) / (128 * 10);
|
||||
}
|
||||
|
||||
int hfunctionNumberNodes (int startIndex, int goalIndex)
|
||||
{
|
||||
return hfunctionSquareDist (startIndex, goalIndex) / 128 * g_highestKills;
|
||||
}
|
||||
|
||||
|
||||
void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType)
|
||||
{
|
||||
// this function finds a path from srcIndex to destIndex
|
||||
|
|
@ -1236,12 +1277,12 @@ void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType)
|
|||
case 0:
|
||||
if ((g_mapType & MAP_CS) && HasHostage ())
|
||||
{
|
||||
gcalc = hfunctionNone;
|
||||
gcalc = gfunctionPathDistWithHostage;
|
||||
hcalc = hfunctionSquareDistWithHostage;
|
||||
}
|
||||
else
|
||||
{
|
||||
gcalc = hfunctionNone;
|
||||
gcalc = gfunctionPathDist;
|
||||
hcalc = hfunctionSquareDist;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue