| 307 | } |
| 308 | |
| 309 | void 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 | |
| 357 | void MapChangeEventHandler::process(bz_EventData* eventData) { |
| 358 | if (!eventData) { |
no test coverage detected