From 6a806d82d2016dab25b775528826fca2633a68d1 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 5 Jun 2012 14:03:38 +0200 Subject: [PATCH] Changed: Small optimization for sheet id constructor with default type --- code/nel/src/misc/sheet_id.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/nel/src/misc/sheet_id.cpp b/code/nel/src/misc/sheet_id.cpp index fb2627b5e..dd9753ded 100644 --- a/code/nel/src/misc/sheet_id.cpp +++ b/code/nel/src/misc/sheet_id.cpp @@ -114,14 +114,19 @@ CSheetId::CSheetId( const string& sheetName ) CSheetId::CSheetId( const std::string& sheetName, const std::string &defaultType ) { - if (CFile::getExtension(sheetName) == "" && defaultType != "") + // Don't use this function without defaultType, use the one above. + nlassert(defaultType.size() != 0); + + if (sheetName.rfind('.') == std::string::npos) { std::string withType = sheetName + "." + defaultType; *this = CSheetId(withType); // nldebug("SHEETID: Constructing CSheetId from name '%s' without explicit type, defaulting as '%s' to '%s'", sheetName.c_str(), defaultType.c_str(), withType.c_str()); } else + { *this = CSheetId(sheetName); + } }