MCPcopy Create free account
hub / github.com/assaultcube/AC / GetBotTeam

Method GetBotTeam

source/src/bot/botmanager.cpp:234–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234const char *CBotManager::GetBotTeam()
235{
236 int teamsize[2] = {0, 0};
237 int biggestTeam = 0;
238 if(team_isactive(player1->team))
239 {
240 teamsize[player1->team]++;
241 }
242 loopv(bots) if(bots[i] && team_isactive(bots[i]->team))
243 {
244 teamsize[bots[i]->team]++;
245 }
246 biggestTeam = teamsize[1] > teamsize[0];
247 return teamnames[biggestTeam ^ 1];
248
249 // Following code will never be executed.
250 // (bot teams aren't ready, we use normal teams instead)
251 const char *szOutput = NULL;
252 TMultiChoice<const char *> BotTeamChoices;
253 short ChoiceVal;
254
255 for(int j=0;j<m_sBotTeamCount;j++)
256 {
257 ChoiceVal = 50;
258 /* UNDONE?
259 loopv(bots)
260 {
261 if (bots[i] && (!strcasecmp(bots[i]->name, m_szBotNames[j])))
262 ChoiceVal -= 10;
263 }
264
265 if (!strcasecmp(player1->name, m_szBotNames[j]))
266 ChoiceVal -= 10;
267
268 if (ChoiceVal <= 0)
269 ChoiceVmonsterclearal = 1;*/
270
271 BotTeamChoices.Insert(m_szBotTeams[j], ChoiceVal);
272 }
273
274 // Couldn't find a selection?
275 if (!BotTeamChoices.GetSelection(szOutput))
276 szOutput = "b0t";
277
278 return szOutput;
279}
280
281void CBotManager::RenderBots()
282{

Callers 2

respawnselfFunction · 0.80
CreateBotMethod · 0.80

Calls 3

InsertMethod · 0.80
GetSelectionMethod · 0.80
loopvFunction · 0.70

Tested by

no test coverage detected