CLineRenderer fixes

This commit is contained in:
Jack Andersen 2017-11-15 17:24:20 -10:00
parent f1329268a6
commit 21505e46ce
2 changed files with 3 additions and 8 deletions

View File

@ -172,11 +172,8 @@ FourCC CResLoader::GetResourceTypeById(CAssetId id) const
const SObjectTag* CResLoader::GetResourceIdByName(std::string_view name) const const SObjectTag* CResLoader::GetResourceIdByName(std::string_view name) const
{ {
for (const std::unique_ptr<CPakFile>& file : x18_pakLoadedList) for (const std::unique_ptr<CPakFile>& file : x18_pakLoadedList)
{ if (const SObjectTag* id = file->GetResIdByName(name))
const SObjectTag* id = file->GetResIdByName(name);
if (id)
return id; return id;
}
return nullptr; return nullptr;
} }
@ -312,13 +309,9 @@ void CResLoader::EnumerateResources(const std::function<bool(const SObjectTag&)>
void CResLoader::EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const void CResLoader::EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const
{ {
for (auto it = x18_pakLoadedList.begin() ; it != x18_pakLoadedList.end() ; ++it) for (auto it = x18_pakLoadedList.begin() ; it != x18_pakLoadedList.end() ; ++it)
{
for (const auto& name : (*it)->GetNameList()) for (const auto& name : (*it)->GetNameList())
{
if (!lambda(name.first, name.second)) if (!lambda(name.first, name.second))
return; return;
}
}
} }
} }

View File

@ -106,6 +106,8 @@ static zeus::CVector2f IntersectLines(const zeus::CVector2f& pa1, const zeus::CV
zeus::CVector2f pa1mpa2 = pa1 - pa2; zeus::CVector2f pa1mpa2 = pa1 - pa2;
zeus::CVector2f pb1mpb2 = pb1 - pb2; zeus::CVector2f pb1mpb2 = pb1 - pb2;
float denom = pa1mpa2.x * pb1mpb2.y - pa1mpa2.y * pb1mpb2.x; float denom = pa1mpa2.x * pb1mpb2.y - pa1mpa2.y * pb1mpb2.x;
if (denom < 0.0001f)
return pa2;
float numt1 = pa1.x * pa2.y - pa1.y * pa2.x; float numt1 = pa1.x * pa2.y - pa1.y * pa2.x;
float numt2 = pb1.x * pb2.y - pb1.y * pb2.x; float numt2 = pb1.x * pb2.y - pb1.y * pb2.x;
return {(numt1 * pb1mpb2.x - pa1mpa2.x * numt2) / denom, return {(numt1 * pb1mpb2.x - pa1mpa2.x * numt2) / denom,