diff UIPopup.cpp @ 948:5a2dbb00c399

Code cleaning.
author Nomad
date Wed, 01 May 2013 17:31:10 +0200
parents 9be9afdbeac3
children c0d0656aa662
line wrap: on
line diff
--- a/UIPopup.cpp	Wed May 01 14:30:02 2013 +0200
+++ b/UIPopup.cpp	Wed May 01 17:31:10 2013 +0200
@@ -72,13 +72,12 @@
     a2a = uX;
     a4 = uX + uWidth;
     pRenderer->SetTextureClipRect(uX, v4, uX + uWidth, v4 + uHeight);
-    v5 = (Texture *)(uTextureID_Parchment != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Parchment] : 0);
-    uTileWidth = (uTextureID_Parchment != -1 ? pIcons_LOD->pTextures[uTextureID_Parchment].uTextureWidth : 24);
-    v13 = (uTextureID_Parchment != -1 ? pIcons_LOD->pTextures[uTextureID_Parchment].uTextureWidth : 24);
-    uTileHeight = (uTextureID_Parchment != -1 ? pIcons_LOD->pTextures[uTextureID_Parchment].uTextureHeight : 26);
-    if ( (uTextureID_Parchment != -1 ? pIcons_LOD->pTextures[uTextureID_Parchment].uTextureWidth : 24)
-        && (uTextureID_Parchment != -1 ? pIcons_LOD->pTextures[uTextureID_Parchment].uTextureHeight : 26) )
-        {
+    v5 = pIcons_LOD->GetTexture(uTextureID_Parchment);
+    uTileWidth = v5->uTextureWidth;
+    v13 = v5->uTextureWidth;
+    uTileHeight = v5->uTextureHeight;
+    if ( v5->uTextureWidth && v5->uTextureHeight)
+    {
         uNumXTiles = (signed int)uWidth / uTileWidth;
         if ( (signed int)uWidth % uTileWidth )
             ++uNumXTiles;
@@ -106,59 +105,29 @@
             }
             while ( v8 < (signed int)uHeight / uTileHeight );
             a5a = v4 + uHeight - 32;
-            pRenderer->DrawTextureTransparent(
-                a2a,
-                v4,
-                (Texture *)(uTextureID_5076AC != -1 ? &pIcons_LOD->pTextures[uTextureID_5076AC] : 0));
-            pRenderer->DrawTextureTransparent(
-                a2a,
-                a5a,
-                (Texture *)(uTextureID_5076B4 != -1 ? &pIcons_LOD->pTextures[uTextureID_5076B4] : 0));
-            pRenderer->DrawTextureTransparent(
-                a4 - 32,
-                v4,
-                (Texture *)(uTextureID_5076A8 != -1 ? &pIcons_LOD->pTextures[uTextureID_5076A8] : 0));
-            pRenderer->DrawTextureTransparent(
-                a4 - 32,
-                a5a,
-                (Texture *)(uTextureID_5076B0 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_5076B0] : 0));
+            pRenderer->DrawTextureTransparent(a2a, v4, pIcons_LOD->GetTexture(uTextureID_5076AC));
+            pRenderer->DrawTextureTransparent(a2a, a5a, pIcons_LOD->GetTexture(uTextureID_5076B4));
+            pRenderer->DrawTextureTransparent(a4 - 32, v4, pIcons_LOD->GetTexture(uTextureID_5076A8));
+            pRenderer->DrawTextureTransparent(a4 - 32, a5a, pIcons_LOD->GetTexture(uTextureID_5076B0));
             uNumXTilesb = a2a + 32;
             v22 = v4 + uHeight - 10;
             if ( (signed int)uWidth > 64 )
                 {
                 pRenderer->SetTextureClipRect(a2a + 32, v4, a4 - 32, v4 + uHeight);
-                pRenderer->DrawTextureTransparent(
-                    uNumXTilesb,
-                    v4,
-                    (Texture *)(uTextureID_507698 != -1 ? &pIcons_LOD->pTextures[uTextureID_507698] : 0));
-                pRenderer->DrawTextureTransparent(
-                    uNumXTilesb,
-                    v22,
-                    (Texture *)(uTextureID_5076A4 != -1 ? &pIcons_LOD->pTextures[uTextureID_5076A4] : 0));
+                pRenderer->DrawTextureTransparent(uNumXTilesb, v4, pIcons_LOD->GetTexture(uTextureID_507698));
+                pRenderer->DrawTextureTransparent(uNumXTilesb, v22, pIcons_LOD->GetTexture(uTextureID_5076A4));
                 if ( (signed int)uWidth > 512 )
                     {
-                    pRenderer->DrawTextureTransparent(
-                        a2a + 544,
-                        v4,
-                        (Texture *)(uTextureID_507698 != -1 ? &pIcons_LOD->pTextures[uTextureID_507698] : 0));
-                    pRenderer->DrawTextureTransparent(
-                        a2a + 544,
-                        v22,
-                        (Texture *)(uTextureID_5076A4 != -1 ? &pIcons_LOD->pTextures[uTextureID_5076A4] : 0));
+                    pRenderer->DrawTextureTransparent(a2a + 544, v4, pIcons_LOD->GetTexture(uTextureID_507698));
+                    pRenderer->DrawTextureTransparent(a2a + 544, v22, pIcons_LOD->GetTexture(uTextureID_5076A4));
                     }
                 }
             v9 = v4 + 32;
             if ( (signed int)uHeight > 64 )
                 {
                 pRenderer->SetTextureClipRect(a2a, v9, a4, a5a);
-                pRenderer->DrawTextureTransparent(
-                    a2a,
-                    v9,
-                    (Texture *)(uTextureID_5076A0 != -1 ? &pIcons_LOD->pTextures[uTextureID_5076A0] : 0));
-                pRenderer->DrawTextureTransparent(
-                    a4 - 10,
-                    v9,
-                    (Texture *)(uTextureID_50769C != -1 ? &pIcons_LOD->pTextures[uTextureID_50769C] : 0));
+                pRenderer->DrawTextureTransparent(a2a, v9, pIcons_LOD->GetTexture(uTextureID_5076A0));
+                pRenderer->DrawTextureTransparent(a4 - 10, v9, pIcons_LOD->GetTexture(uTextureID_50769C));
                 }
             pRenderer->ResetTextureClipRect();
         }