TallerGrupo4/TPWorms

Falta el reap dead equivalente al de la clase Server

Closed this issue · 0 comments

Tal como no queremos que el vector de usuarios crezca indefinidamente, lo mismo queremos con las partidas. Habría que joinear a las partidas terminadas.

void MonitorMatches::start_match(uint match_id, std::string map_name) {
std::unique_lock<std::mutex> lock(m);
if (matches.find(match_id) == matches.end())
throw MatchNotFound();
if (matches[match_id]->has_started())
throw MatchAlreadyStarted();
// Map's key should be a string but for now it is an uint
// Check if map exists
uint map_name_int = std::stoi(map_name);
if (maps.find(std::stoi(map_name)) == maps.end())
throw MapNotFound();
matches[match_id]->start_game(maps.at(map_name_int));
}