diff --git a/include/corelib.h b/include/corelib.h
index 8ec6af4..6290e08 100644
--- a/include/corelib.h
+++ b/include/corelib.h
@@ -1015,9 +1015,6 @@ public:
{
T *entry = new T ();
- if (entry == NULL)
- return NULL;
-
return Link (entry, next);
}
@@ -1167,8 +1164,7 @@ public:
//
void Destory (void)
{
- if (m_elements != NULL)
- delete [] m_elements;
+ delete [] m_elements;
m_elements = NULL;
m_itemSize = 0;
@@ -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,17 +1564,12 @@ 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;
+ delete [] m_elements;
m_elements = buffer;
m_itemSize = m_itemCount;
@@ -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);
diff --git a/project/debug/inf.idb b/project/debug/inf.idb
deleted file mode 100644
index 88fb841..0000000
Binary files a/project/debug/inf.idb and /dev/null differ
diff --git a/project/makefile b/project/makefile
index 2015919..19c5656 100644
--- a/project/makefile
+++ b/project/makefile
@@ -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
diff --git a/project/yapb.rc b/project/yapb.rc
index 343ad66..03275b6 100644
--- a/project/yapb.rc
+++ b/project/yapb.rc
@@ -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
diff --git a/project/yapb.vcxproj b/project/yapb.vcxproj
index df69c5f..17b1187 100644
--- a/project/yapb.vcxproj
+++ b/project/yapb.vcxproj
@@ -220,7 +220,6 @@
SingleFile
true
false
- MaxSpeedHighLevel
NDEBUG;%(PreprocessorDefinitions)
diff --git a/source/botmanager.cpp b/source/botmanager.cpp
index 2059b10..7eddf87 100644
--- a/source/botmanager.cpp
+++ b/source/botmanager.cpp
@@ -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;
diff --git a/source/navigate.cpp b/source/navigate.cpp
index 04cd7d4..bee848a 100644
--- a/source/navigate.cpp
+++ b/source/navigate.cpp
@@ -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 (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 (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