From 896e2664fc471b3898d018bb0652ac0897d9f776 Mon Sep 17 00:00:00 2001 From: auria Date: Sun, 6 Feb 2011 02:59:19 +0000 Subject: [PATCH] Fixed track names not being translated on live language switch git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7633 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/main.cpp | 2 +- src/states_screens/arenas_screen.cpp | 4 ++-- src/states_screens/tracks_screen.cpp | 4 ++-- src/tracks/track.cpp | 4 +--- src/tracks/track.hpp | 9 ++++++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0543031e4..8d4ab1e64 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -571,7 +571,7 @@ int handleCmdLine(int argc, char **argv) { fprintf ( stdout, "\t%10s: %ls\n", track->getIdent().c_str(), - track->getName().c_str()); + track->getName()); } } diff --git a/src/states_screens/arenas_screen.cpp b/src/states_screens/arenas_screen.cpp index 5cb7ecc64..f66d27e27 100644 --- a/src/states_screens/arenas_screen.cpp +++ b/src/states_screens/arenas_screen.cpp @@ -128,7 +128,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const { ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() ); - new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName().c_str(), + new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName(), screenshot, 0.8f, 0.7f); } @@ -147,7 +147,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const { ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() ); - new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName().c_str(), + new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName(), screenshot, 0.8f, 0.7f); } // clickedTrack != NULL } // if random_track diff --git a/src/states_screens/tracks_screen.cpp b/src/states_screens/tracks_screen.cpp index 9770dd176..1ac6315e4 100644 --- a/src/states_screens/tracks_screen.cpp +++ b/src/states_screens/tracks_screen.cpp @@ -117,7 +117,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() ); new TrackInfoDialog(selection, clickedTrack->getIdent(), - translations->fribidize(clickedTrack->getName().c_str()), + translations->fribidize(clickedTrack->getName()), screenshot, 0.8f, 0.7f); } @@ -137,7 +137,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() ); new TrackInfoDialog(selection, clickedTrack->getIdent(), - translations->fribidize(clickedTrack->getName().c_str()), + translations->fribidize(clickedTrack->getName()), screenshot, 0.8f, 0.7f); } } diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 6e49c6ee1..75a597759 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -196,9 +196,7 @@ void Track::loadTrackInfo() o<<"Can't load track '"<get("name", &temp_name); - m_name = _LTR(temp_name.c_str()); + root->get("name", &m_name); //root->get("description", &m_description); root->get("designer", &m_designer); diff --git a/src/tracks/track.hpp b/src/tracks/track.hpp index a0f579925..48d561d20 100644 --- a/src/tracks/track.hpp +++ b/src/tracks/track.hpp @@ -147,7 +147,8 @@ private: std::vector m_all_modes; /** Name of the track to display. */ - irr::core::stringw m_name; + std::string m_name; + bool m_use_fog; float m_fog_density; float m_fog_start; @@ -207,8 +208,10 @@ public: /** Returns a unique identifier for this track (the directory name). */ const std::string& getIdent () const {return m_ident; } - /** Returns the name of the track, which is e.g. displayed on the screen. */ - const irr::core::stringw& getName () const {return m_name; } + /** Returns the name of the track, which is e.g. displayed on the screen. + \note this is the LTR name, invoke fribidi as needed + */ + const wchar_t* getName () const {return translations->w_gettext(m_name.c_str()); } /** Returns all groups this track belongs to. */ const std::vector