From 263a338c0c3648cfa2388d4a21584a09294ffd9e Mon Sep 17 00:00:00 2001 From: sf17k Date: Fri, 3 Jun 2011 15:57:10 -0400 Subject: [PATCH] glDeleteTextures safely ignores zeroes --- Source/GameInitDispose.cpp | 13 ++++--------- Source/Models.cpp | 2 +- Source/Objects.cpp | 8 ++++---- Source/Skybox.cpp | 12 ++++++------ Source/Sprite.cpp | 22 +++++++++++----------- Source/Terrain.cpp | 14 +++++++------- Source/Text.cpp | 2 +- Source/Texture.cpp | 3 +-- Source/Weapons.cpp | 14 +++++++------- 9 files changed, 42 insertions(+), 48 deletions(-) diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index ee82765..8c09179 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -142,17 +142,15 @@ void Game::deleteGame(){ delete skybox; if(text) delete text; - for(int i=0;i<10;i++){ - if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] ); - } + glDeleteTextures( 10, &Mainmenuitems[0] ); glDeleteTextures( 1, &cursortexture ); glDeleteTextures( 1, &Maparrowtexture ); glDeleteTextures( 1, &Mapboxtexture ); glDeleteTextures( 1, &Mapcircletexture ); glDeleteTextures( 1, &terraintexture ); glDeleteTextures( 1, &terraintexture2 ); - if(screentexture>0)glDeleteTextures( 1, &screentexture ); - if(screentexture2>0)glDeleteTextures( 1, &screentexture2 ); + glDeleteTextures( 1, &screentexture ); + glDeleteTextures( 1, &screentexture2 ); glDeleteTextures( 1, &hawktexture ); glDeleteTextures( 1, &logotexture ); glDeleteTextures( 1, &loadscreentexture ); @@ -754,10 +752,7 @@ void Game::LoadStuff() for(i=0;i