From c452bf9d97126c53d2ec4a73065d9022646ae7bb Mon Sep 17 00:00:00 2001 From: deveee Date: Mon, 14 Oct 2013 20:25:30 +0000 Subject: [PATCH] Tabs into spaces git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14255 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/modes/soccer_world.cpp | 34 ++--- src/states_screens/race_result_gui.cpp | 188 ++++++++++++------------- src/states_screens/race_result_gui.hpp | 2 +- 3 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/modes/soccer_world.cpp b/src/modes/soccer_world.cpp index 8febab091..bdd27cbbb 100644 --- a/src/modes/soccer_world.cpp +++ b/src/modes/soccer_world.cpp @@ -54,7 +54,7 @@ void SoccerWorld::init() WorldWithRank::init(); m_display_rank = false; m_goal_timer = 0.f; - m_lastKartToHitBall = -1; + m_lastKartToHitBall = -1; // check for possible problems if AI karts were incorrectly added if(getNumKarts() > race_manager->getNumPlayers()) @@ -80,11 +80,11 @@ void SoccerWorld::reset() // Reset original positions for the soccer balls TrackObjectManager* tom = getTrack()->getTrackObjectManager(); assert(tom); - m_redScorers.clear(); - m_redScoreTimes.clear(); - m_blueScorers.clear(); - m_blueScoreTimes.clear(); - m_lastKartToHitBall = -1; + m_redScorers.clear(); + m_redScoreTimes.clear(); + m_blueScorers.clear(); + m_blueScoreTimes.clear(); + m_lastKartToHitBall = -1; PtrVector& objects = tom->getObjects(); for(int i=0; isetPhase(WorldStatus::GOAL_PHASE); m_goal_sound->play(); - if(m_lastKartToHitBall != -1) + if(m_lastKartToHitBall != -1) { - if(first_goal){ - m_redScorers.push_back(m_lastKartToHitBall); - m_redScoreTimes.push_back(world->getTime()); - } - else{ - m_blueScorers.push_back(m_lastKartToHitBall); - m_blueScoreTimes.push_back(world->getTime()); - } - } + if(first_goal){ + m_redScorers.push_back(m_lastKartToHitBall); + m_redScoreTimes.push_back(world->getTime()); + } + else{ + m_blueScorers.push_back(m_lastKartToHitBall); + m_blueScoreTimes.push_back(world->getTime()); + } + } } //m_check_goals_enabled = false; // TODO: remove? @@ -198,7 +198,7 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal) * identify the scorer later. */ void SoccerWorld::setLastKartTohitBall(unsigned int kartId){ - m_lastKartToHitBall = kartId; + m_lastKartToHitBall = kartId; } //----------------------------------------------------------------------------- /** The battle is over if only one kart is left, or no player kart. diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 01d587b22..40ec3c15e 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -513,9 +513,9 @@ void RaceResultGUI::onUpdate(float dt, irr::video::IVideoDriver*) */ void RaceResultGUI::renderGlobal(float dt) { - bool isSoccerWorld = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER; - - m_timer += dt; + bool isSoccerWorld = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER; + + m_timer += dt; assert(World::getWorld()->getPhase()==WorldStatus::RESULT_DISPLAY_PHASE); unsigned int num_karts = m_all_row_infos.size(); @@ -662,9 +662,9 @@ void RaceResultGUI::renderGlobal(float dt) break; } // switch if(isSoccerWorld) - displaySoccerResults(); - else - displayOneEntry((unsigned int)x, (unsigned int)y, i, true); + displaySoccerResults(); + else + displayOneEntry((unsigned int)x, (unsigned int)y, i, true); } // for i // Display highscores @@ -834,117 +834,117 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, void RaceResultGUI::displaySoccerResults() { - //Draw win text - core::stringw resultText; - static video::SColor color = video::SColor(255, 255, 255, 255); - gui::IGUIFont* font = GUIEngine::getTitleFont(); - int currX = UserConfigParams::m_width/2; - RowInfo *ri = &(m_all_row_infos[0]); - int currY = (int)ri->m_y_pos; - SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld(); - int teamScore[2] = {soccerWorld->getScore(0), soccerWorld->getScore(1)}; + //Draw win text + core::stringw resultText; + static video::SColor color = video::SColor(255, 255, 255, 255); + gui::IGUIFont* font = GUIEngine::getTitleFont(); + int currX = UserConfigParams::m_width/2; + RowInfo *ri = &(m_all_row_infos[0]); + int currY = (int)ri->m_y_pos; + SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld(); + int teamScore[2] = {soccerWorld->getScore(0), soccerWorld->getScore(1)}; - if(teamScore[0] > teamScore[1]) + if(teamScore[0] > teamScore[1]) { - resultText = _("Red Team Wins"); - } - else if(teamScore[1] > teamScore[0]) + resultText = _("Red Team Wins"); + } + else if(teamScore[1] > teamScore[0]) { - resultText = _("Blue Team Wins"); - } - else + resultText = _("Blue Team Wins"); + } + else { //Cannot really happen now. Only in time limited matches. - resultText = _("It's a draw"); - } - core::rect pos(currX, currY, currX, currY); - font->draw(resultText.c_str(), pos, color, true, true); + resultText = _("It's a draw"); + } + core::rect pos(currX, currY, currX, currY); + font->draw(resultText.c_str(), pos, color, true, true); - //Draw team scores: - currY += 20; - currX /= 2; - irr::video::ITexture* redTeamIcon = irr_driver->getTexture( - file_manager->getTextureFile("soccer_ball_red.png")); - irr::video::ITexture* blueTeamIcon = irr_driver->getTexture( - file_manager->getTextureFile("soccer_ball_blue.png")); + //Draw team scores: + currY += 20; + currX /= 2; + irr::video::ITexture* redTeamIcon = irr_driver->getTexture( + file_manager->getTextureFile("soccer_ball_red.png")); + irr::video::ITexture* blueTeamIcon = irr_driver->getTexture( + file_manager->getTextureFile("soccer_ball_blue.png")); - core::recti sourceRect(core::vector2di(0,0), redTeamIcon->getSize()); - core::recti destRect(currX, currY, currX+redTeamIcon->getSize().Width/2, - currY+redTeamIcon->getSize().Height/2); - irr_driver->getVideoDriver()->draw2DImage(redTeamIcon, destRect,sourceRect, - NULL,NULL, true); - currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2; - destRect = core::recti(currX, currY, currX+redTeamIcon->getSize().Width/2, - currY+redTeamIcon->getSize().Height/2); - irr_driver->getVideoDriver()->draw2DImage(blueTeamIcon,destRect,sourceRect, - NULL, NULL, true); - - currX += redTeamIcon->getSize().Width/4; - currY += 10 + redTeamIcon->getSize().Height/2; - resultText = StringUtils::toWString(teamScore[1]); - pos = core::rect(currX, currY, currX, currY); - color = video::SColor(255,255,255,255); - font->draw(resultText.c_str(), pos, color, true, false); + core::recti sourceRect(core::vector2di(0,0), redTeamIcon->getSize()); + core::recti destRect(currX, currY, currX+redTeamIcon->getSize().Width/2, + currY+redTeamIcon->getSize().Height/2); + irr_driver->getVideoDriver()->draw2DImage(redTeamIcon, destRect,sourceRect, + NULL,NULL, true); + currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2; + destRect = core::recti(currX, currY, currX+redTeamIcon->getSize().Width/2, + currY+redTeamIcon->getSize().Height/2); + irr_driver->getVideoDriver()->draw2DImage(blueTeamIcon,destRect,sourceRect, + NULL, NULL, true); + + currX += redTeamIcon->getSize().Width/4; + currY += 10 + redTeamIcon->getSize().Height/2; + resultText = StringUtils::toWString(teamScore[1]); + pos = core::rect(currX, currY, currX, currY); + color = video::SColor(255,255,255,255); + font->draw(resultText.c_str(), pos, color, true, false); - currX -= UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2; - resultText = StringUtils::toWString(teamScore[0]); - pos = core::rect(currX,currY,currX,currY); - font->draw(resultText.c_str(), pos, color, true, false); - - resultText = "-"; - int centerX = UserConfigParams::m_width/2; - pos = core::rect(centerX, currY, centerX, currY); - font->draw(resultText.c_str(), pos, color, true, false); + currX -= UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2; + resultText = StringUtils::toWString(teamScore[0]); + pos = core::rect(currX,currY,currX,currY); + font->draw(resultText.c_str(), pos, color, true, false); + + resultText = "-"; + int centerX = UserConfigParams::m_width/2; + pos = core::rect(centerX, currY, centerX, currY); + font->draw(resultText.c_str(), pos, color, true, false); - //Draw goal scorers: - //The red scorers: + //Draw goal scorers: + //The red scorers: currY += GUIEngine::getFont()->getDimension(resultText.c_str()).Height + 20; - font = GUIEngine::getSmallFont(); - std::vector scorers = soccerWorld->getScorers(0); - std::vector scoreTimes = soccerWorld->getScoreTimes(0); - irr::video::ITexture* scorerIcon; + font = GUIEngine::getSmallFont(); + std::vector scorers = soccerWorld->getScorers(0); + std::vector scoreTimes = soccerWorld->getScoreTimes(0); + irr::video::ITexture* scorerIcon; - for(unsigned int i=0; igetKart(scorers.at(i))-> + resultText = soccerWorld->getKart(scorers.at(i))-> getKartProperties()->getName(); - resultText.append(" "); - resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str()); - pos = core::rect(currX,currY,currX,currY); - font->draw(resultText,pos, color, true, false); + resultText.append(" "); + resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str()); + pos = core::rect(currX,currY,currX,currY); + font->draw(resultText,pos, color, true, false); scorerIcon = soccerWorld->getKart(scorers.at(i))-> getKartProperties()->getIconMaterial()->getTexture(); - sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize()); + sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize()); irr::u32 offsetX = GUIEngine::getFont()->getDimension(resultText.c_str()).Width/2; - destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30); - irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect, - NULL, NULL, true); - currY += 30; - } + destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30); + irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect, + NULL, NULL, true); + currY += 30; + } - //The blue scorers: - currY -= 30*scorers.size(); - currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2; - scorers = soccerWorld->getScorers(1); - scoreTimes = soccerWorld->getScoreTimes(1); - for(unsigned int i=0; igetSize().Width/2; + scorers = soccerWorld->getScorers(1); + scoreTimes = soccerWorld->getScoreTimes(1); + for(unsigned int i=0; igetKart(scorers.at(i))-> + resultText = soccerWorld->getKart(scorers.at(i))-> getKartProperties()->getName(); - resultText.append(" "); - resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str()); - pos = core::rect(currX,currY,currX,currY); - font->draw(resultText,pos, color, true, false); + resultText.append(" "); + resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str()); + pos = core::rect(currX,currY,currX,currY); + font->draw(resultText,pos, color, true, false); scorerIcon = soccerWorld->getKart(scorers.at(i))-> getKartProperties()->getIconMaterial()->getTexture(); - sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize()); + sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize()); irr::u32 offsetX = GUIEngine::getFont()->getDimension(resultText.c_str()).Width/2; - destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30); - irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect, - NULL, NULL, true); - currY += 30; - } + destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30); + irr_driver->getVideoDriver()->draw2DImage(scorerIcon, destRect, sourceRect, + NULL, NULL, true); + currY += 30; + } } //----------------------------------------------------------------------------- diff --git a/src/states_screens/race_result_gui.hpp b/src/states_screens/race_result_gui.hpp index ba78ae984..902a7380c 100644 --- a/src/states_screens/race_result_gui.hpp +++ b/src/states_screens/race_result_gui.hpp @@ -196,7 +196,7 @@ private: void displayGPProgress(); void cleanupGPProgress(); void displayHighScores(); - void displaySoccerResults(); + void displaySoccerResults(); public: RaceResultGUI();