From 2e01e8c4bf68b026baaa109b7bf3fea9a607d9df Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 5 Jun 2012 19:11:43 +0200 Subject: [PATCH] Changed: Different default type id for sound sheet id workaround --- code/nel/src/misc/sheet_id.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/code/nel/src/misc/sheet_id.cpp b/code/nel/src/misc/sheet_id.cpp index a66d3c64f..0ff90b1f8 100644 --- a/code/nel/src/misc/sheet_id.cpp +++ b/code/nel/src/misc/sheet_id.cpp @@ -47,7 +47,7 @@ std::map CSheetId::_DevSheetNameToId; #define NL_TEMP_YUBO_NO_SOUND_SHEET_ID #ifdef NL_TEMP_YUBO_NO_SOUND_SHEET_ID -namespace { bool a_NoSoundSheetId = false; } +namespace { bool a_NoSoundSheetId = false; const uint32 a_NoSoundSheetType = 80; } #endif const CSheetId CSheetId::Unknown(0); @@ -110,6 +110,8 @@ CSheetId::CSheetId( const string& sheetName ) *this = Unknown; } + // nldebug("LIST_SHEET_ID: %s (%s)", toString().c_str(), sheetName.c_str()); + } // CSheetId // CSheetId::CSheetId( const std::string& sheetName, const std::string &defaultType ) @@ -216,10 +218,9 @@ bool CSheetId::buildSheetId(const std::string& sheetName) std::map::iterator it = _DevSheetNameToId.find(sheetNameLc); if (it == _DevSheetNameToId.end()) { - uint32 typeId = ((1 << (NL_SHEET_ID_TYPE_BITS)) - 1); // nldebug("SHEETID: Creating a temporary sheet id for '%s'", sheetName.c_str()); _DevSheetIdToName[0].push_back(sheetName); - _Id.IdInfos.Type = typeId; + _Id.IdInfos.Type = a_NoSoundSheetType; _Id.IdInfos.Id = _DevSheetIdToName[0].size() - 1; _DevSheetNameToId[sheetNameLc] = _Id.Id; return true; @@ -386,13 +387,13 @@ void CSheetId::init(bool removeUnknownSheet) if (typeFromFileExtension("sound") == std::numeric_limits::max()) { nlwarning("SHEETID: Loading without known sound sheet id, please update sheet_id.bin with .sound sheets"); - uint32 typeId = ((1 << (NL_SHEET_ID_TYPE_BITS)) - 1); nlassert(_FileExtensions.size() == 1 << (NL_SHEET_ID_TYPE_BITS)); - _FileExtensions[((1 << (NL_SHEET_ID_TYPE_BITS)) - 1)] == "sound"; + nlassert(_FileExtensions[a_NoSoundSheetType].empty()); + _FileExtensions[a_NoSoundSheetType] == "sound"; _DevSheetIdToName.push_back(std::vector()); _DevSheetIdToName[0].push_back("unknown.sound"); TSheetId id; - id.IdInfos.Type = typeId; + id.IdInfos.Type = a_NoSoundSheetType; id.IdInfos.Id = _DevSheetIdToName[0].size() - 1; nlassert(id.IdInfos.Id == 0); _DevSheetNameToId["unknown.sound"] = id.Id; @@ -467,6 +468,9 @@ CSheetId& CSheetId::operator=( const string& sheetName ) if (!buildSheetId(sheetName)) *this = Unknown; + + // nldebug("LIST_SHEET_ID: %s (%s)", toString().c_str(), sheetName.c_str()); + return *this; } // operator= // @@ -530,7 +534,7 @@ string CSheetId::toString(bool ifNotFoundUseNumericId) const else { #ifdef NL_TEMP_YUBO_NO_SOUND_SHEET_ID - if (a_NoSoundSheetId && _Id.IdInfos.Type == ((1 << (NL_SHEET_ID_TYPE_BITS)) - 1)) + if (a_NoSoundSheetId && _Id.IdInfos.Type == a_NoSoundSheetType) { return _DevSheetIdToName[0][_Id.IdInfos.Id]; }