From 0cabe1408901c46cafe5ac7b259288244e0e5284 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 8 Dec 2012 11:24:43 +0100 Subject: [PATCH] Changed: Code simplification --- code/nel/src/net/login_server.cpp | 2 +- .../georges_editor/georgesform_model.cpp | 25 +++++++++++++------ .../particle_workspace_dialog.cpp | 9 ++++--- code/ryzom/common/src/game_share/scenario.cpp | 4 +-- .../game_share/server_animation_module.cpp | 2 +- .../ryzom/tools/leveldesign/export/export.cpp | 2 +- .../src/georgesform_model.cpp | 4 +-- .../mission_compiler_lib/step_content.cpp | 2 +- .../tools/leveldesign/mp_generator/main.cpp | 2 +- code/ryzom/tools/pd_parser/parse_node.h | 16 ++++++------ 10 files changed, 39 insertions(+), 29 deletions(-) diff --git a/code/nel/src/net/login_server.cpp b/code/nel/src/net/login_server.cpp index 736f0f7ef..5bd6dfd34 100644 --- a/code/nel/src/net/login_server.cpp +++ b/code/nel/src/net/login_server.cpp @@ -53,7 +53,7 @@ static string ListenAddr; static bool AcceptInvalidCookie = false; -static string DefaultUserPriv = ""; +static string DefaultUserPriv; static TDisconnectClientCallback DisconnectClientCallback = NULL; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp index 83548c7d3..dd0220bbf 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "georgesform_model.h" +#include "formitem.h" // NeL includes #include @@ -35,9 +37,6 @@ #include #include -// project includes -#include "formitem.h" - using namespace NLGEORGES; namespace GeorgesQt @@ -406,7 +405,7 @@ namespace GeorgesQt //uint value_uint; //sint value_sint; //double value_double; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true)) { @@ -428,13 +427,23 @@ namespace GeorgesQt switch (type->getType()) { case UType::UnsignedInt: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toUtf8(); + { + uint v; + NLMISC::fromString(value, v); + value = NLMISC::toString(v); elmtType.append("_uint");break; + } case UType::SignedInt: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toUtf8(); + { + sint v; + NLMISC::fromString(value, v); + value = NLMISC::toString(v); elmtType.append("_sint");break; + } case UType::Double: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble(),0,'f',1).toUtf8(); + float v; + NLMISC::fromString(value, v); + value = NLMISC::toString(v); elmtType.append("_double");break; case UType::String: elmtType.append("_string");break; @@ -569,7 +578,7 @@ namespace GeorgesQt { QList columnData; std::string value; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getArrayNode(&elmt,0) && elmt) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp index c006e7066..4c92a5fc4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp @@ -770,12 +770,13 @@ NL3D::CPSLocated *CParticleWorkspaceDialog::createLocated(NL3D::CParticleSystem { // build new name std::string name; - if (_PSElementIdentifiers.count(std::string("located"))) - name = (QString("located %1").arg(++_PSElementIdentifiers[std::string("located")])).toUtf8(); - + if (_PSElementIdentifiers.count("located")) + { + name = NLMISC::toString("located %u", ++_PSElementIdentifiers["located"]); + } else { - name = std::string("located 0"); + name = "located 0"; _PSElementIdentifiers["located"] = 0; } NL3D::CPSLocated *loc = new NL3D::CPSLocated; diff --git a/code/ryzom/common/src/game_share/scenario.cpp b/code/ryzom/common/src/game_share/scenario.cpp index 5320f0918..6911df31a 100644 --- a/code/ryzom/common/src/game_share/scenario.cpp +++ b/code/ryzom/common/src/game_share/scenario.cpp @@ -989,7 +989,7 @@ bool CScenarioValidator::setScenarioToSave(const std::string& filename, CObject* return true; } -std::string CScenarioValidator::AutoSaveSignature = ""; +std::string CScenarioValidator::AutoSaveSignature; bool CScenarioValidator::applySave(const std::string& signature) { @@ -1252,7 +1252,7 @@ bool CUserComponentValidator::setUserComponentToSave(const std::string& filename return true; } -std::string CUserComponentValidator::AutoSaveSignature = ""; +std::string CUserComponentValidator::AutoSaveSignature; bool CUserComponentValidator::applySave(const std::string& signature) { diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index 3758dbf53..51d7ce19e 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -2017,7 +2017,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi //first <=> actId CPrimitives *primDoc = &primDocs[first]; - std::string streamFileName = ""; + std::string streamFileName; if (first==0) { streamFileName= toString("r2.%04d.base.primitive", aiInstance); diff --git a/code/ryzom/tools/leveldesign/export/export.cpp b/code/ryzom/tools/leveldesign/export/export.cpp index c451ac094..b15e48a59 100644 --- a/code/ryzom/tools/leveldesign/export/export.cpp +++ b/code/ryzom/tools/leveldesign/export/export.cpp @@ -2023,7 +2023,7 @@ void CExport::writeFloraIG (const string &LandFile, bool bTestForWriting) // Make the .IG - string ZoneName = ""; + string ZoneName; ZoneName += NLMISC::toString(-j) + "_"; ZoneName += 'a' + (i/26); ZoneName += 'a' + (i%26); diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp index b0c309efd..89cba843c 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp @@ -380,7 +380,7 @@ namespace NLQT //uint value_uint; //sint value_sint; //double value_double; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true)) { @@ -542,7 +542,7 @@ namespace NLQT { QList columnData; std::string value; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getArrayNode(&elmt,0) && elmt) diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp index 13e2d0a5b..adcf6c680 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp @@ -1809,7 +1809,7 @@ string CContentObjective::genCode(CMissionData &md) // --------------------------------------------------------------------------- /*std::string CContentObjective::genNbGuildMembersNeededOption(CMissionData &md) { - string ret = ""; + string ret; // If we are in a guild mission we add the 'nb_guild_members_needed' option to the script if (md.isGuildMission()) { diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index e61546a8d..decb9b766 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -1455,7 +1455,7 @@ void GenerateDoc() AltDocs[c].write( "" + string(DataColStr[cc]) + "" ); AltDocs[c].write( "" ); string previousKey = "[NO PREVIOUS]"; // not a blank string, because it may be a valid value - string previousName = ""; + string previousName; for ( CRMData::CLookup::const_iterator isd=SortableData.lookup( c ).begin(); isd!=SortableData.lookup( c ).end(); ++isd ) { const TRMItem& item = SortableData.getRow( (*isd).second ); diff --git a/code/ryzom/tools/pd_parser/parse_node.h b/code/ryzom/tools/pd_parser/parse_node.h index b1c43fa4a..ad2b6a8f2 100644 --- a/code/ryzom/tools/pd_parser/parse_node.h +++ b/code/ryzom/tools/pd_parser/parse_node.h @@ -870,7 +870,7 @@ public: std::string getIndexName(uint32 value) const { - std::string result = ""; + std::string result; uint i; for (i=0; iName; return res; @@ -1078,7 +1078,7 @@ public: std::string getDebugCallStringFmt() { uint i, idx=0; - std::string res = ""; + std::string res; for (i=0; i