Mercurial > hg > batmud > misc
changeset 326:03963c456ed8 misc
Sprinkle in some comments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 31 Dec 2015 03:00:50 +0200 |
parents | b65e0d6efe9d |
children | fd471bd4e013 |
files | materials/info.php |
diffstat | 1 files changed, 30 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/materials/info.php Thu Dec 31 02:59:54 2015 +0200 +++ b/materials/info.php Thu Dec 31 03:00:50 2015 +0200 @@ -11,12 +11,16 @@ $pageIndex = "info.php"; +// Static list of alloy data contributors $contributors = [ "Hair", "Malacoda", "Kiomet", "Aegenor", "Gileon", "Corto", ]; +// Material type table for the type selector. +// Because some types are combinations, we need to have +// mappings for those (the last two columns) $matTypeTable = [ 0 => ["Organic + cloth (sewing)" , 0, 1], @@ -37,6 +41,10 @@ ]; +// Define ranges for alloy tests' "reliability" based +// on how many tests have been performed. Define the +// lower and upper bound (inclusive), informative text +// and CSS style for those items. $matReliability = [ [ 1, 2, "1-2 tests", "background: #a00; color: white;" ], @@ -78,6 +86,8 @@ $setSwapRows = (isset($_GET["swap"]) && is_array($_GET["swap"])) ? $_GET["swap"] : array(); + +// Generate CSS and information snippets into temporary arrays $extraCSS = []; $extraInfo = []; foreach ($matReliability as $chk) @@ -90,6 +100,10 @@ $extraInfo[] = "<span class=\"hits".$chk[0]."to".$chk[1]."\"><b>".$chk[2]."</b></span>"; } + +// +// Let's start pooping out the page +// cmPrintPageHeader($pageTitle, " <meta name=\"robots\" content=\"nofollow\" /> <style type=\"text/css\"> @@ -132,6 +146,7 @@ " <td class=\"icenter\">\n". " <select name=\"o\">\n"; +// Output the type selectors foreach ($matTypeTable as $key => $value) { $n = 0; @@ -160,8 +175,14 @@ "</table>\n". "</form>\n"; +// +// Now, act accordingly .. +// if (isset($setShowMat)) { + // + // We are showing information about one specific material + // if (!isset($matDataTable[$setShowMat])) { echo @@ -194,6 +215,9 @@ } echo "</tr>\n</table>\n"; + // + // Show alloy combinations table for this material + // echo "<h3>Alloy combinations</h3>\n"; if (isset($alloyRevTable[$setShowMat])) { @@ -218,6 +242,9 @@ } else { + // + // No alloy combos known, show "generic" formula + // echo "<p>No known alloy combinations.</p>\n"; } @@ -272,9 +299,9 @@ } else { - /* - * Print alloy table for given material type - */ + // + // Print alloy table for given material type + // // Filter table from maintable matching desired material type(s) $currTable = []; foreach ($matDataTable as $name => $data) @@ -305,7 +332,6 @@ } } - // Print out the table echo "<table class=\"alloyTable\">".