a little cleanup
fixed pvs-studio generated warnings fixed makefile remove vc debug symbols
This commit is contained in:
parent
eab08307da
commit
7d5d5ce81a
7 changed files with 29 additions and 57 deletions
|
|
@ -1015,9 +1015,6 @@ public:
|
|||
{
|
||||
T *entry = new T ();
|
||||
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
|
||||
return Link (entry, next);
|
||||
}
|
||||
|
||||
|
|
@ -1167,7 +1164,6 @@ public:
|
|||
//
|
||||
void Destory (void)
|
||||
{
|
||||
if (m_elements != NULL)
|
||||
delete [] m_elements;
|
||||
|
||||
m_elements = NULL;
|
||||
|
|
@ -1216,9 +1212,6 @@ public:
|
|||
|
||||
T *buffer = new T[checkSize];
|
||||
|
||||
if (buffer == NULL)
|
||||
return false;
|
||||
|
||||
if (keepData && m_elements != NULL)
|
||||
{
|
||||
if (checkSize < m_itemCount)
|
||||
|
|
@ -1571,16 +1564,11 @@ public:
|
|||
|
||||
T *buffer = new T[m_itemCount];
|
||||
|
||||
if (buffer == NULL)
|
||||
return;
|
||||
|
||||
if (m_elements != NULL)
|
||||
{
|
||||
for (int i = 0; i < m_itemCount; i++)
|
||||
buffer[i] = m_elements[i];
|
||||
}
|
||||
|
||||
if (m_elements != NULL)
|
||||
delete [] m_elements;
|
||||
|
||||
m_elements = buffer;
|
||||
|
|
@ -2498,21 +2486,6 @@ public:
|
|||
return &m_bufferPtr[0];
|
||||
}
|
||||
|
||||
//
|
||||
// Function: ToString
|
||||
// Gets the string buffer.
|
||||
//
|
||||
// Returns:
|
||||
// Pointer to buffer.
|
||||
//
|
||||
const char *ToString (void)
|
||||
{
|
||||
if (m_bufferPtr == NULL || *m_bufferPtr == 0x0)
|
||||
return "";
|
||||
|
||||
return &m_bufferPtr[0];
|
||||
}
|
||||
|
||||
//
|
||||
// Function: ToString
|
||||
// Gets the string buffer (constant).
|
||||
|
|
@ -3761,9 +3734,9 @@ public:
|
|||
// Returns:
|
||||
// True if operation succeeded, false otherwise.
|
||||
//
|
||||
bool Open (String fileName, String mode)
|
||||
bool Open (const String &fileName, const String &mode)
|
||||
{
|
||||
if ((m_handle = fopen (fileName, mode)) == NULL)
|
||||
if ((m_handle = fopen (fileName.GetBuffer (), mode.GetBuffer ())) == NULL)
|
||||
return false;
|
||||
|
||||
fseek (m_handle, 0L, SEEK_END);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -36,7 +36,7 @@ OBJ = ${SYSTEM}/basecode.o \
|
|||
${SYSTEM}/support.o \
|
||||
${SYSTEM}/waypoint.o \
|
||||
|
||||
CCOPT = -w -O3 -m32 -s -DNDEBUG=1 -fno-exceptions -fno-rtti -funroll-loops -fomit-frame-pointer -pipe -fvisibility-inlines-hidden -fvisibility=hidden
|
||||
CCOPT = -w -O3 -m32 -s -DNDEBUG=1 -ffast-math -fno-exceptions -fno-rtti -funroll-loops -fomit-frame-pointer -pipe -fvisibility-inlines-hidden -fvisibility=hidden
|
||||
CCDEBUG = -ggdb -w -DDEBUG=1 -fpermissive
|
||||
|
||||
CFLAGS = $(CCOPT) -I../include/engine -I../include
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <../include/resource.h>
|
||||
|
||||
// generated by update tool -- do not edit --
|
||||
#define PRODUCT_BUILD_TOOL 3850
|
||||
#define PRODUCT_BUILD_TOOL 2542
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PRODUCT_VERSION_DWORD, PRODUCT_BUILD_TOOL
|
||||
|
|
|
|||
|
|
@ -220,7 +220,6 @@
|
|||
<InterproceduralOptimization>SingleFile</InterproceduralOptimization>
|
||||
<FlushDenormalResultsToZero>true</FlushDenormalResultsToZero>
|
||||
<Parallelization>false</Parallelization>
|
||||
<Optimization>MaxSpeedHighLevel</Optimization>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
|
|
|||
|
|
@ -442,13 +442,13 @@ void BotManager::FillServer (int selection, int personality, int skill, int numT
|
|||
|
||||
if (skill >= 0 && skill <= 20)
|
||||
randomizedSkill = g_randGen.Long (0, 20);
|
||||
else if (skill >= 20 && skill <= 40)
|
||||
else if (skill > 20 && skill <= 40)
|
||||
randomizedSkill = g_randGen.Long (20, 40);
|
||||
else if (skill >= 40 && skill <= 60)
|
||||
else if (skill > 40 && skill <= 60)
|
||||
randomizedSkill = g_randGen.Long (40, 60);
|
||||
else if (skill >= 60 && skill <= 80)
|
||||
else if (skill > 60 && skill <= 80)
|
||||
randomizedSkill = g_randGen.Long (60, 80);
|
||||
else if (skill >= 80 && skill <= 99)
|
||||
else if (skill > 80 && skill <= 99)
|
||||
randomizedSkill = g_randGen.Long (80, 99);
|
||||
else if (skill == 100)
|
||||
randomizedSkill = skill;
|
||||
|
|
|
|||
|
|
@ -1052,7 +1052,7 @@ int gfunctionKillsDistT (int currentIndex, int parentIndex)
|
|||
cost *= 2;
|
||||
|
||||
if (parentIndex < 0 || parentIndex > g_numWaypoints || parentIndex == currentIndex)
|
||||
return cost * ((yb_danger_factor.GetInt () * 20 / (2 * g_highestDamageT)));
|
||||
return cost * (yb_danger_factor.GetInt () * 20 / (2 * g_highestDamageT));
|
||||
|
||||
return g_waypoint->GetPathDistance (parentIndex, currentIndex) + (cost * 10 * yb_danger_factor.GetInt ());
|
||||
}
|
||||
|
|
@ -1079,7 +1079,7 @@ int gfunctionKillsDistCT (int currentIndex, int parentIndex)
|
|||
cost *= 2;
|
||||
|
||||
if (parentIndex < 0 || parentIndex > g_numWaypoints || parentIndex == currentIndex)
|
||||
return cost * ((yb_danger_factor.GetInt () * 20 / (2 * g_highestDamageCT)));
|
||||
return cost * (yb_danger_factor.GetInt () * 20 / (2 * g_highestDamageCT));
|
||||
|
||||
return g_waypoint->GetPathDistance (parentIndex, currentIndex) + (cost * 10 * yb_danger_factor.GetInt ());
|
||||
}
|
||||
|
|
@ -1091,7 +1091,7 @@ int gfunctionKillsDistCTWithHostage (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;
|
||||
|
|
@ -1192,38 +1192,38 @@ int gfunctionPathDistWithHostage (int currentIndex, int parentIndex)
|
|||
return gfunctionPathDist (currentIndex, parentIndex);
|
||||
}
|
||||
|
||||
int hfunctionSquareDist (int startIndex, int goalIndex)
|
||||
int hfunctionSquareDist (int index, int, int goalIndex)
|
||||
{
|
||||
// square distance heuristic
|
||||
|
||||
Path *start = g_waypoint->GetPath (startIndex);
|
||||
Path *start = g_waypoint->GetPath (index);
|
||||
Path *goal = g_waypoint->GetPath (goalIndex);
|
||||
|
||||
float deltaX = fabsf (goal->origin.x - start->origin.x);
|
||||
float deltaY = fabsf (goal->origin.y - start->origin.y);
|
||||
float deltaZ = fabsf (goal->origin.z - start->origin.z);
|
||||
float deltaX = fabsf (start->origin.x - goal->origin.x);
|
||||
float deltaY = fabsf (start->origin.y - goal->origin.y);
|
||||
float deltaZ = fabsf (start->origin.z - goal->origin.z);
|
||||
|
||||
return static_cast <int> (deltaX + deltaY + deltaZ);
|
||||
}
|
||||
|
||||
int hfunctionSquareDistWithHostage (int startIndex, int goalIndex)
|
||||
int hfunctionSquareDistWithHostage (int index, int startIndex, int goalIndex)
|
||||
{
|
||||
// square distance heuristic with hostages
|
||||
|
||||
if (g_waypoint->GetPath (startIndex)->flags & FLAG_NOHOSTAGE)
|
||||
return 65536;
|
||||
|
||||
return hfunctionSquareDist (startIndex, goalIndex);
|
||||
return hfunctionSquareDist (index, startIndex, goalIndex);
|
||||
}
|
||||
|
||||
int hfunctionNone (int startIndex, int goalIndex)
|
||||
int hfunctionNone (int index, int startIndex, int goalIndex)
|
||||
{
|
||||
return hfunctionSquareDist (startIndex, goalIndex) / (128 * 10);
|
||||
return hfunctionSquareDist (index, startIndex, goalIndex) / (128 * 10);
|
||||
}
|
||||
|
||||
int hfunctionNumberNodes (int startIndex, int goalIndex)
|
||||
int hfunctionNumberNodes (int index, int startIndex, int goalIndex)
|
||||
{
|
||||
return hfunctionSquareDist (startIndex, goalIndex) / 128 * g_highestKills;
|
||||
return hfunctionSquareDist (index, startIndex, goalIndex) / 128 * g_highestKills;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1270,7 +1270,7 @@ void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType)
|
|||
}
|
||||
|
||||
int (*gcalc) (int, int) = NULL;
|
||||
int (*hcalc) (int, int) = NULL;
|
||||
int (*hcalc) (int, int, int) = NULL;
|
||||
|
||||
switch (pathType)
|
||||
{
|
||||
|
|
@ -1326,7 +1326,7 @@ void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType)
|
|||
|
||||
// put start node into open list
|
||||
astar[srcIndex].g = gcalc (srcIndex, -1);
|
||||
astar[srcIndex].f = astar[srcIndex].g + hcalc (srcIndex, destIndex);
|
||||
astar[srcIndex].f = astar[srcIndex].g + hcalc (srcIndex, srcIndex, destIndex);
|
||||
astar[srcIndex].state = OPEN;
|
||||
|
||||
openList.Insert (srcIndex, astar[srcIndex].g);
|
||||
|
|
@ -1374,7 +1374,7 @@ void Bot::FindPath (int srcIndex, int destIndex, unsigned char pathType)
|
|||
|
||||
// calculate the F value as F = G + H
|
||||
int g = astar[currentIndex].g + gcalc (currentChild, currentIndex);
|
||||
int h = hcalc (srcIndex, destIndex);
|
||||
int h = hcalc (currentChild, srcIndex, destIndex);
|
||||
int f = g + h;
|
||||
|
||||
if (astar[currentChild].state == NEW || astar[currentChild].f > f)
|
||||
|
|
@ -1989,7 +1989,7 @@ bool Bot::HeadTowardWaypoint (void)
|
|||
m_campButtons = 0;
|
||||
|
||||
int waypoint = m_navNode->next->index;
|
||||
int kills = 0;
|
||||
float kills = 0;
|
||||
|
||||
if (GetTeam (GetEntity ()) == TEAM_TF)
|
||||
kills = (g_experienceData + (waypoint * g_numWaypoints) + waypoint)->team0Damage / g_highestDamageT;
|
||||
|
|
@ -2010,7 +2010,7 @@ bool Bot::HeadTowardWaypoint (void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (m_baseAgressionLevel < static_cast <float> (kills) && GetTaskId () != TASK_MOVETOPOSITION && HasPrimaryWeapon ())
|
||||
if (m_baseAgressionLevel < kills && GetTaskId () != TASK_MOVETOPOSITION && HasPrimaryWeapon ())
|
||||
{
|
||||
StartTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + (m_fearLevel * (g_timeRoundMid - GetWorldTime ()) * 0.5), true); // push camp task on to stack
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue