fix #757 - waves are blue again now

stable-5.3
Tobias Zwick 2012-10-13 16:27:15 +02:00
parent cf159068b3
commit 42011a9442
3 changed files with 10 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -372,7 +372,16 @@ static Nillable<long> FnGetAverageTextureColor(C4PropList * _this, C4String* Tex
// Safety
if(!Texture) return C4Void();
// Check texture
C4Texture* Tex = ::TextureMap.GetTexture(Texture->GetData().getData());
StdStrBuf texture_name;
texture_name.Ref(Texture->GetCStr());
const char* pch = strchr(texture_name.getData(), '-');
if (pch != NULL)
{
size_t len = pch - texture_name.getData();
texture_name.Copy();
texture_name.SetLength(len);
}
C4Texture* Tex = ::TextureMap.GetTexture(texture_name.getData());
if(!Tex) return C4Void();
return Tex->GetAverageColor();
}