示例#1
0
 public static function dispTerrMapWithDeposits($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=0 border=1>";
         for ($y = 0; $y < $maxGridsPerDimension; $y++) {
             $result .= "<tr>";
             for ($x = 0; $x < $maxGridsPerDimension; $x++) {
                 $terr_char = $terr_map_1D_array[$y * $maxGridsPerDimension + $x];
                 $result .= '<td align="center" title="' . \planets::getDepositTextLong($pid, $x, $y) . '" valign="middle" style="background-image: url(' . \planets::getTerrainImg($terr_char) . ')" height=35 width=35>';
                 $result .= \planets::getDepositImg($pid, $x, $y);
                 $result .= "</td>";
             }
             $result .= "</tr>";
         }
         $result .= "</table>";
     }
     return $result;
 }