Fixed crash when playing soccer with a minimap (thanks WillemS for the bug report) + fixed tracks screen displaying soccer field when it shouldn't

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/christmas@12317 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
funto66
2012-12-29 17:44:56 +00:00
parent 6b6cc75cde
commit be5f3e47e9
4 changed files with 18 additions and 6 deletions

View File

@@ -26,6 +26,7 @@
#include "karts/abstract_kart.hpp"
#include "karts/kart_model.hpp"
#include "karts/kart_properties.hpp"
#include "karts/rescue_animation.hpp"
#include "physics/physics.hpp"
#include "states_screens/race_gui_base.hpp"
#include "tracks/track.hpp"
@@ -50,7 +51,7 @@ void SoccerWorld::init()
WorldWithRank::init();
m_display_rank = false;
m_check_goals_enabled = true;
m_can_score_points = true;
// check for possible problems if AI karts were incorrectly added
if(getNumKarts() > race_manager->getNumPlayers())
@@ -103,7 +104,7 @@ void SoccerWorld::update(float dt)
void SoccerWorld::onCheckGoalTriggered(bool first_goal)
{
// TODO
if(m_check_goals_enabled)
if(m_can_score_points)
printf("*** GOOOOOOOOOAAAAAAALLLLLL!!!! (team: %d) ***\n", first_goal ? 0 : 1);
//m_check_goals_enabled = false; // TODO: remove?
@@ -122,6 +123,15 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
obj->reset();
}
//for(int i=0 ; i < getNumKarts() ; i++
/*if(World::getWorld()->getTrack()->isAutoRescueEnabled() &&
!getKartAnimation() && fabs(getRoll())>60*DEGREE_TO_RAD &&
fabs(getSpeed())<3.0f )
{
new RescueAnimation(this, true);
}*/
// TODO: rescue the karts
// TODO: score a point
}
@@ -190,6 +200,7 @@ bool SoccerWorld::isRaceOver()
return false;
}
// TODO
return getCurrentNumKarts()==1 || getCurrentNumPlayers()==0;
} // isRaceOver
@@ -200,7 +211,7 @@ bool SoccerWorld::isRaceOver()
*/
void SoccerWorld::terminateRace()
{
m_check_goals_enabled = false;
m_can_score_points = false;
updateKartRanks();
WorldWithRank::terminateRace();
} // terminateRace
@@ -212,7 +223,7 @@ void SoccerWorld::restartRace()
{
WorldWithRank::restartRace();
m_check_goals_enabled = true;
m_can_score_points = true;
const unsigned int kart_amount = m_karts.size();

View File

@@ -48,7 +48,7 @@ private:
/** Whether or not goals can be scored (they are disabled when a point is scored
and re-enabled when the next game can be played)*/
bool m_check_goals_enabled;
bool m_can_score_points;
public:

View File

@@ -259,7 +259,7 @@ void MinimalRaceGUI::drawGlobalMiniMap()
{
World *world = World::getWorld();
// arenas currently don't have a map.
if(world->getTrack()->isArena()) return;
if(world->getTrack()->isArena() || world->getTrack()->isSoccer()) return;
const video::ITexture *mini_map = world->getTrack()->getMiniMap();

View File

@@ -314,6 +314,7 @@ void TracksScreen::buildTrackList()
{
Track* curr = track_manager->getTrack( curr_group[n] );
if (curr->isArena()) continue;
if (curr->isSoccer()) continue;
if (curr->isInternal()) continue;
if (unlock_manager->getCurrentSlot()->isLocked(curr->getIdent()))