qboolean _CheckMapVotes (void) { if (_iCheckMapVotes () == true) { gi.bprintf (PRINT_HIGH, "More than %i%% map votes reached.\n", (int) mapvote_pass->value); return true; } return false; }
qboolean _CheckMapVotes (void) { if (use_mapvote->value == 2 && !matchmode->value) //Change to voted map only at mapchange return false; if (_iCheckMapVotes() == true) { gi.bprintf (PRINT_HIGH, "More than %i%% map votes reached.\n", (int)mapvote_pass->value); return true; } return false; }
void _MapExitLevel (char *NextMap) { votelist_t *votemap = NULL; //Igor[Rock] BEGIN FILE *votefile; char buf[MAX_STR_LEN]; //Igor[Rock] END // If mapvote_next=1 and level has ended, ignore minimums required for mapvote. if( _iCheckMapVotes() || ((map_num_votes > 0) && mapvote_next && mapvote_next->value) ) { votemap = MapWithMostVotes (NULL); Q_strncpyz (NextMap, votemap->mapname, MAX_QPATH); gi.bprintf (PRINT_HIGH, "Next map was voted on and is %s.\n", NextMap); } //clear stats for (votemap = map_votes; votemap != NULL; votemap = votemap->next) { //Igor[Rock] BEGIN if (votemap->num_votes) { votemap->num_allvotes += votemap->num_votes; num_allvotes += votemap->num_votes; } if (Q_stricmp (level.mapname, votemap->mapname) == 0) { if (map_num_clients > 1) { if (votemap->num_allvotes < (map_num_clients / 2)) { num_allvotes -= votemap->num_allvotes; votemap->num_allvotes = 0; } else { num_allvotes -= (map_num_clients / 2); votemap->num_allvotes -= (map_num_clients / 2); } } else { if (votemap->num_allvotes) { num_allvotes--; votemap->num_allvotes--; } } } //Igor[Rock] END votemap->num_votes = 0; } //Igor[Rock] BEGIN // Save the actual votes to a file votefile = fopen (maplistpath, "w"); if (votefile != NULL) { sprintf (buf, "%d\n", num_allvotes); fputs (buf, votefile); for (votemap = map_votes; votemap != NULL; votemap = votemap->next) { sprintf (buf, "%s,%d\n", votemap->mapname, votemap->num_allvotes); fputs (buf, votefile); } fclose (votefile); } //Igor[Rock] END map_num_votes = 0; map_num_clients = 0; map_need_to_check_votes = true; }