Fixed handling of wide strings in StringUtils::insertValues (the wide overlaod) + fixed aain assert import
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3979 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4200a2b054
commit
5ff086d156
@ -108,32 +108,32 @@ const irr::core::stringw Challenge::getUnlockedMessage() const
|
||||
Track* track = track_manager->getTrack( m_feature[n].name );
|
||||
message = StringUtils::insertValues(
|
||||
_("New track '%s'\nnow available"),
|
||||
track->getName().c_str() ); // FIXME : insertValues can't handle wide strings
|
||||
track->getName().c_str() );
|
||||
break;
|
||||
}
|
||||
case UNLOCK_MODE:
|
||||
message = StringUtils::insertValues(
|
||||
_("New game mode\n'%s'\nnow available"),
|
||||
m_feature[n].user_name.c_str()); // FIXME : insertValues can't handle wide strings
|
||||
m_feature[n].user_name.c_str());
|
||||
break;
|
||||
case UNLOCK_GP:
|
||||
{
|
||||
const irr::core::stringw& gp_user_name = grand_prix_manager->getGrandPrix(m_feature[n].name)->getName();
|
||||
message = StringUtils::insertValues(
|
||||
_("New Grand Prix '%s'\nnow available"),
|
||||
gp_user_name.c_str()); // FIXME : insertValues can't handle wide strings
|
||||
gp_user_name.c_str());
|
||||
break;
|
||||
}
|
||||
case UNLOCK_DIFFICULTY:
|
||||
message = StringUtils::insertValues(
|
||||
_("New difficulty\n'%s'\nnow available"),
|
||||
m_feature[n].user_name.c_str()); // FIXME : insertValues can't handle wide strings
|
||||
m_feature[n].user_name.c_str());
|
||||
break;
|
||||
case UNLOCK_KART:
|
||||
const KartProperties *kp=kart_properties_manager->getKart(m_feature[n].name );
|
||||
message = StringUtils::insertValues(
|
||||
_("New kart\n'%s'\nnow available"),
|
||||
kp->getName().c_str()); // FIXME : insertValues can't handle wide strings
|
||||
kp->getName().c_str());
|
||||
break;
|
||||
} // switch
|
||||
unlocked_message += message;
|
||||
|
@ -445,9 +445,9 @@ void World::removeKart(int kart_number)
|
||||
}
|
||||
else
|
||||
{
|
||||
irr::core::stringw s = _("'%s' has\nbeen eliminated.");
|
||||
m_race_gui->addMessage(StringUtils::insertValues(s, kart->getName().c_str()), // FIXME : insertValues can't handle wide strings
|
||||
*i, 2.0f, 60);
|
||||
m_race_gui->addMessage(StringUtils::insertValues(_("'%s' has\nbeen eliminated."),
|
||||
kart->getName().c_str()),
|
||||
*i, 2.0f, 60);
|
||||
}
|
||||
} // for i in kart
|
||||
if(kart->isPlayerKart())
|
||||
|
@ -110,14 +110,14 @@ RaceOverDialog::RaceOverDialog(const float percentWidth, const float percentHeig
|
||||
const int new_score = race_manager->getKartScore(order[i]);
|
||||
|
||||
kart_results_line = StringUtils::insertValues( L"#%i. %s (%i + %i = %i)",
|
||||
current_kart->getPosition(), kart_name.c_str(), // FIXME: insertValues & wide strings
|
||||
current_kart->getPosition(), kart_name.c_str(),
|
||||
prev_score, (new_score - prev_score), new_score);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wcout << kart_name.c_str() << std::endl;
|
||||
|
||||
kart_results_line = StringUtils::insertValues( L"%i. %s %s", // FIXME: insertValues & wide strings
|
||||
kart_results_line = StringUtils::insertValues( L"%i. %s %s",
|
||||
current_kart->getPosition(), kart_name.c_str(), sTime);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <exception>
|
||||
#include <assert>
|
||||
#include <assert.h>
|
||||
|
||||
namespace StringUtils
|
||||
{
|
||||
@ -292,7 +292,7 @@ namespace StringUtils
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, std::vector<std::string>& all_vals)
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, std::vector<irr::core::stringw>& all_vals)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ namespace StringUtils
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Same as above but for wide-strings */
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, std::vector<std::string>& all_vals);
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, std::vector<irr::core::stringw>& all_vals);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Note: the order in which the templates are specified is important, since
|
||||
@ -166,13 +166,12 @@ namespace StringUtils
|
||||
const T2 &v2, const T3 &v3, const T4 &v4,
|
||||
const T5 &v5)
|
||||
{
|
||||
std::vector<std::string> all_vals;
|
||||
std::ostringstream dummy;
|
||||
dummy << v1; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v2; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v3; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v4; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v5; all_vals.push_back(dummy.str());
|
||||
std::vector<irr::core::stringw> all_vals;
|
||||
all_vals.push_back( irr::core::stringw(v1) );
|
||||
all_vals.push_back( irr::core::stringw(v2) );
|
||||
all_vals.push_back( irr::core::stringw(v3) );
|
||||
all_vals.push_back( irr::core::stringw(v4) );
|
||||
all_vals.push_back( irr::core::stringw(v5) );
|
||||
return insertValues(s, all_vals);
|
||||
}
|
||||
|
||||
@ -182,12 +181,11 @@ namespace StringUtils
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, const T1 &v1,
|
||||
const T2 &v2, const T3 &v3, const T4 &v4)
|
||||
{
|
||||
std::vector<std::string> all_vals;
|
||||
std::ostringstream dummy;
|
||||
dummy << v1; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v2; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v3; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v4; all_vals.push_back(dummy.str());
|
||||
std::vector<irr::core::stringw> all_vals;
|
||||
all_vals.push_back( irr::core::stringw(v1) );
|
||||
all_vals.push_back( irr::core::stringw(v2) );
|
||||
all_vals.push_back( irr::core::stringw(v3) );
|
||||
all_vals.push_back( irr::core::stringw(v4) );
|
||||
return insertValues(s, all_vals);
|
||||
}
|
||||
|
||||
@ -197,24 +195,23 @@ namespace StringUtils
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, const T1 &v1,
|
||||
const T2 &v2, const T3 &v3)
|
||||
{
|
||||
std::vector<std::string> all_vals;
|
||||
std::ostringstream dummy;
|
||||
dummy << v1; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v2; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v3; all_vals.push_back(dummy.str());
|
||||
std::vector<irr::core::stringw> all_vals;
|
||||
irr::core::stringw dummy;
|
||||
all_vals.push_back( irr::core::stringw(v1) );
|
||||
all_vals.push_back( irr::core::stringw(v2) );
|
||||
all_vals.push_back( irr::core::stringw(v3) );
|
||||
return insertValues(s, all_vals);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Like the other ones above but for wide strings */
|
||||
template <class T1, class T2>
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, const T1 &v1,
|
||||
const T2 &v2)
|
||||
{
|
||||
std::vector<std::string> all_vals;
|
||||
std::ostringstream dummy;
|
||||
dummy << v1; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
dummy << v2; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
std::vector<irr::core::stringw> all_vals;
|
||||
all_vals.push_back( irr::core::stringw(v1) );
|
||||
all_vals.push_back( irr::core::stringw(v2) );
|
||||
return insertValues(s, all_vals);
|
||||
}
|
||||
|
||||
@ -223,9 +220,8 @@ namespace StringUtils
|
||||
template <class T1>
|
||||
irr::core::stringw insertValues(const irr::core::stringw &s, const T1 &v1)
|
||||
{
|
||||
std::vector<std::string> all_vals;
|
||||
std::ostringstream dummy;
|
||||
dummy << v1; all_vals.push_back(dummy.str()); dummy.str("");
|
||||
std::vector<irr::core::stringw> all_vals;
|
||||
all_vals.push_back( irr::core::stringw(v1) );
|
||||
return insertValues(s, all_vals);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user