changeset 5:a2cb596c8332

Clean up the full alloy mix computation a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 03 Jan 2016 03:47:03 +0200
parents 11e9da68c9c4
children 1c3060b27133
files info.php
diffstat 1 files changed, 4 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/info.php	Sun Jan 03 03:46:42 2016 +0200
+++ b/info.php	Sun Jan 03 03:47:03 2016 +0200
@@ -282,20 +282,15 @@
       //
       echo "<p>No known alloy combinations.</p>\n";
 
-      $typeMats = [];
+      // Make a list of materials that match the desired material type
+      $mats = [];
       foreach ($matDataTable as $name => $data)
       {
         if ($data[14] == $matDataTable[$setShowMat][14] && $name != $setShowMat)
-          $typeMats[] = $name;
+          $mats[] = stGetMatLink($name);
       }
 
-      echo "<p>Full mix: ";
-      if (list($a, $b) = each($typeMats))
-        echo stGetMatLink($b);
-          
-      while (list($a, $b) = each($typeMats))
-        echo " <b>+</b> ".stGetMatLink($b);
-      echo "</p>\n";
+      echo "<p>Full mix: ".implode(" <b>+</b> ", $mats)." = ".stGetMatLink($setShowMat)."</p>\n";
     }
 
     //