Do not buy secondary without enough money on not first round.
This commit is contained in:
parent
94b74e4705
commit
9720a63401
4 changed files with 12 additions and 8 deletions
|
|
@ -192,7 +192,9 @@ public:
|
||||||
|
|
||||||
class MemFile final : public DenyCopying {
|
class MemFile final : public DenyCopying {
|
||||||
private:
|
private:
|
||||||
static constexpr char kEOF = static_cast <char> (-1);
|
enum : char {
|
||||||
|
Eof = static_cast <char> (-1)
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8 *m_data = nullptr;
|
uint8 *m_data = nullptr;
|
||||||
|
|
@ -231,7 +233,7 @@ public:
|
||||||
|
|
||||||
char getChar () {
|
char getChar () {
|
||||||
if (!m_data || m_pos >= m_length) {
|
if (!m_data || m_pos >= m_length) {
|
||||||
return kEOF;
|
return Eof;
|
||||||
}
|
}
|
||||||
auto ch = m_data[m_pos];
|
auto ch = m_data[m_pos];
|
||||||
++m_pos;
|
++m_pos;
|
||||||
|
|
@ -266,7 +268,7 @@ public:
|
||||||
line.clear ();
|
line.clear ();
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
while ((ch = getChar ()) != kEOF) {
|
while ((ch = getChar ()) != Eof) {
|
||||||
line += ch;
|
line += ch;
|
||||||
|
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,9 @@ namespace detail {
|
||||||
// simple http client for downloading/uploading files only
|
// simple http client for downloading/uploading files only
|
||||||
class HttpClient final : public Singleton <HttpClient> {
|
class HttpClient final : public Singleton <HttpClient> {
|
||||||
private:
|
private:
|
||||||
static constexpr int32 kMaxRecvErrors = 12;
|
enum : int32 {
|
||||||
|
MaxReceiveErrors = 12
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Socket m_socket;
|
Socket m_socket;
|
||||||
|
|
@ -218,7 +220,7 @@ private:
|
||||||
// prase response header
|
// prase response header
|
||||||
while (!isFinished && pos < m_chunkSize) {
|
while (!isFinished && pos < m_chunkSize) {
|
||||||
if (m_socket.recv (&buffer[pos], 1) < 1) {
|
if (m_socket.recv (&buffer[pos], 1) < 1) {
|
||||||
if (++errors > kMaxRecvErrors) {
|
if (++errors > MaxReceiveErrors) {
|
||||||
isFinished = true;
|
isFinished = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -1496,7 +1496,7 @@ void Bot::buyStuff () {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuyState::SecondaryWeapon: // if bot has still some money, buy a better secondary weapon
|
case BuyState::SecondaryWeapon: // if bot has still some money, buy a better secondary weapon
|
||||||
if (isPistolMode || (isFirstRound && hasDefaultPistols) || (hasDefaultPistols && bots.getLastWinner () != m_team) || (hasPrimaryWeapon () && hasDefaultPistols && m_moneyAmount > rg.int_ (7500, 9000))) {
|
if (isPistolMode || (isFirstRound && hasDefaultPistols) || (hasDefaultPistols && bots.getLastWinner () == m_team && m_moneyAmount > rg.int_ (3500, 4500)) || (hasPrimaryWeapon () && hasDefaultPistols && m_moneyAmount > rg.int_ (7500, 9000))) {
|
||||||
do {
|
do {
|
||||||
pref--;
|
pref--;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#include <yapb.h>
|
#include <yapb.h>
|
||||||
|
|
||||||
ConVar yb_whose_your_daddy ("yb_whose_your_daddy", "0", "Enables or disables extra hard difficulty for bots.");
|
ConVar yb_whose_your_daddy ("yb_whose_your_daddy", "0", "Enables or disables extra hard difficulty for bots.");
|
||||||
ConVar yb_debug_heuristic_type ("yb_debug_heuristic_type", "4", "Selects the heuristic function mode. For debug purposes only.", true, 0.0f, 4.0f);
|
ConVar yb_debug_heuristic_type ("yb_debug_heuristic_type", "0", "Selects the heuristic function mode. For debug purposes only.", true, 0.0f, 4.0f);
|
||||||
|
|
||||||
int Bot::findBestGoal () {
|
int Bot::findBestGoal () {
|
||||||
|
|
||||||
|
|
@ -745,7 +745,7 @@ bool Bot::updateNavigation () {
|
||||||
|
|
||||||
edict_t *pent = nullptr;
|
edict_t *pent = nullptr;
|
||||||
|
|
||||||
if (m_tryOpenDoor++ > 2 && util.findNearestPlayer (reinterpret_cast <void **> (&pent), ent (), 256.0f, false, false, true, true, false)) {
|
if (++m_tryOpenDoor > 2 && util.findNearestPlayer (reinterpret_cast <void **> (&pent), ent (), 256.0f, false, false, true, true, false)) {
|
||||||
m_seeEnemyTime = game.time () - 0.5f;
|
m_seeEnemyTime = game.time () - 0.5f;
|
||||||
|
|
||||||
m_states |= Sense::SeeingEnemy;
|
m_states |= Sense::SeeingEnemy;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue