1
1
forked from 0ad/0ad

Be more robust to broken terrain property files.

This was SVN commit r8888.
This commit is contained in:
Ykkrosh 2011-02-05 13:13:57 +00:00
parent caad072347
commit bf3d5c75f0
4 changed files with 7 additions and 4 deletions

View File

@ -98,7 +98,7 @@ CStr8 CTerrain::GetMovementClass(ssize_t i, ssize_t j) const
{
CMiniPatch* tile = GetTile(i, j);
if (tile && tile->GetTextureEntry())
return tile->GetTextureEntry()->GetProperties()->GetMovementClass();
return tile->GetTextureEntry()->GetProperties().GetMovementClass();
return "default";
}

View File

@ -33,6 +33,8 @@ CTerrainTextureEntry::CTerrainTextureEntry(CTerrainPropertiesPtr props, const Vf
m_BaseColor(0),
m_BaseColorValid(false)
{
debug_assert(props);
CTextureProperties texture(path);
texture.SetWrap(GL_REPEAT);

View File

@ -68,8 +68,8 @@ public:
CStr GetTag() const
{ return m_Tag; }
CTerrainPropertiesPtr GetProperties() const
{ return m_pProperties; }
const CTerrainProperties& GetProperties() const
{ return *m_pProperties; }
// Get texture handle, load texture if not loaded.
const CTexturePtr& GetTexture() {

View File

@ -194,7 +194,8 @@ void CTerrainTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& paren
int CTerrainTextureManager::LoadTerrainTextures()
{
RecurseDirectory(CTerrainPropertiesPtr(), L"art/textures/terrain/types/");
CTerrainPropertiesPtr rootProps(new CTerrainProperties(CTerrainPropertiesPtr()));
RecurseDirectory(rootProps, L"art/textures/terrain/types/");
return 0;
}