refactor: use new line character instead of std::endl

This commit is contained in:
Jan
2024-03-24 20:24:22 +01:00
parent 1b13f1f1b4
commit 132cccb971
49 changed files with 213 additions and 217 deletions

View File

@ -54,7 +54,7 @@ bool AssetLoaderGfxImage::LoadFromRaw(
if (texture == nullptr)
{
std::cout << "Failed to load dds file for image asset \"" << assetName << "\"" << std::endl;
std::cout << "Failed to load dds file for image asset \"" << assetName << "\"\n";
return false;
}

View File

@ -66,7 +66,7 @@ bool AssetLoaderPhysPreset::LoadFromInfoString(
infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent_v<decltype(phys_preset_fields)>);
if (!converter.Convert())
{
std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to parse phys preset: \"" << assetName << "\"\n";
return true;
}
@ -103,7 +103,7 @@ bool AssetLoaderPhysPreset::LoadFromGdt(
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"\n";
return true;
}
@ -126,7 +126,7 @@ bool AssetLoaderPhysPreset::LoadFromRaw(
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
{
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"" << std::endl;
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"\n";
return true;
}

View File

@ -62,7 +62,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (fx == nullptr)
{
std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load fx asset \"" << value << "\"\n";
return false;
}
@ -84,7 +84,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (xmodel == nullptr)
{
std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load xmodel asset \"" << value << "\"\n";
return false;
}
@ -106,7 +106,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (material == nullptr)
{
std::cout << "Failed to load material asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load material asset \"" << value << "\"\n";
return false;
}
@ -128,7 +128,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (tracer == nullptr)
{
std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load tracer asset \"" << value << "\"\n";
return false;
}
@ -145,7 +145,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (endPtr != &value[value.size()])
{
std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl;
std::cout << "Failed to parse value \"" << value << "\" as mph\n";
return false;
}
@ -164,7 +164,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (collmap == nullptr)
{
std::cout << "Failed to load collmap asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load collmap asset \"" << value << "\"\n";
return false;
}
@ -186,7 +186,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (sound == nullptr)
{
std::cout << "Failed to load sound asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load sound asset \"" << value << "\"\n";
return false;
}

View File

@ -59,7 +59,7 @@ bool AssetLoaderRawFile::LoadFromRaw(
if (ret != Z_STREAM_END)
{
std::cout << "Deflate failed for loading rawfile \"" << assetName << "\"" << std::endl;
std::cout << "Deflate failed for loading rawfile \"" << assetName << "\"\n";
deflateEnd(&zs);
return false;
}

View File

@ -55,13 +55,13 @@ bool AssetLoaderScriptFile::LoadFromRaw(
if (scriptFile->compressedLen <= 0 || scriptFile->bytecodeLen <= 0)
{
std::cerr << "Error: Invalid length of the buffers in " << assetName << " specified" << std::endl;
std::cerr << "Error: Invalid length of the buffers in " << assetName << " specified\n";
return false;
}
if (offset + (scriptFile->compressedLen + scriptFile->bytecodeLen) > file.m_length)
{
std::cerr << "Error: Specified length in " << assetName << " GSC BIN structure exceeds the actual file size" << std::endl;
std::cerr << "Error: Specified length in " << assetName << " GSC BIN structure exceeds the actual file size\n";
return false;
}

View File

@ -58,7 +58,7 @@ bool AssetLoaderRawFile::LoadGsc(
if (ret != Z_STREAM_END)
{
std::cout << "Deflate failed for loading gsc file \"" << assetName << "\"" << std::endl;
std::cout << "Deflate failed for loading gsc file \"" << assetName << "\"\n";
deflateEnd(&zs);
return false;
}

View File

@ -102,26 +102,26 @@ bool AssetLoaderFontIcon::ReadIconRow(const std::vector<std::string>& row,
{
if (row.size() < COL_COUNT_ICON)
{
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for entries (" << COL_COUNT_ICON << ")" << std::endl;
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for entries (" << COL_COUNT_ICON << ")\n";
return false;
}
if (!ParseInt(icon.fontIconSize, row[ROW_ICON_SIZE]))
{
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse size" << std::endl;
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse size\n";
return false;
}
if (!ParseFloat(icon.xScale, row[ROW_ICON_XSCALE]) || !ParseFloat(icon.yScale, row[ROW_ICON_YSCALE]))
{
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse scale" << std::endl;
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse scale\n";
return false;
}
auto* materialDependency = manager->LoadDependency(ASSET_TYPE_MATERIAL, row[ROW_ICON_MATERIAL]);
if (materialDependency == nullptr)
{
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to load material \"" << row[ROW_ICON_MATERIAL] << "\"" << std::endl;
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to load material \"" << row[ROW_ICON_MATERIAL] << "\"\n";
return false;
}
@ -141,19 +141,19 @@ bool AssetLoaderFontIcon::ReadAliasRow(const std::vector<std::string>& row,
{
if (row.size() < COL_COUNT_ALIAS)
{
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for aliases (" << COL_COUNT_ALIAS << ")" << std::endl;
std::cout << ErrorPrefix(assetName, rowIndex) << "Column count lower than min column count for aliases (" << COL_COUNT_ALIAS << ")\n";
return false;
}
if (!ParseHashStr(alias.aliasHash, row[ROW_ALIAS_NAME]))
{
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse alias \"" << row[ROW_ALIAS_NAME] << "\"" << std::endl;
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse alias \"" << row[ROW_ALIAS_NAME] << "\"\n";
return false;
}
if (!ParseHashStr(alias.buttonHash, row[ROW_ALIAS_BUTTON]))
{
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse button \"" << row[ROW_ALIAS_BUTTON] << "\"" << std::endl;
std::cout << ErrorPrefix(assetName, rowIndex) << "Failed to parse button \"" << row[ROW_ALIAS_BUTTON] << "\"\n";
return false;
}
@ -187,14 +187,14 @@ bool AssetLoaderFontIcon::LoadFromRaw(
if (currentRow.size() < COL_COUNT_MIN)
{
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Column count lower than min column count (" << COL_COUNT_MIN << ")" << std::endl;
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Column count lower than min column count (" << COL_COUNT_MIN << ")\n";
return true;
}
int index;
if (!ParseInt(index, currentRow[ROW_INDEX]) || index < 0)
{
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Failed to parse index" << std::endl;
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Failed to parse index\n";
return true;
}
@ -240,7 +240,7 @@ bool AssetLoaderFontIcon::LoadFromRaw(
}
else
{
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Unknown row type \"" << currentRow[ROW_TYPE] << "\"" << std::endl;
std::cout << ErrorPrefix(assetName, currentRowIndex) << "Unknown row type \"" << currentRow[ROW_TYPE] << "\"\n";
return true;
}
}

View File

@ -86,7 +86,7 @@ bool AssetLoaderPhysConstraints::LoadFromInfoString(
infoString, physConstraints, zone->m_script_strings, memory, manager, phys_constraints_fields, std::extent_v<decltype(phys_constraints_fields)>);
if (!converter.Convert())
{
std::cout << "Failed to parse phys constraints: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to parse phys constraints: \"" << assetName << "\"\n";
return true;
}
@ -123,7 +123,7 @@ bool AssetLoaderPhysConstraints::LoadFromGdt(
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cout << "Failed to read phys constraints gdt entry: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to read phys constraints gdt entry: \"" << assetName << "\"\n";
return true;
}
@ -146,7 +146,7 @@ bool AssetLoaderPhysConstraints::LoadFromRaw(
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS, *file.m_stream))
{
std::cout << "Failed to read phys constraints raw file: \"" << fileName << "\"" << std::endl;
std::cout << "Failed to read phys constraints raw file: \"" << fileName << "\"\n";
return true;
}

View File

@ -69,7 +69,7 @@ bool AssetLoaderPhysPreset::LoadFromInfoString(
infoString, presetInfo.get(), zone->m_script_strings, memory, manager, phys_preset_fields, std::extent_v<decltype(phys_preset_fields)>);
if (!converter.Convert())
{
std::cout << "Failed to parse phys preset: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to parse phys preset: \"" << assetName << "\"\n";
return true;
}
@ -106,7 +106,7 @@ bool AssetLoaderPhysPreset::LoadFromGdt(
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to read phys preset gdt entry: \"" << assetName << "\"\n";
return true;
}
@ -129,7 +129,7 @@ bool AssetLoaderPhysPreset::LoadFromRaw(
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
{
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"" << std::endl;
std::cout << "Failed to read phys preset raw file: \"" << fileName << "\"\n";
return true;
}

View File

@ -58,7 +58,7 @@ bool AssetLoaderRawFile::LoadAnimtree(
if (ret != Z_STREAM_END)
{
std::cerr << "Deflate failed for loading animtree file \"" << assetName << "\"" << std::endl;
std::cerr << "Deflate failed for loading animtree file \"" << assetName << "\"\n";
deflateEnd(&zs);
return false;
}

View File

@ -247,7 +247,7 @@ bool LoadSoundAliasIndexList(MemoryManager* memory, SndBank* sndBank)
if (freeIdx == std::numeric_limits<unsigned short>::max())
{
std::cerr << "Unable to allocate sound bank alias index list" << std::endl;
std::cerr << "Unable to allocate sound bank alias index list\n";
return false;
}
@ -397,7 +397,7 @@ bool LoadSoundDuckList(ISearchPath* searchPath, MemoryManager* memory, SndBank*
const auto duckFile = searchPath->Open("soundbank/ducks/" + name + ".duk");
if (!duckFile.IsOpen())
{
std::cerr << "Unable to find .duk file for " << name << " in ducklist for sound bank " << sndBank->name << std::endl;
std::cerr << "Unable to find .duk file for " << name << " in ducklist for sound bank " << sndBank->name << "\n";
return false;
}
@ -443,7 +443,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
{
if (assetName.find('.') == std::string::npos)
{
std::cerr << "A language must be specific in the soundbank asset name! (Ex: mpl_common.all)" << std::endl;
std::cerr << "A language must be specific in the soundbank asset name! (Ex: mpl_common.all)\n";
return false;
}
@ -470,7 +470,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
{
if (!LoadSoundRadverbs(memory, sndBank, radverbFile))
{
std::cerr << "Sound Bank reverbs file for " << assetName << " is invalid" << std::endl;
std::cerr << "Sound Bank reverbs file for " << assetName << " is invalid\n";
return false;
}
}
@ -481,7 +481,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
{
if (!LoadSoundDuckList(searchPath, memory, sndBank, duckListFile))
{
std::cerr << "Sound Bank ducklist file for " << assetName << " is invalid" << std::endl;
std::cerr << "Sound Bank ducklist file for " << assetName << " is invalid\n";
return false;
}
}
@ -555,7 +555,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
}
else
{
std::cerr << "Loaded Sound Bank for " << assetName << " failed to generate. Please check your build files." << std::endl;
std::cerr << "Loaded Sound Bank for " << assetName << " failed to generate. Please check your build files.\n";
return false;
}
}
@ -569,7 +569,7 @@ bool AssetLoaderSoundBank::LoadFromRaw(
if (!result)
{
std::cerr << "Streamed Sound Bank for " << assetName << " failed to generate. Please check your build files." << std::endl;
std::cerr << "Streamed Sound Bank for " << assetName << " failed to generate. Please check your build files.\n";
return false;
}
}

View File

@ -55,7 +55,7 @@ bool AssetLoaderTracer::LoadFromInfoString(
InfoStringToTracerConverter converter(infoString, tracer, zone->m_script_strings, memory, manager, tracer_fields, std::extent_v<decltype(tracer_fields)>);
if (!converter.Convert())
{
std::cout << "Failed to parse tracer: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to parse tracer: \"" << assetName << "\"\n";
return true;
}
@ -89,7 +89,7 @@ bool AssetLoaderTracer::LoadFromGdt(
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cout << "Failed to read tracer gdt entry: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to read tracer gdt entry: \"" << assetName << "\"\n";
return true;
}
@ -112,7 +112,7 @@ bool AssetLoaderTracer::LoadFromRaw(
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_TRACER, *file.m_stream))
{
std::cout << "Failed to read tracer raw file: \"" << fileName << "\"" << std::endl;
std::cout << "Failed to read tracer raw file: \"" << fileName << "\"\n";
return true;
}

View File

@ -38,7 +38,7 @@ namespace T6
if (endPtr != &value[value.size()])
{
std::cout << "Failed to parse value \"" << value << "\" as mph" << std::endl;
std::cout << "Failed to parse value \"" << value << "\" as mph\n";
return false;
}
@ -52,7 +52,7 @@ namespace T6
if (endPtr != &value[value.size()])
{
std::cout << "Failed to parse value \"" << value << "\" as pounds" << std::endl;
std::cout << "Failed to parse value \"" << value << "\" as pounds\n";
return false;
}
@ -80,7 +80,7 @@ namespace T6
}
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset) = TEAM_BAD;
std::cout << "Failed to parse value \"" << value << "\" as team" << std::endl;
std::cout << "Failed to parse value \"" << value << "\" as team\n";
return false;
}
@ -118,7 +118,7 @@ bool AssetLoaderVehicle::LoadFromInfoString(
infoString, vehicleDef, zone->m_script_strings, memory, manager, vehicle_fields, std::extent_v<decltype(vehicle_fields)>);
if (!converter.Convert())
{
std::cout << "Failed to parse vehicle: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to parse vehicle: \"" << assetName << "\"\n";
return true;
}
@ -152,7 +152,7 @@ bool AssetLoaderVehicle::LoadFromGdt(
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cout << "Failed to read vehicle gdt entry: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to read vehicle gdt entry: \"" << assetName << "\"\n";
return true;
}
@ -175,7 +175,7 @@ bool AssetLoaderVehicle::LoadFromRaw(
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_VEHICLE, *file.m_stream))
{
std::cout << "Failed to read vehicle raw file: \"" << fileName << "\"" << std::endl;
std::cout << "Failed to read vehicle raw file: \"" << fileName << "\"\n";
return true;
}

View File

@ -67,7 +67,7 @@ bool AssetLoaderZBarrier::LoadFromInfoString(
infoString, zbarrier, zone->m_script_strings, memory, manager, zbarrier_fields, std::extent_v<decltype(zbarrier_fields)>);
if (!converter.Convert())
{
std::cout << "Failed to parse zbarrier: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to parse zbarrier: \"" << assetName << "\"\n";
return true;
}
@ -103,7 +103,7 @@ bool AssetLoaderZBarrier::LoadFromGdt(
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cout << "Failed to read zbarrier gdt entry: \"" << assetName << "\"" << std::endl;
std::cout << "Failed to read zbarrier gdt entry: \"" << assetName << "\"\n";
return true;
}
@ -126,7 +126,7 @@ bool AssetLoaderZBarrier::LoadFromRaw(
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_ZBARRIER, *file.m_stream))
{
std::cout << "Failed to read zbarrier raw file: \"" << fileName << "\"" << std::endl;
std::cout << "Failed to read zbarrier raw file: \"" << fileName << "\"\n";
return true;
}

View File

@ -80,7 +80,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (fx == nullptr)
{
std::cout << "Failed to load fx asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load fx asset \"" << value << "\"\n";
return false;
}
@ -102,7 +102,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (xmodel == nullptr)
{
std::cout << "Failed to load xmodel asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load xmodel asset \"" << value << "\"\n";
return false;
}
@ -125,7 +125,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (material == nullptr)
{
std::cout << "Failed to load material asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load material asset \"" << value << "\"\n";
return false;
}
@ -147,7 +147,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (physPreset == nullptr)
{
std::cout << "Failed to load physpreset asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load physpreset asset \"" << value << "\"\n";
return false;
}
@ -172,7 +172,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (tracer == nullptr)
{
std::cout << "Failed to load tracer asset \"" << value << "\"" << std::endl;
std::cout << "Failed to load tracer asset \"" << value << "\"\n";
return false;
}
@ -187,7 +187,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
unsigned int soundAliasHash;
if (!GetHashValue(value, soundAliasHash))
{
std::cout << "Failed to parse value \"" << value << "\" as hash" << std::endl;
std::cout << "Failed to parse value \"" << value << "\" as hash\n";
return false;
}

View File

@ -118,13 +118,13 @@ namespace T6
SoundBank* ObjLoader::LoadSoundBankForZone(ISearchPath* searchPath, const std::string& soundBankFileName, Zone* zone)
{
if (ObjLoading::Configuration.Verbose)
std::cout << "Trying to load sound bank '" << soundBankFileName << "' for zone '" << zone->m_name << "'" << std::endl;
std::cout << "Trying to load sound bank '" << soundBankFileName << "' for zone '" << zone->m_name << "'\n";
auto* existingSoundBank = SoundBank::Repository.GetContainerByName(soundBankFileName);
if (existingSoundBank != nullptr)
{
if (ObjLoading::Configuration.Verbose)
std::cout << "Referencing loaded sound bank '" << soundBankFileName << "'." << std::endl;
std::cout << "Referencing loaded sound bank '" << soundBankFileName << "'.\n";
SoundBank::Repository.AddContainerReference(existingSoundBank, zone);
return existingSoundBank;
@ -138,19 +138,19 @@ namespace T6
if (!sndBank->Initialize())
{
std::cout << "Failed to load sound bank '" << soundBankFileName << "'" << std::endl;
std::cout << "Failed to load sound bank '" << soundBankFileName << "'\n";
return nullptr;
}
SoundBank::Repository.AddContainer(std::move(sndBank), zone);
if (ObjLoading::Configuration.Verbose)
std::cout << "Found and loaded sound bank '" << soundBankFileName << "'" << std::endl;
std::cout << "Found and loaded sound bank '" << soundBankFileName << "'\n";
return sndBankPtr;
}
std::cout << "Failed to load sound bank '" << soundBankFileName << "'" << std::endl;
std::cout << "Failed to load sound bank '" << soundBankFileName << "'\n";
return nullptr;
}
@ -169,7 +169,7 @@ namespace T6
{
if (!VerifySoundBankChecksum(soundBank, *sndBankLinkedInfo))
{
std::cout << "Checksum of sound bank does not match link time checksum for '" << soundBankFileName << "'" << std::endl;
std::cout << "Checksum of sound bank does not match link time checksum for '" << soundBankFileName << "'\n";
}
loadedBanksForZone.emplace(soundBankFileName);