Completed
Push — work-fleets ( cb2521...9eb2f3 )
by SuperNova.WS
08:26
created
flying_fleets.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.
classes/Common/IndexedObjectStorage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
    * @throws \Exception
72 72
    */
73 73
   protected function indexDuplicated($object, $data) {
74
-    throw new \Exception('Duplicate index [' . $data . '] in ' . __CLASS__);
74
+    throw new \Exception('Duplicate index ['.$data.'] in '.__CLASS__);
75 75
   }
76 76
 
77 77
   /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     if ($this->contains($object)) {
120 120
       $this->indexUnset($object);
121 121
     }
122
-    if($this->indexSet($object, $data)) {
122
+    if ($this->indexSet($object, $data)) {
123 123
       // Attaches object only if index sets successfully
124 124
       parent::attach($object, $data);
125 125
     }
Please login to merge, or discard this patch.
classes/Common/GlobalContainer.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,62 +43,62 @@
 block discarded – undo
43 43
     $gc = $this;
44 44
 
45 45
     // Default db
46
-    $gc->db = function ($c) {
46
+    $gc->db = function($c) {
47 47
       classSupernova::$db = $db = new \db_mysql($c);
48 48
 
49 49
       return $db;
50 50
     };
51 51
 
52
-    $gc->debug = function ($c) {
52
+    $gc->debug = function($c) {
53 53
       return new \debug();
54 54
     };
55 55
 
56
-    $gc->types = function ($c) {
56
+    $gc->types = function($c) {
57 57
       return new \Common\Types();
58 58
     };
59 59
 
60
-    $gc->cache = function ($c) {
60
+    $gc->cache = function($c) {
61 61
       return new \classCache(classSupernova::$cache_prefix);
62 62
     };
63 63
 
64
-    $gc->config = function ($c) {
64
+    $gc->config = function($c) {
65 65
       return new \classConfig(classSupernova::$cache_prefix);
66 66
     };
67 67
 
68
-    $gc->localePlayer = function (GlobalContainer $c) {
68
+    $gc->localePlayer = function(GlobalContainer $c) {
69 69
       return new \classLocale($c->config->server_locale_log_usage);
70 70
     };
71 71
 
72
-    $gc->dbGlobalRowOperator = function (GlobalContainer $c) {
72
+    $gc->dbGlobalRowOperator = function(GlobalContainer $c) {
73 73
       return new \DbRowDirectOperator($c->db);
74 74
     };
75 75
 
76
-    $gc->query = $gc->factory(function (GlobalContainer $c) {
76
+    $gc->query = $gc->factory(function(GlobalContainer $c) {
77 77
       return new \DbQueryConstructor($c->db);
78 78
     });
79 79
 
80
-    $gc->cacheOperator = function (GlobalContainer $gc) {
80
+    $gc->cacheOperator = function(GlobalContainer $gc) {
81 81
       return new \SnDbCachedOperator($gc);
82 82
     };
83 83
 
84 84
     $gc->snCacheClass = 'SnCache';
85
-    $gc->snCache = function (GlobalContainer $gc) {
85
+    $gc->snCache = function(GlobalContainer $gc) {
86 86
       return $gc->db->snCache;
87 87
     };
88 88
 
89 89
     $gc->buddyClass = 'Buddy\BuddyModel';
90
-    $gc->buddyModel = function (GlobalContainer $c) {
90
+    $gc->buddyModel = function(GlobalContainer $c) {
91 91
       return new $c->buddyClass($c);
92 92
     };
93 93
 
94
-    $gc->unitModel = function (GlobalContainer $c) {
94
+    $gc->unitModel = function(GlobalContainer $c) {
95 95
       return new \V2Unit\V2UnitModel($c);
96 96
     };
97
-    $gc->unitList = $this->factory(function (GlobalContainer $c) {
97
+    $gc->unitList = $this->factory(function(GlobalContainer $c) {
98 98
       return new \V2Unit\V2UnitList($c);
99 99
     });
100 100
 
101
-    $gc->fleetModel = function (GlobalContainer $c) {
101
+    $gc->fleetModel = function(GlobalContainer $c) {
102 102
       return new V2FleetModel($c);
103 103
     };
104 104
   }
Please login to merge, or discard this patch.
classes/Common/ObjectCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
    * @since 5.0.0
81 81
    */
82 82
   public function offsetUnset($offset) {
83
-    if($this->offsetExists($offset)) {
83
+    if ($this->offsetExists($offset)) {
84 84
       parent::offsetUnset($this->offsetGet($offset));
85 85
     }
86 86
   }
Please login to merge, or discard this patch.
classes/V2Fleet/V2FleetModel.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     $this->extendProperties($this->newProperties);
82 82
 
83
-    $this->accessors->set('location', P_CONTAINER_GET, function (V2FleetContainer $that) {
83
+    $this->accessors->set('location', P_CONTAINER_GET, function(V2FleetContainer $that) {
84 84
       if (is_null($location = $that->getDirect('location'))) {
85 85
         $location = new V2Location(LOC_FLEET);
86 86
         $that->setDirect('location', $location);
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
       return $location;
90 90
     });
91 91
 
92
-    $this->accessors->set('dbId', P_CONTAINER_SET, function (V2FleetContainer $that, $value) {
92
+    $this->accessors->set('dbId', P_CONTAINER_SET, function(V2FleetContainer $that, $value) {
93 93
       $that->setDirect('dbId', $value);
94 94
       $that->location->setLocationId($value);
95 95
     });
96 96
 
97
-    $this->accessors->set('ownerId', P_CONTAINER_SET, function (V2FleetContainer $that, $value) {
97
+    $this->accessors->set('ownerId', P_CONTAINER_SET, function(V2FleetContainer $that, $value) {
98 98
       $that->setDirect('ownerId', $value);
99 99
       $that->location->setLocationPlayerId($value);
100 100
     });
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     $this->accessors->set('vectorArrive', P_CONTAINER_EXPORT, array($this, 'exportVector'));
106 106
 
107 107
 
108
-    $this->accessors->set('units', P_CONTAINER_GET, function (V2FleetContainer $that) {
108
+    $this->accessors->set('units', P_CONTAINER_GET, function(V2FleetContainer $that) {
109 109
       if (is_null($units = $that->getDirect('units'))) {
110 110
         $units = \classSupernova::$gc->unitList;
111 111
         $that->setDirect('units', $units);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
       return $units;
115 115
     });
116 116
 
117
-    $this->accessors->set('isReturning', P_CONTAINER_GET, function (V2FleetContainer $that) {
117
+    $this->accessors->set('isReturning', P_CONTAINER_GET, function(V2FleetContainer $that) {
118 118
       return $that->status == FLEET_FLAG_RETURNING;
119 119
     });
120 120
 
Please login to merge, or discard this patch.
classes/Common/Invoker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
   }
16 16
 
17 17
   public static function build($callable) {
18
-    if(is_array($callable) && count($callable) == 2 && is_object($callable[0])) {
18
+    if (is_array($callable) && count($callable) == 2 && is_object($callable[0])) {
19 19
       return new static($callable);
20 20
     } else {
21 21
       return false;
Please login to merge, or discard this patch.
classes/Common/Accessors.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
    * @return bool
41 41
    */
42 42
   public function exists($varName, $accessor) {
43
-    return isset($this->accessors[$varName . $accessor]);
43
+    return isset($this->accessors[$varName.$accessor]);
44 44
   }
45 45
 
46 46
   /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     if (empty($callable)) {
59 59
       return;
60 60
     } elseif (!is_callable($callable)) {
61
-      throw new \Exception('Error assigning callable in ' . get_called_class() . '::set()! Callable typed [' . $accessor . '] is not a callable or not accessible in the scope');
61
+      throw new \Exception('Error assigning callable in '.get_called_class().'::set()! Callable typed ['.$accessor.'] is not a callable or not accessible in the scope');
62 62
     }
63 63
 
64 64
     // Converting method array-callable to closure
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 //      $callable = $method->getClosure($callable[0]);
69 69
 //    }
70 70
 
71
-    if($invoker = Invoker::build($callable)) {
71
+    if ($invoker = Invoker::build($callable)) {
72 72
       $callable = $invoker;
73 73
     }
74 74
 
75
-    $this->accessors[$varName . $accessor] = $callable;
76
-    if($shared) {
77
-      $this->shared[$varName . $accessor] = true;
75
+    $this->accessors[$varName.$accessor] = $callable;
76
+    if ($shared) {
77
+      $this->shared[$varName.$accessor] = true;
78 78
     }
79 79
   }
80 80
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
    */
101 101
   public function execute($varName, $accessor, $params) {
102 102
     if (!$this->exists($varName, $accessor)) {
103
-      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on " . get_called_class() . "::" . __METHOD__);
103
+      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on ".get_called_class()."::".__METHOD__);
104 104
     }
105 105
 
106
-    $functionName = $varName . $accessor;
106
+    $functionName = $varName.$accessor;
107 107
 
108
-    if(isset($this->shared[$functionName])) {
109
-      if(!array_key_exists($functionName, $this->executed)) {
108
+    if (isset($this->shared[$functionName])) {
109
+      if (!array_key_exists($functionName, $this->executed)) {
110 110
         $this->executed[$functionName] = call_user_func_array($this->accessors[$functionName], $params);
111 111
       }
112 112
       return $this->executed[$functionName];
Please login to merge, or discard this patch.
includes/includes/flt_mission_transport.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
   $source_planet = &$mission_data->src_planet;
19 19
   $destination_planet = &$mission_data->dst_planet;
20 20
 
21
-  if(empty($destination_planet['id_owner'])) {
21
+  if (empty($destination_planet['id_owner'])) {
22 22
     $objFleet->markReturnedAndSave();
23 23
 
24 24
     return $result;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium']);
34 34
   DBStaticMessages::msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_transport'], $Message);
35 35
 
36
-  if($objFleet->target_owner_id <> $objFleet->playerOwnerId) {
36
+  if ($objFleet->target_owner_id <> $objFleet->playerOwnerId) {
37 37
     DBStaticMessages::msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_transport'], $Message);
38 38
   }
39 39
 
Please login to merge, or discard this patch.
includes/includes/flt_flying_fleet_handler2.php 1 patch
Spacing   +8 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,15 +23,11 @@  discard block
 block discarded – undo
23 23
 // ------------------------------------------------------------------
24 24
 function flt_flyingFleetsSort($a, $b) {
25 25
   // Сравниваем время флотов - кто раньше, тот и первый обрабатывается
26
-  return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 :
27
-    // Если время - одинаковое, сравниваем события флотов
26
+  return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов
28 27
     // Если события - одинаковые, то флоты равны
29
-    ($a['fleet_event'] == $b['fleet_event'] ? 0 :
30
-      // Если события разные - первыми считаем прибывающие флоты
31
-      ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 :
32
-        // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
33
-        ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 :
34
-          // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
28
+    ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты
29
+      ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
30
+        ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
35 31
           // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска
36 32
           (
37 33
           0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий
@@ -49,13 +45,13 @@  discard block
 block discarded – undo
49 45
     $handler = fopen('event.log', 'a+');
50 46
   }
51 47
 
52
-  fwrite($handler, date(FMT_DATE_TIME_SQL, time()) . ' ' . $msg . "\r\n");
48
+  fwrite($handler, date(FMT_DATE_TIME_SQL, time()).' '.$msg."\r\n");
53 49
 }
54 50
 
55 51
 // ------------------------------------------------------------------
56 52
 function flt_flying_fleet_handler($skip_fleet_update = false) {
57 53
   if (true) {
58
-    if(!defined('IN_AJAX')) {
54
+    if (!defined('IN_AJAX')) {
59 55
       print('<div style="color: red; font-size: 300%">Fleet handler is disabled</div>');
60 56
       pdump('Fleet handler is disabled');
61 57
     }
@@ -181,7 +177,7 @@  discard block
 block discarded – undo
181 177
     MT_EXPLORE   => 'flt_mission_explore',
182 178
   );
183 179
   foreach ($missions_used as $mission_id => $cork) {
184
-    require_once(SN_ROOT_PHYSICAL . "includes/includes/{$mission_files[$mission_id]}" . DOT_PHP_EX);
180
+    require_once(SN_ROOT_PHYSICAL."includes/includes/{$mission_files[$mission_id]}".DOT_PHP_EX);
185 181
   }
186 182
 
187 183
 //log_file('Обработка миссий');
@@ -248,7 +244,7 @@  discard block
 block discarded – undo
248 244
     $objMission->fleet_event = $fleet_event['fleet_event'];
249 245
 
250 246
     // Fleet that have planet destination is returned
251
-    if($mission_data['dst_planet'] && empty($objMission->dst_planet['id_owner'])) {
247
+    if ($mission_data['dst_planet'] && empty($objMission->dst_planet['id_owner'])) {
252 248
       $objFleet->markReturnedAndSave();
253 249
       sn_db_transaction_commit();
254 250
       continue;
Please login to merge, or discard this patch.