Example #1
0
 function readIslandsFile()
 {
     global $init;
     $fileName = "{$init->dirName}/hakojima.dat";
     if (!is_file($fileName)) {
         return false;
     }
     $fp = fopen($fileName, "r");
     AllyUtil::lockr($fp);
     $this->islandTurn = chop(fgets($fp, READ_LINE));
     $this->islandLastTime = chop(fgets($fp, READ_LINE));
     $this->islandNumber = chop(fgets($fp, READ_LINE));
     $this->islandNextID = chop(fgets($fp, READ_LINE));
     for ($i = 0; $i < $this->islandNumber; $i++) {
         $this->islands[$i] = $this->readIsland($fp);
         $this->idToNumber[$this->islands[$i]['id']] = $i;
         $this->islands[$i]['allyId'] = array();
     }
     AllyUtil::unlock($fp);
     fclose($fp);
     if ($init->allyUse) {
         $this->readAllyFile();
     }
     return true;
 }