]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/maplist.qc
micro-optimization chore: in for-loops change all post-{in,de}crements to pre-{in...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / maplist.qc
index 72421150852367bb1379ccc6427cbef05cec4a37..89748e85c3647dda4ac36afc3c06e08e83f3a166 100644 (file)
@@ -80,7 +80,7 @@ void XonoticMapList_draw(entity me)
 {
        if(me.startButton)
                me.startButton.disabled = ((me.selectedItem < 0) || (me.selectedItem >= me.nItems)
-                       || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED) && cvar("g_campaign")));
+                       || ((gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) && cvar("g_campaign")));
        SUPER(XonoticMapList).draw(me);
 }
 
@@ -157,7 +157,12 @@ void XonoticMapList_drawListBoxItem(entity me, int i, vector absSize, bool isSel
        }
 
        if(draw_PictureSize(strcat("/maps/", MapInfo_Map_bspname)) == '0 0 0')
-               draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+       {
+               if(!draw_PictureExists(strcat("/levelshots/", MapInfo_Map_bspname)))
+                       draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+               else
+                       draw_Picture(me.columnPreviewOrigin * eX, strcat("/levelshots/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+       }
        else
                draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
 
@@ -229,7 +234,7 @@ void MapList_Add_Shown(entity btn, entity me)
 {
        float i, n;
        n = strlen(me.g_maplistCache);
-       for (i = 0 ; i < n; i++)
+       for (i = 0 ; i < n; ++i)
        {
                if (!me.g_maplistCacheQuery(me, i))
                        me.g_maplistCacheToggle(me, i);
@@ -241,7 +246,7 @@ void MapList_Remove_Shown(entity btn, entity me)
 {
        float i, n;
        n = strlen(me.g_maplistCache);
-       for (i = 0 ; i < n; i++)
+       for (i = 0 ; i < n; ++i)
        {
                if (me.g_maplistCacheQuery(me, i))
                        me.g_maplistCacheToggle(me, i);