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

Method process

plugins/rabidRabbit/rabidRabbit.cpp:253–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251
252
253void RabidRabbitEventHandler::process(bz_EventData* eventData) {
254 if ((eventData->eventType != bz_eTickEvent) || (zoneList.size() < 2)) {
255 return;
256 }
257
258 for (unsigned int i = 0; i < zoneList.size(); i++) {
259 if (!zoneList[i].WWFired && rrzoneinfo.currentKillZone == i) {
260 bz_fireWorldWep(zoneList[i].WW.c_str(), zoneList[i].WWLifetime, zoneList[i].WWPosition, zoneList[i].WWTilt,
261 zoneList[i].WWDirection, zoneList[i].WWShotID, zoneList[i].WWDT);
262 zoneList[i].WWFired = true;
263 zoneList[i].WWLastFired = bz_getCurrentTime();
264 }
265 else {
266 if ((bz_getCurrentTime() - zoneList[i].WWLastFired) > zoneList[i].WWRepeat) {
267 zoneList[i].WWFired = false;
268 }
269 }
270 }
271
272
273 bz_APIIntList* playerList = bz_newIntList();
274 bz_getPlayerIndexList(playerList);
275
276 for (unsigned int h = 0; h < playerList->size(); h++) {
277 bz_BasePlayerRecord* player = bz_getPlayerByIndex(playerList->operator[](h));
278
279 if (player) {
280
281 for (unsigned int i = 0; i < zoneList.size(); i++) {
282 if (zoneList[i].pointIn(player->currentState.pos) && player->spawned && player->team == eRabbitTeam
283 && rrzoneinfo.currentKillZone != i && !rrzoneinfo.rabbitNotifiedWrongZone) {
284 bz_sendTextMessage(BZ_SERVER, player->playerID, "You are not in the current Rabid Rabbit zone - try another.");
285 rrzoneinfo.rabbitNotifiedWrongZone = true;
286 rrzoneinfo.rabbitNotifiedWrongZoneNum = i;
287 }
288
289 if (!zoneList[i].pointIn(player->currentState.pos) && player->spawned && player->team == eRabbitTeam
290 && rrzoneinfo.rabbitNotifiedWrongZone && rrzoneinfo.rabbitNotifiedWrongZoneNum == i) {
291 rrzoneinfo.rabbitNotifiedWrongZone = false;
292 }
293
294 if (zoneList[i].pointIn(player->currentState.pos) && player->spawned && player->team == eRabbitTeam
295 && rrzoneinfo.currentKillZone == i && bz_getTeamCount(eHunterTeam) > 0) {
296 killAllHunters(zoneList[i].servermessage);
297
298 rrzoneinfo.rabbitNotifiedWrongZone = true;
299 rrzoneinfo.rabbitNotifiedWrongZoneNum = i;
300
301 if (i == (zoneList.size() - 1)) {
302 rrzoneinfo.currentKillZone = 0;
303 }
304 else {
305 rrzoneinfo.currentKillZone++;
306 }
307
308 rrzoneinfo.rabbitNotifiedWrongZone = true;
309 rrzoneinfo.rabbitNotifiedWrongZoneNum = i;
310 }

Callers

nothing calls this directly

Calls 13

bz_fireWorldWepFunction · 0.85
bz_getCurrentTimeFunction · 0.85
bz_getPlayerIndexListFunction · 0.85
bz_sendTextMessageFunction · 0.85
bz_getTeamCountFunction · 0.85
killAllHuntersFunction · 0.85
bz_killPlayerFunction · 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