Fleet blocked

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Fleet blocked

      Hello,
      After month of playing 2moons i am getting error while sending colonisation.
      Requirements for colonisation are ok. I have enough slots for new planet.

      When fleets arrive i get error in log and fleet is bloked.

      Error:

      Source Code

      1. [17-Dec-2016 21:59:23] NOTICE: "Undefined variable: PlanetData"
      2. File: /data/web/virtuals/145387/virtual/www/includes/functions/CreateOnePlanetRecord.php | Line: 48
      3. URL: http://solaris-online.cz/game.php | Version: V 1.0
      4. Stack trace:
      5. #0 /includes/functions/CreateOnePlanetRecord.php(48): errorHandler(8, 'Undefined varia...', '/data/web/virtu...', 48, Array)
      6. #1 /includes/classes/missions/MissionCaseColonisation.php(66): CreateOnePlanetRecord('7', '7', '6', '1', '9', 'Colony', false, '0')
      7. #2 /includes/classes/class.FlyingFleetHandler.php(82): MissionCaseColonisation->TargetEvent()
      8. #3 /includes/FleetHandler.php(16): FlyingFleetHandler->run()
      9. #4 /includes/common.php(126): require('/data/web/virtu...')
      10. #5 /game.php(10): require('/data/web/virtu...')
      11. #6 {main}
      Display All

      CreateOnePlanetRecord.php code:

      PHP Source Code

      1. <?php
      2. /**
      3. * 2Moons
      4. * Copyright (C) 2012 Jan Kröpke
      5. *
      6. * This program is free software: you can redistribute it and/or modify
      7. * it under the terms of the GNU General Public License as published by
      8. * the Free Software Foundation, either version 3 of the License, or
      9. * (at your option) any later version.
      10. *
      11. * This program is distributed in the hope that it will be useful,
      12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      14. * GNU General Public License for more details.
      15. *
      16. * You should have received a copy of the GNU General Public License
      17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
      18. *
      19. * @package 2Moons
      20. * @author Jan Kröpke <info@2moons.cc>
      21. * @copyright 2012 Jan Kröpke <info@2moons.cc>
      22. * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
      23. * @version 1.7.3 (2013-05-19)
      24. * @info $Id: CreateOnePlanetRecord.php 2640 2013-03-23 19:23:26Z slaver7 $
      25. * @link http://2moons.cc/
      26. */
      27. function CreateOnePlanetRecord($Galaxy, $System, $Position, $Universe, $PlanetOwnerID, $PlanetName = '', $HomeWorld = false, $AuthLevel = 0)
      28. {
      29. global $LNG;
      30. $CONF = Config::getAll(NULL, $Universe);
      31. if (Config::get('max_galaxy') < $Galaxy || 1 > $Galaxy) {
      32. throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:".$Galaxy.":".$System.":".$Position);
      33. }
      34. if (Config::get('max_system') < $System || 1 > $System) {
      35. throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:".$Galaxy.":".$System.":".$Position);
      36. }
      37. if (Config::get('max_planets') < $Position || 1 > $Position) {
      38. throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:".$Galaxy.":".$System.":".$Position);
      39. }
      40. if (CheckPlanetIfExist($Galaxy, $System, $Position, $Universe)) {
      41. return false;
      42. }
      43. $FieldFactor = Config::get('planet_factor');
      44. require_once 'includes/PlanetDataBis.php' ;
      45. $Pos = ceil($Position / (Config::get('max_planets') / count($PlanetData)));
      46. $TMax = $PlanetData[$Pos]['temp'];
      47. $TMin = $TMax - 40;
      48. $Fields = $PlanetData[$Pos]['fields'] * Config::get('planet_factor');
      49. $Types = array_keys($PlanetData[$Pos]['image']);
      50. $Type = $Types[array_rand($Types)];
      51. $Class = $Type.'planet'.($PlanetData[$Pos]['image'][$Type] < 10 ? '0' : '').$PlanetData[$Pos]['image'][$Type];
      52. $Name = !empty($PlanetName) ? $GLOBALS['DATABASE']->sql_escape($PlanetName) : $LNG['type_planet'][1];
      53. $GLOBALS['DATABASE']->query("INSERT INTO ".PLANETS." SET
      54. name = '".$Name."',
      55. universe = ".$Universe.",
      56. id_owner = ".$PlanetOwnerID.",
      57. galaxy = ".$Galaxy.",
      58. system = ".$System.",
      59. planet = ".$Position.",
      60. last_update = ".TIMESTAMP.",
      61. planet_type = '1',
      62. image = '".$Class."',
      63. diameter = ".floor(1000 * sqrt($Fields)).",
      64. field_max = ".(($HomeWorld) ? Config::get('initial_fields') : floor($Fields)).",
      65. temp_min = ".$TMin.",
      66. temp_max = ".$TMax.",
      67. planet_protection = '0',
      68. metal = ".Config::get('metal_start').",
      69. metal_perhour = ".Config::get('metal_basic_income').",
      70. crystal = ".Config::get('crystal_start').",
      71. crystal_perhour = ".Config::get('crystal_basic_income').",
      72. deuterium = ".Config::get('deuterium_start').",
      73. deuterium_perhour = ".Config::get('deuterium_basic_income').";");
      74. return $GLOBALS['DATABASE']->GetInsertID();
      75. }
      Display All
      PlanetDataBis file:

      PHP Source Code

      1. <?php
      2. $PlanetData = array(
      3. 1 => array('temp' => mt_rand(220, 260), 'fields' => mt_rand(385, 498), 'image' => array('trocken' => mt_rand(1, 10), 'wuesten' => mt_rand(1, 4))),
      4. 2 => array('temp' => mt_rand(170, 210), 'fields' => mt_rand(387, 500), 'image' => array('trocken' => mt_rand(1, 10), 'wuesten' => mt_rand(1, 4))),
      5. 3 => array('temp' => mt_rand(120, 160), 'fields' => mt_rand(488, 527), 'image' => array('trocken' => mt_rand(1, 10), 'wuesten' => mt_rand(1, 4))),
      6. 4 => array('temp' => mt_rand(70, 110), 'fields' => mt_rand(513, 593), 'image' => array('dschjungel' => mt_rand(1, 10))),
      7. 5 => array('temp' => mt_rand(60, 100), 'fields' => mt_rand(538, 600), 'image' => array('dschjungel' => mt_rand(1, 10))),
      8. 6 => array('temp' => mt_rand(50, 90), 'fields' => mt_rand(538, 616), 'image' => array('dschjungel' => mt_rand(1, 10))),
      9. 7 => array('temp' => mt_rand(40, 80), 'fields' => mt_rand(531, 663), 'image' => array('normaltemp' => mt_rand(1, 7))),
      10. 8 => array('temp' => mt_rand(30, 70), 'fields' => mt_rand(559, 636), 'image' => array('normaltemp' => mt_rand(1, 7))),
      11. 9 => array('temp' => mt_rand(20, 60), 'fields' => mt_rand(551, 628), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))),
      12. 10 => array('temp' => mt_rand(10, 50), 'fields' => mt_rand(544, 614), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))),
      13. 11 => array('temp' => mt_rand(0, 40), 'fields' => mt_rand(538, 594), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))),
      14. 12 => array('temp' => mt_rand(-10, 30), 'fields' => mt_rand(526, 561), 'image' => array('normaltemp' => mt_rand(1, 7), 'wasser' => mt_rand(1, 9))),
      15. 13 => array('temp' => mt_rand(-50, -10), 'fields' => mt_rand(499, 511), 'image' => array('eis' => mt_rand(1, 10))),
      16. 14 => array('temp' => mt_rand(-90, -50), 'fields' => mt_rand(471, 483), 'image' => array('eis' => mt_rand(1, 10))),
      17. 15 => array('temp' => mt_rand(-130, -90), 'fields' => mt_rand(445, 464), 'image' => array('eis' => mt_rand(1, 10)))
      18. );
      19. ?>
      Display All


      What is strage is that when i unblock fleet sometimes colonisation is successful and sometimes not.

      I am using webhosting for game not VPS.

      Hosting pamameters:
      Apache 2.2 based on linux
      php memory limit: 128 Mb
      post max size: 32 Mb

      I think that i dont have enoung computing power to create a new record to db where are lots of records
      Can somebody help please?