diff --git a/Source/UserInterface/Installer.cpp b/Source/UserInterface/Installer.cpp index 6cf98ff5..95fc5ca0 100644 --- a/Source/UserInterface/Installer.cpp +++ b/Source/UserInterface/Installer.cpp @@ -244,15 +244,19 @@ void terBuildingInstaller::SetBuildPosition(const Vect3f& position,float angle, void terBuildingInstaller::InitTexture() { - RELEASE(pTexture); - - int dx = 1 << (BitSR(BaseBuffSX) + 1); - int dy = 1 << (BitSR(BaseBuffSY) + 1); - dx = dy = max(dx,dy); - pTexture = terVisGeneric->CreateTexture(dx,dy,true); - if (!pTexture) return; - int Pitch; + int dx = 1 << (BitSR(BaseBuffSX) + 1); + int dy = 1 << (BitSR(BaseBuffSY) + 1); + dx = dy = max(dx,dy); + + //Not big enough, allocate new texture + if (!pTexture || pTexture->GetWidth() < dx || pTexture->GetHeight() < dy) { + RELEASE(pTexture); + pTexture = terVisGeneric->CreateTexture(1024,1024,true); + if (!pTexture) return; + } + + int Pitch; uint8_t* buf = pTexture->LockTexture(Pitch); if (buf) { for (int y = 0; y < dy; y++) {