fix: do not update fakeclient bit on every frame
cfg: allow bots to have name with at least one character
This commit is contained in:
parent
ccfbb5479d
commit
c298e607ae
4 changed files with 8 additions and 9 deletions
|
|
@ -152,7 +152,7 @@ public:
|
|||
return m_lastWinner;
|
||||
}
|
||||
|
||||
int32_t getBotCount () {
|
||||
int32_t getBotCount () const {
|
||||
return m_bots.length <int32_t> ();
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ public:
|
|||
m_botsCanPause = pause;
|
||||
}
|
||||
|
||||
bool hasBombSay (int type) {
|
||||
bool hasBombSay (int type) const {
|
||||
return (m_bombSayStatus & type) == type;
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ public:
|
|||
}
|
||||
|
||||
// some bots are online ?
|
||||
bool hasBotsOnline () {
|
||||
bool hasBotsOnline () const {
|
||||
return getBotCount () > 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2832,8 +2832,6 @@ void Bot::checkParachute () {
|
|||
}
|
||||
|
||||
void Bot::frame () {
|
||||
pev->flags |= FL_FAKECLIENT; // restore fake client bit
|
||||
|
||||
if (m_updateTime <= game.time ()) {
|
||||
update ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ BotName *BotConfig::pickBotName () {
|
|||
for (size_t i = 0; i < m_botNames.length () * 2; ++i) {
|
||||
auto bn = &m_botNames.random ();
|
||||
|
||||
if (bn->name.length () < 3 || bn->usedBy != -1) {
|
||||
if (bn->name.empty () || bn->usedBy != -1) {
|
||||
continue;
|
||||
}
|
||||
return bn;
|
||||
|
|
|
|||
|
|
@ -263,7 +263,6 @@ BotCreateResult BotManager::create (StringRef name, int difficulty, int personal
|
|||
bot = engfuncs.pfnCreateFakeClient (resultName.chars ());
|
||||
|
||||
if (game.isNullEntity (bot)) {
|
||||
ctrl.msg ("Maximum players reached (%d/%d). Unable to create Bot.", game.maxClients (), game.maxClients ());
|
||||
return BotCreateResult::MaxPlayersReached;
|
||||
}
|
||||
auto object = cr::makeUnique <Bot> (bot, difficulty, personality, team, skin);
|
||||
|
|
@ -393,6 +392,8 @@ void BotManager::maintainQuota () {
|
|||
cv_quota.set (0); // reset quota
|
||||
}
|
||||
else if (createResult == BotCreateResult::MaxPlayersReached) {
|
||||
ctrl.msg ("Maximum players reached (%d/%d). Unable to create Bot.", game.maxClients (), game.maxClients ());
|
||||
|
||||
m_addRequests.clear (); // maximum players reached, so set quota to maximum players
|
||||
cv_quota.set (getBotCount ());
|
||||
}
|
||||
|
|
@ -1109,7 +1110,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int skin) {
|
|||
}
|
||||
|
||||
MDLL_ClientPutInServer (bot);
|
||||
bot->v.flags |= FL_FAKECLIENT; // set this player as fakeclient
|
||||
bot->v.flags |= FL_CLIENT | FL_FAKECLIENT; // set this player as fake client
|
||||
|
||||
// initialize all the variables for this bot...
|
||||
m_notStarted = true; // hasn't joined game yet
|
||||
|
|
@ -1612,7 +1613,7 @@ void Bot::newRound () {
|
|||
startTask (Task::Normal, TaskPri::Normal, kInvalidNodeIndex, 0.0f, true);
|
||||
|
||||
// restore fake client bit, just in case
|
||||
pev->flags |= FL_FAKECLIENT;
|
||||
pev->flags |= FL_CLIENT | FL_FAKECLIENT;
|
||||
|
||||
if (rg.chance (50)) {
|
||||
pushChatterMessage (Chatter::NewRound);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue