Mercurial > hg > batmud > materials
changeset 27:14b31c98ddb4
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 07 Feb 2017 17:02:28 +0200 |
parents | 78743f558d3b |
children | 3c7d311249e3 |
files | info.php |
diffstat | 1 files changed, 17 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/info.php Tue Feb 07 17:01:38 2017 +0200 +++ b/info.php Tue Feb 07 17:02:28 2017 +0200 @@ -314,6 +314,9 @@ // // Show alloy combinations table for this material // + $mtype = $matDataTable[$setShowMat][14]; + $is_alloy = $mtype == 4 || $mtype == 7; + echo "<h3>Alloy combinations</h3>\n"; if (isset($alloyRevTable[$setShowMat])) { @@ -339,15 +342,21 @@ $mats = []; foreach ($matDataTable as $name => $data) { - if ($data[14] == $matDataTable[$setShowMat][14] && $name != $setShowMat) - $mats[] = $name; + if ( + ($is_alloy && ($data[14] == 4 || $data[14] == 7)) || + $mtype == $data[14]) + $mats[$name] = TRUE; } + unset($mats[$setShowMat]); - echo "<p>Full mix: ".implode(" <b>+</b> ", - array_map(function($pval){ return stGetMatLink($pval); }, $mats)). + echo + "<p>Full mix: ".implode(" <b>+</b> ", + array_map(function($pval){ return stGetMatLink($pval); }, array_keys($mats))). " = <b>".chentities($setShowMat)."</b></p>\n"; - echo "<p>use alloying at ".implode(",", $mats)." in ".strtolower($matTransTable[14][$matDataTable[$setShowMat][14]])."_bench</p>\n"; + echo + "<p>use alloying at ".implode(",", array_keys($mats)). + " in ".strtolower($matTransTable[14][$mtype])."_bench</p>\n"; } // @@ -356,7 +365,9 @@ echo "<h3>Mixtable</h3>\n"; if (count($alloyTable[$setShowMat]) > 0) { - stPrintAlloyTable("alloyTable", [$setShowMat], array_keys($alloyTable[$setShowMat]), FALSE); + stPrintAlloyTable("alloyTable", [$setShowMat], + array_keys($alloyTable[$setShowMat]), + FALSE); } else {