コード例 #1
0
ファイル: planet_lib.php プロジェクト: TCS13/SWCPM
 public static function dispHTMLMapWithDeposits($pid)
 {
     $result = '';
     if (\planets::planetExists($pid)) {
         $planet = mysql_query("SELECT * FROM " . $GLOBALS['DB_table_prefix'] . "planets WHERE planet_uid = '{$pid}'");
         $plan_terr = mysql_result($planet, 0, 'plan_terr');
         $terr_map_1D_array = str_split($plan_terr);
         $maxGridsPerDimension = sqrt(count($terr_map_1D_array));
         $result = "<table cellpadding=10 border=1>";
         for ($y = 0; $y < $maxGridsPerDimension; $y++) {
             $result .= "<tr>";
             for ($x = 0; $x < $maxGridsPerDimension; $x++) {
                 $result .= "<td align='center'>";
                 $terr_char = $terr_map_1D_array[$y * $maxGridsPerDimension + $x];
                 $result .= \planets::getTerrainName($terr_char);
                 $depText = \planets::getDepositText($pid, $x, $y);
                 if ($depText != '') {
                     $result .= "<br/>" . $depText;
                 }
                 $result .= "</td>";
             }
             $result .= "</tr>";
         }
         $result .= "</table>";
     }
     return $result;
 }