MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / killAllHunters

Function killAllHunters

plugins/rabidRabbit/rabidRabbit.cpp:222–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222void killAllHunters(std::string messagepass) {
223 bz_APIIntList* playerList = bz_newIntList();
224 bz_getPlayerIndexList(playerList);
225
226
227 for (unsigned int i = 0; i < playerList->size(); i++) {
228
229 bz_BasePlayerRecord* player = bz_getPlayerByIndex(playerList->operator[](i));
230
231 if (player) {
232 if (player->team != eRabbitTeam) {
233 bz_killPlayer(player->playerID, true, BZ_SERVER);
234 bz_sendTextMessage(BZ_SERVER, player->playerID, messagepass.c_str());
235 if (rrzoneinfo.soundEnabled) {
236 bz_sendPlayCustomLocalSound(player->playerID, "flag_lost");
237 }
238 }
239 if (player->team == eRabbitTeam && rrzoneinfo.soundEnabled && bz_getTeamCount(eHunterTeam) > 0) {
240 bz_sendPlayCustomLocalSound(player->playerID, "flag_won");
241 }
242
243 bz_freePlayerRecord(player);
244 }
245 }
246
247 bz_deleteIntList(playerList);
248
249 return;
250}
251
252
253void RabidRabbitEventHandler::process(bz_EventData* eventData) {

Callers 1

processMethod · 0.85

Calls 10

bz_getPlayerIndexListFunction · 0.85
bz_killPlayerFunction · 0.85
bz_sendTextMessageFunction · 0.85
bz_getTeamCountFunction · 0.85
bz_freePlayerRecordFunction · 0.85
bz_deleteIntListFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
operator[]Method · 0.45

Tested by

no test coverage detected