void TournamentTeam::create_spawn_points() throw (TournamentException) { for (GameObjects::iterator it = game_objects.begin(); it != game_objects.end(); it++) { GameObject *obj = *it; Object::ObjectType type = obj->object->get_type(); if (type == Object::ObjectTypeSpawnPointRed) { spawn_points_red.push_back(obj); } else if (type == Object::ObjectTypeSpawnPointBlue) { spawn_points_blue.push_back(obj); } } if (!spawn_points_red.size()) { throw TournamentException("Missing spawn points for " + team_red_name + " in this map."); } if (!spawn_points_blue.size()) { throw TournamentException("Missing spawn points for " + team_blue_name + " in this map."); } }
TournamentSR::TournamentSR(Resources& resources, Subsystem& subsystem, Gui *gui, ServerLogger *logger, const std::string& game_file, bool server, const std::string& map_name, Players& players, int duration, bool warmup) throw (TournamentException, ResourcesException) : Tournament(resources, subsystem, gui, logger, game_file, server, map_name, players, duration, warmup) { /* create spawn points */ create_spawn_points(); if (spawn_points.size() != 1) { throw TournamentException("Why more than one spawn point in this game mode?"); } /* setup tournament icon */ tournament_icon = resources.get_icon("hud_sr"); /* add all players into list */ for (Players::iterator it = players.begin(); it != players.end(); it++) { Player *p = *it; times_of_players.push_back(TimesOfPlayer(p)); } }