From 6e89d097e8367bd220bb72493a08c6e58f471198 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Tue, 15 Mar 2016 20:46:48 +0100 Subject: [PATCH] Cleaned up (now unnecessary) .c_str() converstions to CList::SetItemName --- src/script/script.cpp | 8 ++++---- src/ui/screen/screen_io.cpp | 4 ++-- src/ui/screen/screen_level_list.cpp | 4 ++-- src/ui/screen/screen_player_select.cpp | 2 +- src/ui/screen/screen_setup_controls.cpp | 2 +- src/ui/screen/screen_setup_display.cpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/script/script.cpp b/src/script/script.cpp index 894af4af..3beac76e 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -523,7 +523,7 @@ void PutList(const std::string& baseName, bool bArray, CBot::CBotVar *var, Ui::C if (previous.find(pStatic) != previous.end()) { - list->SetItemName(rankList++, StrUtils::Format("%s = [circular reference]", varName.c_str()).c_str()); + list->SetItemName(rankList++, StrUtils::Format("%s = [circular reference]", varName.c_str())); } else { @@ -531,11 +531,11 @@ void PutList(const std::string& baseName, bool bArray, CBot::CBotVar *var, Ui::C if (type <= CBot::CBotTypBoolean) { - list->SetItemName(rankList++, StrUtils::Format("%s = %s;", varName.c_str(), pStatic->GetValString().c_str()).c_str()); + list->SetItemName(rankList++, StrUtils::Format("%s = %s;", varName.c_str(), pStatic->GetValString().c_str())); } else if (type == CBot::CBotTypString) { - list->SetItemName(rankList++, StrUtils::Format("%s = \"%s\";", varName.c_str(), pStatic->GetValString().c_str()).c_str()); + list->SetItemName(rankList++, StrUtils::Format("%s = \"%s\";", varName.c_str(), pStatic->GetValString().c_str())); } else if (type == CBot::CBotTypArrayPointer) { @@ -552,7 +552,7 @@ void PutList(const std::string& baseName, bool bArray, CBot::CBotVar *var, Ui::C } else { - //list->SetItemName(rankList++, StrUtils::Format("%s = ?;", varName.c_str()).c_str()); + //list->SetItemName(rankList++, StrUtils::Format("%s = ?;", varName.c_str())); assert(false); } } diff --git a/src/ui/screen/screen_io.cpp b/src/ui/screen/screen_io.cpp index 72400200..749a6540 100644 --- a/src/ui/screen/screen_io.cpp +++ b/src/ui/screen/screen_io.cpp @@ -103,7 +103,7 @@ void CScreenIO::IOReadList(bool isWrite) m_saveList.clear(); for(const SavedScene& save : m_main->GetPlayerProfile()->GetSavedSceneList()) { - pl->SetItemName(m_saveList.size(), save.name.c_str()); + pl->SetItemName(m_saveList.size(), save.name); m_saveList.push_back(save.path); } @@ -112,7 +112,7 @@ void CScreenIO::IOReadList(bool isWrite) { std::string nameStr; GetResource(RES_TEXT, RT_IO_NEW, nameStr); - pl->SetItemName(m_saveList.size(), nameStr.c_str()); + pl->SetItemName(m_saveList.size(), nameStr); } pl->SetSelect(m_saveList.size()); diff --git a/src/ui/screen/screen_level_list.cpp b/src/ui/screen/screen_level_list.cpp index 3dd6487e..ee91369d 100644 --- a/src/ui/screen/screen_level_list.cpp +++ b/src/ui/screen/screen_level_list.cpp @@ -370,12 +370,12 @@ void CScreenLevelList::UpdateSceneChap(int &chap) { CLevelParser levelParser("custom", j+1, 0); levelParser.Load(); - pl->SetItemName(j, levelParser.Get("Title")->GetParam("text")->AsString().c_str()); + pl->SetItemName(j, levelParser.Get("Title")->GetParam("text")->AsString()); pl->SetEnable(j, true); } catch (CLevelParserException& e) { - pl->SetItemName(j, (std::string("[ERROR]: ")+e.what()).c_str()); + pl->SetItemName(j, std::string("[ERROR]: ")+e.what()); pl->SetEnable(j, false); } } diff --git a/src/ui/screen/screen_player_select.cpp b/src/ui/screen/screen_player_select.cpp index 3de48da3..f4f30c9a 100644 --- a/src/ui/screen/screen_player_select.cpp +++ b/src/ui/screen/screen_player_select.cpp @@ -221,7 +221,7 @@ void CScreenPlayerSelect::ReadNameList() auto players = CPlayerProfile::GetPlayerList(); for (int i = 0; i < static_cast(players.size()); ++i) { - pl->SetItemName(i, players.at(i).c_str()); + pl->SetItemName(i, players.at(i)); } } diff --git a/src/ui/screen/screen_setup_controls.cpp b/src/ui/screen/screen_setup_controls.cpp index 74bfecf4..bdb2c5c8 100644 --- a/src/ui/screen/screen_setup_controls.cpp +++ b/src/ui/screen/screen_setup_controls.cpp @@ -327,7 +327,7 @@ void CScreenSetupControls::UpdateSetupButtons() auto joysticks = m_app->GetJoystickList(); for (unsigned int i = 0; i < joysticks.size(); i++) { - pli->SetItemName(1 + i, joysticks[i].name.c_str()); + pli->SetItemName(1 + i, joysticks[i].name); } pli->SetSelect(m_app->GetJoystickEnabled() ? m_app->GetJoystick().index + 1 : 0); } diff --git a/src/ui/screen/screen_setup_display.cpp b/src/ui/screen/screen_setup_display.cpp index cfed0e51..e238cf11 100644 --- a/src/ui/screen/screen_setup_display.cpp +++ b/src/ui/screen/screen_setup_display.cpp @@ -192,7 +192,7 @@ void CScreenSetupDisplay::UpdateDisplayMode() mode_text.str(""); Math::IntPoint aspect = AspectRatio(mode); mode_text << mode.x << "x" << mode.y << " [" << aspect.x << ":" << aspect.y << "]"; - pl->SetItemName(i++, mode_text.str().c_str()); + pl->SetItemName(i++, mode_text.str()); } pl->SetSelect(m_setupSelMode);