changeset 5:4d62b5fa9650

Cleanups, bugfixes.
author ccr@tnsp.org
date Sat, 25 Dec 2010 18:31:45 +0200
parents 78d82d18ce7f
children 828c52495a9a
files index.php
diffstat 1 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Sat Dec 18 16:42:00 2010 +0200
+++ b/index.php	Sat Dec 25 18:31:45 2010 +0200
@@ -217,17 +217,22 @@
   }
 }
 
-if (filemtime("herb.txt") > filemtime("cache.php")) {
+if (filemtime("herb.txt") > filemtime("cache.php"))
+#if (1)
+{
+$file = fopen("herb.txt", "r");
+while (($line = fgets($file)) !== FALSE) {
+ list ($m, $o, $h, $r) = preg_split("/\s+/", trim($line), 4);
 
-$file = fopen("herb.txt","r");
-while (($data = fgetcsv($file, 160, " ")) !== FALSE) {
- $m=$data[0];$o=$data[1];$h=$data[2];$r=$data[3];
- $mn=array_search($m,$minerals);
- $on=array_search($o,$organs);
- $hn=multi_array_search($h,$herbs);
- $hn=$hn[0];
+#echo "'$m' : '$o' : '$h' : '$r'<br>\n";
+
+ $mn = array_search($m, $minerals);
+ $on = array_search($o, $organs);
+ $hn = multi_array_search($h, $herbs);
+ $hn = $hn[0];
+
  if ($r=="-") {
-   $res="nothing";
+   $res = "nothing";
    for ($x=1;$x<55;$x++)
      if ($db[$x][$on][$hn][0]!="!")
        $db[$x][$on][$hn][0]="-";
@@ -240,7 +245,7 @@
    $db[$mn][$on][$hn][1]="-";
  }
  if ($r[0]=="?") {
-   $res="possible $r";
+   $res = "possible $r";
    if ($r[1]!="?")
      $mat[$r][]=array($mn,$on,$hn);
    if ($db[$mn][$on][$hn][0]=="-")
@@ -265,7 +270,8 @@
      $db[$mn][$y][$hn][1]="*";
    for ($z=0;$z<30;$z++)
      if ($db[$mn][$on][$z][1]=="")
-     $db[$mn][$on][$z][1]="*"; */
+     $db[$mn][$on][$z][1]="*";
+*/
    $db[$mn][$on][$hn]=$r;
  }
 }
@@ -386,7 +392,7 @@
 
 if ($base=="min") {
 
-  if ($active_min==""||$active_min<0 ||$active_min>53) $active_min=0;
+  if ($active_min==""||$active_min<0 ||$active_min>54) $active_min=0;
   echo "<table border=1 cellspacing=0>";
   echo "<tr>";
   for ($z=1;$z<19;$z++) {