- {
- int j;
- playercount = 0;
- for (i = 1; i < MAX_SCREENS; i++) if (Players[i].alive) {
- if (Players[i].team < 128) for (j = 1; j < i; j++)
- if (Players[j].alive
- && (Players[j].team == Players[i].team)) {
- playercount--;
- break;
- } //player of same team counted before
- playercount++;
- } //player alive
- } //count players
- } while (Game.started < 2 || playercount > 1 || Game.continuous);
+ CountPlayers();
+ if (Game.started < 1) {
+ if (playercount > 1) {
+ fprintf(stderr, "* Game (%010d) ready to start\n", Game.seed);
+ Game.started++;
+ } //give goahead
+ } //game not yet started
+ else {
+ if (playercount < 2) {
+ fprintf(stderr, "* Stopping game\n");
+ if (Game.seed) Game.seed++;
+ if (Game.started > 1) for (i = 1; i < MAX_SCREENS; i++)
+ if (Players[i].alive >= 0) {
+ Players[i].alive = 1;
+ Players[i].flags |= SCF_paused;
+ SendPacketTo(i, 0, NP_stop,
+ sizeof(Game.seed), &Game.seed);
+ } //transmit game stop and set players not ready
+ paused = 1;
+ Game.started = 0;
+ } //too few players for game
+ if (Game.started == 1 && !paused) {
+ Game.started++;
+ fprintf(stderr, "* Game starts\n");
+ for (i = 1; i < MAX_SCREENS; i++)
+ if (Players[i].alive > 0)
+ SendPacketTo(i, 0, NP_start, 0, NULL);
+ } //everybody ready to start
+ } //game (ready to) start(ed)
+ } while (1);