[Scummvm-cvs-logs] SF.net SVN: scummvm: [27857] web/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Jul 2 22:21:27 CEST 2007


Revision: 27857
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27857&view=rev
Author:   fingolfin
Date:     2007-07-02 13:21:27 -0700 (Mon, 02 Jul 2007)

Log Message:
-----------
Changed the way scrcatnums works

Modified Paths:
--------------
    web/trunk/include/scr-categories.php
    web/trunk/include/screenshots.php
    web/trunk/index.php
    web/trunk/screenshots.php

Modified: web/trunk/include/scr-categories.php
===================================================================
--- web/trunk/include/scr-categories.php	2007-07-02 20:06:57 UTC (rev 27856)
+++ web/trunk/include/scr-categories.php	2007-07-02 20:21:27 UTC (rev 27857)
@@ -57,7 +57,7 @@
       echo "<tr><td class='cat-bullet'><img src='$file_root/images/".$cat['filename'].
       	"' alt=\"\"></td><td class='cat-link'><a href=\"?cat1=".$this->_catnum."&cat2=".$cat['catnum']."\">".
       	$cat['description'].
-      	"</a> <font class='cat-count'>(".$scrcatnums[$this->_catnum][$cat['catnum']]." shots)</font></td></tr>\n";
+      	"</a> <font class='cat-count'>(".count($scrcatnums[$this->_catnum][$cat['catnum']])." shots)</font></td></tr>\n";
     }
     echo "</table>\n";
   }

Modified: web/trunk/include/screenshots.php
===================================================================
--- web/trunk/include/screenshots.php	2007-07-02 20:06:57 UTC (rev 27856)
+++ web/trunk/include/screenshots.php	2007-07-02 20:21:27 UTC (rev 27857)
@@ -56,6 +56,7 @@
 		} else {
 			$data = explode('|', $line);
 
+			// Compute an "id" consisting of category, subcategory and running number.
 			$id = $data[0]."_".$data[1]."_".$data[2];
 
 			// Push the three-number-id into an array (mainly used for selecting random screenshots)
@@ -65,15 +66,10 @@
 			// Store the screenshot caption from $data[4]
 			$scrcaption[$id] = $data[4];
 
-			// Update scrcatnums map
-			if (!array_key_exists($data[0], $scrcatnums) or
-			  !array_key_exists($data[1], $scrcatnums[$data[0]])) {
-				$scrcatnums[$data[0]][$data[1]] = 0;
-			}
-
-			if ($scrcatnums[$data[0]][$data[1]] < $data[2] + 1)
-				$scrcatnums[$data[0]][$data[1]] = $data[2] + 1;
-
+			// Insert into a table of screenshots which is indexed by category & subcategory.
+			if (!isset($scrcatnums[$data[0]][$data[1]]))
+				$scrcatnums[$data[0]][$data[1]] = array();
+			array_push($scrcatnums[$data[0]][$data[1]], $id);
 		}
 	}
 

Modified: web/trunk/index.php
===================================================================
--- web/trunk/index.php	2007-07-02 20:06:57 UTC (rev 27856)
+++ web/trunk/index.php	2007-07-02 20:21:27 UTC (rev 27857)
@@ -27,6 +27,9 @@
 } else {
   $randImg = $lastLECshot + rand(0, count($screenshots) - $lastLECshot - 1);
 }
+
+// TODO: The screenshotIds should contain tuples:
+//   The path to the thumb, *plus* the category triple used to identify the screenshot
 ?>
 
 <script type="text/javascript">

Modified: web/trunk/screenshots.php
===================================================================
--- web/trunk/screenshots.php	2007-07-02 20:06:57 UTC (rev 27856)
+++ web/trunk/screenshots.php	2007-07-02 20:21:27 UTC (rev 27857)
@@ -112,9 +112,7 @@
     if ($cat1 == $i->_catnum || $cat1 == -1) {
       foreach ($i->_list as $j) {
         if ($cat2 == $j['catnum'] || $cat2 == -1) {
-          for ($k = 0; $k < $scrcatnums[$i->_catnum][$j['catnum']]; $k++) {
-            array_push($showlist, $i->_catnum."_".$j['catnum']."_{$k}");
-	  }
+          $showlist = array_merge($showlist, $scrcatnums[$i->_catnum][$j['catnum']]);
         }
       }
     }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list