mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-05 14:59:01 +00:00
Changed: Different default type id for sound sheet id workaround
This commit is contained in:
parent
08e3f3c180
commit
2e01e8c4bf
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
|
||||
|
||||
#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<std::string, uint32>::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<uint32>::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<std::string>());
|
||||
_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];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue