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

Function findRandomUnplayedGame

plugins/mapchange/mapchange.cpp:272–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272int findRandomUnplayedGame(void) {
273 int count = 1;
274
275 int randGame = rand() % (int)gameList.size();
276
277 while (gameList[randGame].hasBeenPlayed || count < (int)gameList.size()) {
278 count++;
279 randGame = rand() % (int)gameList.size();
280 }
281
282 if (count >= (int)gameList.size()) {
283 return -1;
284 }
285
286 return randGame;
287}
288
289void sendMapChangeMessage(bool end) {
290 std::string message = "Map change!\n";

Callers 1

nextMapFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected