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

Function nextMap

plugins/mapchange/mapchange.cpp:309–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void nextMap(void) {
310 bool shutdown = false;
311 // compute the next map, and set the index
312 switch (cycleMode) {
313 case eLoopInf:
314 currentIndex++;
315 if (currentIndex >= (int)gameList.size()) {
316 resetGames();
317 currentIndex = 0;
318 }
319 break;
320 case eRandomInf:
321 currentIndex = findRandomUnplayedGame();
322 if (currentIndex < 0) {
323 resetGames();
324 currentIndex = findRandomUnplayedGame();
325 }
326 break;
327
328 case eRandomOnce:
329 currentIndex = findRandomUnplayedGame();
330 if (currentIndex < 0) {
331 shutdown = true;
332 currentIndex = -1;
333 }
334 break;
335
336 case eNoLoop:
337 currentIndex++;
338 if (currentIndex >= (int)gameList.size()) {
339 shutdown = true;
340 currentIndex = 0;
341 }
342 break;
343 }
344
345 sendMapChangeMessage(shutdown);
346
347 if (shutdown) {
348 bz_shutdown();
349 }
350 else {
351 bz_restart();
352 }
353
354 startTime = -1;
355}
356
357void MapChangeEventHandler::process(bz_EventData* eventData) {
358 if (!eventData) {

Callers 2

processMethod · 0.85
handleMethod · 0.85

Calls 6

resetGamesFunction · 0.85
findRandomUnplayedGameFunction · 0.85
sendMapChangeMessageFunction · 0.85
bz_shutdownFunction · 0.85
bz_restartFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected