Changed: Different default type id for sound sheet id workaround
This commit is contained in:
parent
eb6050795e
commit
805c27b3c8
1 changed files with 11 additions and 7 deletions
|
@ -47,7 +47,7 @@ std::map<std::string, uint32> CSheetId::_DevSheetNameToId;
|
||||||
#define NL_TEMP_YUBO_NO_SOUND_SHEET_ID
|
#define NL_TEMP_YUBO_NO_SOUND_SHEET_ID
|
||||||
|
|
||||||
#ifdef 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
|
#endif
|
||||||
|
|
||||||
const CSheetId CSheetId::Unknown(0);
|
const CSheetId CSheetId::Unknown(0);
|
||||||
|
@ -110,6 +110,8 @@ CSheetId::CSheetId( const string& sheetName )
|
||||||
*this = Unknown;
|
*this = Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nldebug("LIST_SHEET_ID: %s (%s)", toString().c_str(), sheetName.c_str());
|
||||||
|
|
||||||
} // CSheetId //
|
} // CSheetId //
|
||||||
|
|
||||||
CSheetId::CSheetId( const std::string& sheetName, const std::string &defaultType )
|
CSheetId::CSheetId( const std::string& sheetName, const std::string &defaultType )
|
||||||
|
@ -216,10 +218,9 @@ bool CSheetId::buildSheetId(const std::string& sheetName)
|
||||||
std::map<std::string, uint32>::iterator it = _DevSheetNameToId.find(sheetNameLc);
|
std::map<std::string, uint32>::iterator it = _DevSheetNameToId.find(sheetNameLc);
|
||||||
if (it == _DevSheetNameToId.end())
|
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());
|
// nldebug("SHEETID: Creating a temporary sheet id for '%s'", sheetName.c_str());
|
||||||
_DevSheetIdToName[0].push_back(sheetName);
|
_DevSheetIdToName[0].push_back(sheetName);
|
||||||
_Id.IdInfos.Type = typeId;
|
_Id.IdInfos.Type = a_NoSoundSheetType;
|
||||||
_Id.IdInfos.Id = _DevSheetIdToName[0].size() - 1;
|
_Id.IdInfos.Id = _DevSheetIdToName[0].size() - 1;
|
||||||
_DevSheetNameToId[sheetNameLc] = _Id.Id;
|
_DevSheetNameToId[sheetNameLc] = _Id.Id;
|
||||||
return true;
|
return true;
|
||||||
|
@ -386,13 +387,13 @@ void CSheetId::init(bool removeUnknownSheet)
|
||||||
if (typeFromFileExtension("sound") == std::numeric_limits<uint32>::max())
|
if (typeFromFileExtension("sound") == std::numeric_limits<uint32>::max())
|
||||||
{
|
{
|
||||||
nlwarning("SHEETID: Loading without known sound sheet id, please update sheet_id.bin with .sound sheets");
|
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));
|
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<std::string>());
|
_DevSheetIdToName.push_back(std::vector<std::string>());
|
||||||
_DevSheetIdToName[0].push_back("unknown.sound");
|
_DevSheetIdToName[0].push_back("unknown.sound");
|
||||||
TSheetId id;
|
TSheetId id;
|
||||||
id.IdInfos.Type = typeId;
|
id.IdInfos.Type = a_NoSoundSheetType;
|
||||||
id.IdInfos.Id = _DevSheetIdToName[0].size() - 1;
|
id.IdInfos.Id = _DevSheetIdToName[0].size() - 1;
|
||||||
nlassert(id.IdInfos.Id == 0);
|
nlassert(id.IdInfos.Id == 0);
|
||||||
_DevSheetNameToId["unknown.sound"] = id.Id;
|
_DevSheetNameToId["unknown.sound"] = id.Id;
|
||||||
|
@ -467,6 +468,9 @@ CSheetId& CSheetId::operator=( const string& sheetName )
|
||||||
|
|
||||||
if (!buildSheetId(sheetName))
|
if (!buildSheetId(sheetName))
|
||||||
*this = Unknown;
|
*this = Unknown;
|
||||||
|
|
||||||
|
// nldebug("LIST_SHEET_ID: %s (%s)", toString().c_str(), sheetName.c_str());
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
} // operator= //
|
} // operator= //
|
||||||
|
@ -530,7 +534,7 @@ string CSheetId::toString(bool ifNotFoundUseNumericId) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef NL_TEMP_YUBO_NO_SOUND_SHEET_ID
|
#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];
|
return _DevSheetIdToName[0][_Id.IdInfos.Id];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue