Fix string remaining in wrong language when changing language

This commit is contained in:
auria.mg
2016-07-30 20:52:32 -04:00
parent b69faff13d
commit 40ab343922
4 changed files with 36 additions and 22 deletions

View File

@@ -251,23 +251,30 @@ ChallengeData::ChallengeData(const std::string& filename)
throw std::runtime_error("Unknown unlock entry");
}
}
core::stringw description;
if (track_node != NULL && m_minor!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
{
//I18N: number of laps to race in a challenge
description += _("Laps : %i", m_num_laps);
description += core::stringw(L"\n");
}
else if (track_node)
{
// Follow the leader mode:
description = _("Follow the leader");
}
m_challenge_description = description;
} // ChallengeData
// ----------------------------------------------------------------------------
const irr::core::stringw ChallengeData::getChallengeDescription() const
{
core::stringw description;
if (!m_track_id.empty())
{
if (m_minor != RaceManager::MINOR_MODE_FOLLOW_LEADER)
{
//I18N: number of laps to race in a challenge
description += _("Laps: %i", m_num_laps);
description += core::stringw(L"\n");
}
else
{
// Follow the leader mode:
description = _("Follow the leader");
}
}
return description;
} // getChallengeDescription
// ----------------------------------------------------------------------------
void ChallengeData::error(const char *id) const
{

View File

@@ -110,8 +110,6 @@ private:
/** Number of trophies required to access this challenge */
int m_num_trophies;
irr::core::stringw m_challenge_description;
public:
ChallengeData(const std::string& filename);
@@ -195,10 +193,7 @@ public:
// ------------------------------------------------------------------------
/** Returns the description of this challenge.
*/
const irr::core::stringw& getChallengeDescription() const
{
return m_challenge_description;
} // getChallengeDescription
const irr::core::stringw getChallengeDescription() const;
// ------------------------------------------------------------------------
/** Returns the minimum position the player must have in order to win.

View File

@@ -108,6 +108,7 @@ RaceGUIOverworld::RaceGUIOverworld()
m_string_lap = _("Lap");
m_string_rank = _("Rank");
m_active_challenge = NULL;
// Determine maximum length of the rank/lap text, in order to
// align those texts properly on the right side of the viewport.
@@ -528,7 +529,13 @@ void RaceGUIOverworld::drawGlobalMiniMap()
pos.UpperLeftCorner.Y += GUIEngine::getTitleFontHeight();
pos.LowerRightCorner.Y = irr_driver->getActualScreenSize().Height;
GUIEngine::getFont()->draw(challenge->getChallengeDescription().c_str(),
if (m_active_challenge != challenge)
{
m_active_challenge = challenge;
m_challenge_description = challenge->getChallengeDescription();
}
GUIEngine::getFont()->draw(m_challenge_description,
pos, video::SColor(255,255,255,255),
false, false /* vcenter */, NULL);

View File

@@ -101,6 +101,11 @@ private:
int m_trophy_points_width;
/** The latest challenge approached by the kart */
const ChallengeData* m_active_challenge;
core::stringw m_challenge_description;
/** The current challenge over which the mouse is hovering. */
const OverworldChallenge *m_current_challenge;