Bot: buying fix (thanks CYBERDEViL)
This commit is contained in:
parent
5b2c2df919
commit
cb9f360dd4
1 changed files with 13 additions and 0 deletions
|
@ -29,6 +29,14 @@ class csbot:bot
|
|||
virtual void(void) CreateObjective;
|
||||
virtual void(void) PostFrame;
|
||||
virtual void(void) WeaponThink;
|
||||
|
||||
/* Workaround:
|
||||
* gflags is not yet set when CSBot_BuyStart_Shop() or CreateObjective()
|
||||
* are called, so we back it up on PostFrame() and use that instead.
|
||||
* Known issues it solves:
|
||||
* - Check if the bot is in a Bomb Zone (gflags & GF_BOMBZONE)
|
||||
* - Check if the bot is in a Buy Zone (gflags & GF_BUYZONE) */
|
||||
int m_gflagsBackup;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -170,6 +178,7 @@ void
|
|||
csbot::PostFrame(void)
|
||||
{
|
||||
team = infokeyf(this, "*team");
|
||||
m_gflagsBackup = gflags;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -196,6 +205,7 @@ csbot::csbot(void)
|
|||
bot::bot();
|
||||
targetname = "_csbot_";
|
||||
team = infokeyf(this, "*team");
|
||||
m_gflagsBackup = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -243,6 +253,9 @@ CSBot_BuyStart_Shop(void)
|
|||
|
||||
pl.team = infokeyf(pl, "*team");
|
||||
|
||||
/* Workaround */
|
||||
pl.gflags = ((csbot)pl).m_gflagsBackup;
|
||||
|
||||
count = 0;
|
||||
while (done != 1) {
|
||||
int r = floor(random(1,17));
|
||||
|
|
Loading…
Reference in a new issue