Apply patch by KroArtem to fix minor issues : unused variables and other minor warnings from cppcheck, crash when launching from terminal with AI karts in a mode where AI is not supported

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12857 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2013-06-09 20:04:07 +00:00
parent 5783294995
commit 485551aa89
6 changed files with 44 additions and 19 deletions

View File

@ -284,7 +284,6 @@ irr::core::stringw TimeUserConfigParam::toString() const
// we can't use an irrlicht's stringw directly. Since it's only a
// number, we can use std::string, and convert to stringw
std::string tmp;
std::ostringstream o;
o<<m_value;
return core::stringw(o.str().c_str());

View File

@ -854,7 +854,7 @@ void Kart::collectedItem(Item *item, int add_info)
// slow down
m_bubblegum_time = 1.0f;
m_bubblegum_torque = rand()%2 ? 500.0f : -500.0f;
m_bubblegum_torque = (rand()%2) ? 500.0f : -500.0f;
m_body->setDamping(0.8f, 0.8f);
m_goo_sound->position(getXYZ());
m_goo_sound->play();

View File

@ -352,7 +352,7 @@ void cmdLineHelp (char* invocation)
" -N, --no-start-screen Immediately start race without showing a "
"menu.\n"
" -R, --race-now Same as -N but also skip the ready-set-go phase"
"and the music.\n"
" and the music.\n"
" -t, --track NAME Start at track NAME (see --list-tracks).\n"
" --gp NAME Start the specified Grand Prix.\n"
" --stk-config FILE use ./data/FILE instead of "
@ -432,8 +432,6 @@ int handleCmdLinePreliminary(int argc, char **argv)
{
if(argv[i][0] != '-') continue;
if (!strcmp(argv[i], "--help" ) ||
!strcmp(argv[i], "-help" ) ||
!strcmp(argv[i], "--help" ) ||
!strcmp(argv[i], "-help" ) ||
!strcmp(argv[i], "-h" ) )
{
@ -828,9 +826,23 @@ int handleCmdLine(int argc, char **argv)
argv[i+1]);
}
else if (t->isArena())
{
//if it's arena, don't create ai karts
const std::vector<std::string> l;
race_manager->setDefaultAIKartList(l);
// Add 1 for the player kart
race_manager->setNumKarts(1);
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
}
else if(t->isSoccer())
{
//if it's soccer, don't create ai karts
const std::vector<std::string> l;
race_manager->setDefaultAIKartList(l);
// Add 1 for the player kart
race_manager->setNumKarts(1);
race_manager->setMinorMode(RaceManager::MINOR_MODE_SOCCER);
}
}
else
{
@ -932,17 +944,33 @@ int handleCmdLine(int argc, char **argv)
}
else if ( !strcmp(argv[i], "--laps") && i+1<argc )
{
Log::verbose("main", "You choose to have %d laps.",
atoi(argv[i+1]) );
race_manager->setNumLaps(atoi(argv[i+1]));
i++;
int laps = atoi(argv[i+1]);
if (laps < 0)
{
Log::error("main", "Invalid number of laps: %s.\n", argv[i+1] );
return 0;
}
else
{
Log::verbose("main", "You choose to have %d laps.", laps);
race_manager->setNumLaps(laps);
i++;
}
}
else if( sscanf(argv[i], "--profile-laps=%d", &n)==1)
{
Log::verbose("main", "Profiling %d laps.",n);
UserConfigParams::m_no_start_screen = true;
ProfileWorld::setProfileModeLaps(n);
race_manager->setNumLaps(n);
if (n < 0)
{
Log::error("main", "Invalid number of profile-laps: %i.\n", n );
return 0;
}
else
{
Log::verbose("main", "Profiling %d laps.",n);
UserConfigParams::m_no_start_screen = true;
ProfileWorld::setProfileModeLaps(n);
race_manager->setNumLaps(n);
}
}
else if( sscanf(argv[i], "--profile-time=%d", &n)==1)
{

View File

@ -198,7 +198,6 @@ void EasterEggHunt::getKartsDisplayInfo(
for(unsigned int i = 0; i < kart_amount ; i++)
{
RaceGUIBase::KartIconDisplayInfo& rank_info = (*info)[i];
std::ostringstream o;
//I18n: number of collected eggs / overall number of eggs
rank_info.m_text = StringUtils::insertValues(_("Eggs: %d / %d"),
m_eggs_collected[i],

View File

@ -415,7 +415,6 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies,
// more than one object, and/or more than once with each object (if there
// is more than one collision point). So keep a list of rockets that will
// be exploded after the collisions
std::vector<Moveable*> rocketsToExplode;
for(int i=0; i<currentNumManifolds; i++)
{
btPersistentManifold* contact_manifold =

View File

@ -439,8 +439,8 @@ void QuadGraph::createMesh(bool show_invisible,
// Swap the colours from red to blue and back
if(!track_color)
{
c.setRed (i%2 ? 255 : 0);
c.setBlue(i%2 ? 0 : 255);
c.setRed ((i%2) ? 255 : 0);
c.setBlue((i%2) ? 0 : 255);
}
// Transfer the 4 points of the current quad to the list of vertices
m_all_nodes[count]->getQuad().getVertices(new_v+4*i, c);
@ -538,8 +538,8 @@ void QuadGraph::createDebugMesh()
for(unsigned int i=0; i<m_mesh_buffer->getVertexCount(); i++)
{
// Swap the colours from red to blue and back
c.setRed (i%2 ? 255 : 0);
c.setBlue(i%2 ? 0 : 255);
c.setRed ((i%2) ? 255 : 0);
c.setBlue((i%2) ? 0 : 255);
v[i].Color = c;
}
m_node = irr_driver->addMesh(m_mesh);