Cosmetic change.

This commit is contained in:
jeefo 2019-09-22 00:39:24 +03:00
commit 70e0767ce0
2 changed files with 26 additions and 26 deletions

View file

@ -9,7 +9,7 @@
#pragma once #pragma once
// bot creation tab // bot creation tab
struct CreateQueue { struct BotRequest {
bool manual; bool manual;
int difficulty; int difficulty;
int team; int team;
@ -52,7 +52,7 @@ private:
Array <edict_t *> m_activeGrenades; // holds currently active grenades on the map Array <edict_t *> m_activeGrenades; // holds currently active grenades on the map
Array <edict_t *> m_intrestingEntities; // holds currently intresting entities on the map Array <edict_t *> m_intrestingEntities; // holds currently intresting entities on the map
SmallArray <CreateQueue> m_creationTab; // bot creation tab SmallArray <BotRequest> m_addRequests; // bot creation tab
SmallArray <BotTask> m_filters; // task filters SmallArray <BotTask> m_filters; // task filters
SmallArray <UniqueBot> m_bots; // all available bots SmallArray <UniqueBot> m_bots; // all available bots

View file

@ -59,7 +59,7 @@ BotManager::BotManager () {
} }
reset (); reset ();
m_creationTab.clear (); m_addRequests.clear ();
m_killerEntity = nullptr; m_killerEntity = nullptr;
initFilters (); initFilters ();
@ -272,34 +272,34 @@ void BotManager::frame () {
void BotManager::addbot (const String &name, int difficulty, int personality, int team, int member, bool manual) { void BotManager::addbot (const String &name, int difficulty, int personality, int team, int member, bool manual) {
// this function putting bot creation process to queue to prevent engine crashes // this function putting bot creation process to queue to prevent engine crashes
CreateQueue create {}; BotRequest request {};
// fill the holder // fill the holder
create.name = name; request.name = name;
create.difficulty = difficulty; request.difficulty = difficulty;
create.personality = personality; request.personality = personality;
create.team = team; request.team = team;
create.member = member; request.member = member;
create.manual = manual; request.manual = manual;
// put to queue // put to queue
m_creationTab.push (cr::move (create)); m_addRequests.push (cr::move (request));
} }
void BotManager::addbot (const String &name, const String &difficulty, const String &personality, const String &team, const String &member, bool manual) { void BotManager::addbot (const String &name, const String &difficulty, const String &personality, const String &team, const String &member, bool manual) {
// this function is same as the function above, but accept as parameters string instead of integers // this function is same as the function above, but accept as parameters string instead of integers
CreateQueue create {}; BotRequest request {};
const String &any = "*"; const String &any = "*";
create.name = (name.empty () || name == any) ? String ("\0") : name; request.name = (name.empty () || name == any) ? String ("\0") : name;
create.difficulty = (difficulty.empty () || difficulty == any) ? -1 : difficulty.int_ (); request.difficulty = (difficulty.empty () || difficulty == any) ? -1 : difficulty.int_ ();
create.team = (team.empty () || team == any) ? -1 : team.int_ (); request.team = (team.empty () || team == any) ? -1 : team.int_ ();
create.member = (member.empty () || member == any) ? -1 : member.int_ (); request.member = (member.empty () || member == any) ? -1 : member.int_ ();
create.personality = (personality.empty () || personality == any) ? -1 : personality.int_ (); request.personality = (personality.empty () || personality == any) ? -1 : personality.int_ ();
create.manual = manual; request.manual = manual;
m_creationTab.push (cr::move (create)); m_addRequests.push (cr::move (request));
} }
void BotManager::maintainQuota () { void BotManager::maintainQuota () {
@ -315,8 +315,8 @@ void BotManager::maintainQuota () {
} }
// bot's creation update // bot's creation update
if (!m_creationTab.empty () && m_maintainTime < game.time ()) { if (!m_addRequests.empty () && m_maintainTime < game.time ()) {
const CreateQueue &last = m_creationTab.pop (); const BotRequest &last = m_addRequests.pop ();
const BotCreateResult callResult = create (last.name, last.difficulty, last.personality, last.team, last.member); const BotCreateResult callResult = create (last.name, last.difficulty, last.personality, last.team, last.member);
if (last.manual) { if (last.manual) {
@ -325,17 +325,17 @@ void BotManager::maintainQuota () {
// check the result of creation // check the result of creation
if (callResult == BotCreateResult::GraphError) { if (callResult == BotCreateResult::GraphError) {
m_creationTab.clear (); // something wrong with graph, reset tab of creation m_addRequests.clear (); // something wrong with graph, reset tab of creation
yb_quota.set (0); // reset quota yb_quota.set (0); // reset quota
} }
else if (callResult == BotCreateResult::MaxPlayersReached) { else if (callResult == BotCreateResult::MaxPlayersReached) {
m_creationTab.clear (); // maximum players reached, so set quota to maximum players m_addRequests.clear (); // maximum players reached, so set quota to maximum players
yb_quota.set (getBotCount ()); yb_quota.set (getBotCount ());
} }
else if (callResult == BotCreateResult::TeamStacked) { else if (callResult == BotCreateResult::TeamStacked) {
ctrl.msg ("Could not add bot to the game: Team is stacked (to disable this check, set mp_limitteams and mp_autoteambalance to zero and restart the round)"); ctrl.msg ("Could not add bot to the game: Team is stacked (to disable this check, set mp_limitteams and mp_autoteambalance to zero and restart the round)");
m_creationTab.clear (); m_addRequests.clear ();
yb_quota.set (getBotCount ()); yb_quota.set (getBotCount ());
} }
m_maintainTime = game.time () + 0.10f; m_maintainTime = game.time () + 0.10f;
@ -466,7 +466,7 @@ void BotManager::initQuota () {
m_maintainTime = game.time () + yb_join_delay.float_ (); m_maintainTime = game.time () + yb_join_delay.float_ ();
m_quotaMaintainTime = game.time () + yb_join_delay.float_ (); m_quotaMaintainTime = game.time () + yb_join_delay.float_ ();
m_creationTab.clear (); m_addRequests.clear ();
} }
void BotManager::serverFill (int selection, int personality, int difficulty, int numToAdd) { void BotManager::serverFill (int selection, int personality, int difficulty, int numToAdd) {
@ -511,7 +511,7 @@ void BotManager::kickEveryone (bool instant, bool zeroQuota) {
bot->kick (); bot->kick ();
} }
} }
m_creationTab.clear (); m_addRequests.clear ();
} }
void BotManager::kickFromTeam (Team team, bool removeAll) { void BotManager::kickFromTeam (Team team, bool removeAll) {