From 829656d1d7ca01b0e05f1ab0b44281aeded30dfe Mon Sep 17 00:00:00 2001 From: deveee Date: Mon, 16 Sep 2013 10:15:29 +0000 Subject: [PATCH] Move getting team icons to avoid getting it in every refresh. I'm not sure where it should be to keep order. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13698 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/race_result_gui.cpp | 14 ++++++++++---- src/states_screens/race_result_gui.hpp | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 15fbb56e4..44487a6f7 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -298,6 +298,14 @@ void RaceResultGUI::onConfirm() */ void RaceResultGUI::determineTableLayout() { + if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER) + { + redTeamTexture = irr_driver->getTexture( + file_manager->getTextureFile("soccer_ball_red.png")); + blueTeamTexture = irr_driver->getTexture( + file_manager->getTextureFile("soccer_ball_blue.png")); + } + GUIEngine::Widget *table_area = getWidget("result-table"); m_font = GUIEngine::getFont(); @@ -798,14 +806,12 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, if (m_team_goals[0] > m_team_goals[1]) { text = core::stringw(_("Red team won")); - team_icon = irr_driver->getTexture( - file_manager->getTextureFile("soccer_ball_red.png")); + team_icon = redTeamTexture; } else if (m_team_goals[0] < m_team_goals[1]) { text = core::stringw(_("Blue team won")); - team_icon = irr_driver->getTexture( - file_manager->getTextureFile("soccer_ball_blue.png")); + team_icon = blueTeamTexture; } else text = core::stringw(_("Draw")); diff --git a/src/states_screens/race_result_gui.hpp b/src/states_screens/race_result_gui.hpp index e796a3d35..cc0cc7476 100644 --- a/src/states_screens/race_result_gui.hpp +++ b/src/states_screens/race_result_gui.hpp @@ -109,6 +109,10 @@ private: #endif }; // Rowinfo + /** The team icons. */ + video::ITexture *redTeamTexture; + video::ITexture *blueTeamTexture; + std::vector m_all_row_infos; /** Time to wait till the next row starts to be animated. */