/** Remove (eliminate) a kart from the race */ void World::eliminateKart(int kart_number, bool notify_of_elimination) { AbstractKart *kart = m_karts[kart_number]; // Display a message about the eliminated kart in the race gui if (notify_of_elimination) { for (KartList::iterator i = m_karts.begin(); i != m_karts.end(); i++ ) { if(!(*i)->getCamera()) continue; if(*i==kart) { m_race_gui->addMessage(_("You have been eliminated!"), *i, 2.0f); } else { m_race_gui->addMessage(_("'%s' has been eliminated.", core::stringw(kart->getName())), *i, 2.0f); } } // for i in kart } if(kart->getController()->isPlayerController()) { // Change the camera so that it will be attached to the leader // and facing backwards. Camera* camera=kart->getCamera(); camera->setMode(Camera::CM_LEADER_MODE); m_eliminated_players++; } // The kart can't be really removed from the m_kart array, since otherwise // a race can't be restarted. So it's only marked to be eliminated (and // ignored in all loops). Important:world->getCurrentNumKarts() returns // the number of karts still racing. This value can not be used for loops // over all karts, use race_manager->getNumKarts() instead! kart->eliminate(); m_eliminated_karts++; } // eliminateKart