Completed
Branch work-fleets (23812c)
by SuperNova.WS
13:52
created
language/ru/overview.mo.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
 * DO NOT CHANGE
25 25
 */
26 26
 
27
-if (!defined('INSIDE')) die();
27
+if (!defined('INSIDE')) {
28
+  die();
29
+}
28 30
 
29 31
 
30 32
 $a_lang_array = (array(
Please login to merge, or discard this patch.
language/ru/market.mo.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
 * DO NOT CHANGE
25 25
 */
26 26
 
27
-if (!defined('INSIDE')) die();
27
+if (!defined('INSIDE')) {
28
+  die();
29
+}
28 30
 
29 31
 
30 32
 $a_lang_array = (array(
Please login to merge, or discard this patch.
language/ru/artifacts.mo.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
 * DO NOT CHANGE
25 25
 */
26 26
 
27
-if (!defined('INSIDE')) die();
27
+if (!defined('INSIDE')) {
28
+  die();
29
+}
28 30
 
29 31
 
30 32
 $a_lang_array = (array(
Please login to merge, or discard this patch.
admin/includes/admin_planet_edit.inc.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
     ));
116 116
 
117 117
     display($template, $lang['tech'][STRUC_MOON_GATE]);
118
-  }
119
-  else
118
+  } else
120 119
   {
121 120
     message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call(__FUNCTION__, array(&$template, &$admin_planet_edit_mode_list));}
3
+function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call(__FUNCTION__, array(&$template, &$admin_planet_edit_mode_list)); }
4 4
 function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list)
5 5
 {
6 6
   global $lang;
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
   return $mode;
20 20
 }
21 21
 
22
-function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call(__FUNCTION__, array(&$template, $edit_planet_row, $mode));}
22
+function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call(__FUNCTION__, array(&$template, $edit_planet_row, $mode)); }
23 23
 function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode)
24 24
 {
25 25
   global $lang;
26 26
 
27 27
   $unit_list = sn_get_groups($mode);
28
-  if(empty($unit_list))
28
+  if (empty($unit_list))
29 29
   {
30 30
     return;
31 31
   }
32 32
   $name_list = $lang['tech'];
33 33
 
34
-  foreach($unit_list as $unit_id)
34
+  foreach ($unit_list as $unit_id)
35 35
   {
36 36
     $template->assign_block_vars('unit', array(
37 37
       'ID'    => $unit_id,
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
   }
43 43
 }
44 44
 
45
-function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode));}
45
+function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode)); }
46 46
 function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode)
47 47
 {
48
-  if($unit_amount && in_array($unit_id, sn_get_groups($mode)))
48
+  if ($unit_amount && in_array($unit_id, sn_get_groups($mode)))
49 49
   {
50 50
     $unit_amount = round($unit_amount);
51 51
     $unit_name = get_unit_param($unit_id, P_NAME);
Please login to merge, or discard this patch.
includes/classes/Bonus.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
   /**
25 25
    * Добавляет юнит к списку бонусов
26 26
    *
27
-   * @param $unit_id
27
+   * @param integer $unit_id
28 28
    * @param $unit_level
29 29
    */
30 30
   public function add_unit_by_snid($unit_id, $unit_level) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
    *
68 68
    * Выдает финальный бонус в виде множителя
69 69
    *
70
-   * @param string|int $param - ИД бонуса
70
+   * @param string $param - ИД бонуса
71 71
    *
72 72
    * @return float
73 73
    */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
    * @param $unit_level
29 29
    */
30 30
   public function add_unit_by_snid($unit_id, $unit_level) {
31
-    if(!$unit_level) {
31
+    if (!$unit_level) {
32 32
       return;
33 33
     }
34 34
 
35
-    foreach(static::$_bonus_group as $param_name => $unit_list) {
36
-      if(!empty($unit_list[$unit_id])) {
35
+    foreach (static::$_bonus_group as $param_name => $unit_list) {
36
+      if (!empty($unit_list[$unit_id])) {
37 37
         // Простейший вариант - мультипликатор по базе
38 38
         // Общий мультипликатор добавляется в конец
39 39
         $this->grants[$param_name][$unit_id] = $unit_level;
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 //    $this->grants[$param_name][$unit_id] = $unit_level * get_unit_param($unit_id, P_BONUS_VALUE) / 100;;
83 83
     $value_add = floatval($base_value);
84 84
     $cumulative = 1.0; // Для случая BONUS_PERCENT
85
-    if(!empty($this->grants[$param]) && is_array($this->grants[$param])) {
86
-      foreach($this->grants[$param] as $unit_id => $unit_level) {
85
+    if (!empty($this->grants[$param]) && is_array($this->grants[$param])) {
86
+      foreach ($this->grants[$param] as $unit_id => $unit_level) {
87 87
         $unit_bonus = 0;
88
-        if($unit_id < 0) {
88
+        if ($unit_id < 0) {
89 89
           // Meta-unit - leave as is
90 90
         } else {
91 91
           // TODO - Подумать, что будет при смешивании разных бонусов и как этого избежать
92 92
           $bonus_value = get_unit_param($unit_id, P_BONUS_VALUE);
93 93
           $bonus_type = get_unit_param($unit_id, P_BONUS_TYPE);
94
-          switch($bonus_type) {
94
+          switch ($bonus_type) {
95 95
             case BONUS_PERCENT:
96 96
               $unit_bonus = $unit_level * $bonus_value / 100;
97 97
               $cumulative += $unit_bonus;
Please login to merge, or discard this patch.
includes/classes/DBRow.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
   /**
267 267
    * Inserts record to DB
268 268
    *
269
-   * @return int|string
269
+   * @return integer
270 270
    */
271 271
   public function dbInsert() {
272 272
     if(!$this->isNew()) {
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
   /**
399 399
    * @param array $field_set
400 400
    *
401
-   * @return int|string
401
+   * @return integer
402 402
    */
403 403
   protected function db_field_set_create(array $field_set) {
404 404
     !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set) : false;
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -168,26 +168,26 @@  discard block
 block discarded – undo
168 168
 
169 169
     // If method is not getter or setter OR property name not exists in $_properties - raising exception
170 170
     // Descendants can catch this Exception to make own __call magic
171
-    if(($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) {
171
+    if (($left3 != 'get' && $left3 != 'set') || empty(static::$_properties[$propertyName])) {
172 172
       throw new ExceptionPropertyNotExists('Property ' . $propertyName . ' not exists when calling getter/setter ' . get_called_class() . '::' . $name, ERR_ERROR);
173 173
     }
174 174
 
175 175
     // TODO check for read-only
176 176
 
177
-    if($left3 == 'set') {
177
+    if ($left3 == 'set') {
178 178
       $this->propertiesChanged[$propertyName] = 1;
179 179
     }
180 180
 
181 181
     // Now deciding - will we call a protected setter or will we work with protected property
182 182
 
183 183
     // If method exists - just calling it
184
-    if(method_exists($this, $name)) {
184
+    if (method_exists($this, $name)) {
185 185
       return call_user_func_array(array($this, $name), $arguments);
186 186
     }
187 187
     // No getter/setter exists - works directly with protected property
188 188
 
189 189
     // Is it getter?
190
-    if($left3 === 'get') {
190
+    if ($left3 === 'get') {
191 191
       return $this->{'_' . $propertyName};
192 192
     }
193 193
 
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 //    $this->_reset();
209 209
 
210 210
     $dbId = idval($dbId);
211
-    if($dbId <= 0) {
211
+    if ($dbId <= 0) {
212 212
       classSupernova::$debug->error(get_called_class() . '::dbLoad $dbId not positive = ' . $dbId);
213 213
 
214 214
       return;
215 215
     }
216 216
 
217 217
     $db_row = doquery("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $dbId . " LIMIT 1 FOR UPDATE;", true);
218
-    if(empty($db_row)) {
218
+    if (empty($db_row)) {
219 219
       return;
220 220
     }
221 221
 
@@ -231,26 +231,26 @@  discard block
 block discarded – undo
231 231
    */
232 232
   // TODO - perform operations only if properties was changed
233 233
   public function dbSave() {
234
-    if($this->isNew()) {
234
+    if ($this->isNew()) {
235 235
       // No DB_ID - new unit
236
-      if($this->isEmpty()) {
236
+      if ($this->isEmpty()) {
237 237
         classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave');
238 238
       }
239 239
       $this->dbInsert();
240 240
     } else {
241 241
       // DB_ID is present
242
-      if($this->isEmpty()) {
242
+      if ($this->isEmpty()) {
243 243
         $this->dbDelete();
244 244
       } else {
245
-        if(!sn_db_transaction_check(false)) {
245
+        if (!sn_db_transaction_check(false)) {
246 246
           classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate');
247 247
         }
248 248
         $this->dbUpdate();
249 249
       }
250 250
     }
251 251
 
252
-    if(!empty($this->triggerDbOperationOn)) {
253
-      foreach($this->triggerDbOperationOn as $item) {
252
+    if (!empty($this->triggerDbOperationOn)) {
253
+      foreach ($this->triggerDbOperationOn as $item) {
254 254
         $item->dbSave();
255 255
       }
256 256
     }
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
    * @return int|string
270 270
    */
271 271
   public function dbInsert() {
272
-    if(!$this->isNew()) {
272
+    if (!$this->isNew()) {
273 273
       classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert');
274 274
     }
275 275
     $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet());
276 276
 
277
-    if(empty($this->_dbId)) {
277
+    if (empty($this->_dbId)) {
278 278
       classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert');
279 279
     }
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
    */
287 287
   public function dbUpdate() {
288 288
     // TODO - Update
289
-    if($this->isNew()) {
289
+    if ($this->isNew()) {
290 290
       classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate');
291 291
     }
292 292
     $this->db_field_update($this->dbMakeFieldSet(true));
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
    * Deletes record from DB
297 297
    */
298 298
   public function dbDelete() {
299
-    if($this->isNew()) {
299
+    if ($this->isNew()) {
300 300
       classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete');
301 301
     }
302 302
     doquery("DELETE FROM {{" . static::$_table . "}} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId);
@@ -322,18 +322,18 @@  discard block
 block discarded – undo
322 322
    * @param array $db_row
323 323
    */
324 324
   public function dbRowParse(array $db_row) {
325
-    foreach(static::$_properties as $property_name => &$property_data) {
325
+    foreach (static::$_properties as $property_name => &$property_data) {
326 326
       // Advanced values extraction procedure. Should be used when at least one of following rules is matched:
327 327
       // - one field should translate to several properties;
328 328
       // - one property should be filled according to several fields;
329 329
       // - property filling requires some lookup in object values;
330
-      if(!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) {
330
+      if (!empty($property_data[P_METHOD_EXTRACT]) && is_callable(array($this, $property_data[P_METHOD_EXTRACT]))) {
331 331
         call_user_func_array(array($this, $property_data[P_METHOD_EXTRACT]), array(&$db_row));
332 332
         continue;
333 333
       }
334 334
 
335 335
       // If property is read-only - doing nothing
336
-      if(!empty($property_data[P_READ_ONLY])) {
336
+      if (!empty($property_data[P_READ_ONLY])) {
337 337
         continue;
338 338
       }
339 339
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
       !empty($property_data[P_FUNC_INPUT]) && is_callable($property_data[P_FUNC_INPUT]) ? $value = call_user_func($property_data[P_FUNC_INPUT], $value) : false;
345 345
 
346 346
       // If there is setter for this field - using it. Setters is always a methods of $THIS
347
-      if(!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) {
347
+      if (!empty($property_data[P_METHOD_SET]) && is_callable(array($this, $property_data[P_METHOD_SET]))) {
348 348
         call_user_func(array($this, $property_data[P_METHOD_SET]), $value);
349 349
       } else {
350 350
         $this->{$property_name} = $value;
@@ -360,21 +360,21 @@  discard block
 block discarded – undo
360 360
   protected function dbMakeFieldSet($isUpdate = false) {
361 361
     $array = array();
362 362
 
363
-    foreach(static::$_properties as $property_name => &$property_data) {
363
+    foreach (static::$_properties as $property_name => &$property_data) {
364 364
       // TODO - on isUpdate add only changed/adjusted properties
365 365
 
366
-      if(!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) {
366
+      if (!empty($property_data[P_METHOD_INJECT]) && is_callable(array($this, $property_data[P_METHOD_INJECT]))) {
367 367
         call_user_func_array(array($this, $property_data[P_METHOD_INJECT]), array(&$array));
368 368
         continue;
369 369
       }
370 370
 
371 371
       // Skipping properties which have no corresponding field in DB
372
-      if(empty($property_data[P_DB_FIELD])) {
372
+      if (empty($property_data[P_DB_FIELD])) {
373 373
         continue;
374 374
       }
375 375
 
376 376
       // Checking - is property was adjusted or changed
377
-      if($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) {
377
+      if ($isUpdate && array_key_exists($property_name, $this->propertiesAdjusted)) {
378 378
         // For adjusted property - take value from propertiesAdjusted array
379 379
         // TODO - differ how treated conversion to string for changed and adjusted properties
380 380
         $value = $this->propertiesAdjusted[$property_name];
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     $fields = implode(',', array_keys($field_set));
409 409
 
410 410
     $result = 0;
411
-    if(classSupernova::db_query("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) {
411
+    if (classSupernova::db_query("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) {
412 412
       $result = db_insert_id();
413 413
     }
414 414
 
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
    */
425 425
   protected function isFieldChanged($fieldName) {
426 426
     $isFieldChanged = false;
427
-    foreach($this->propertiesChanged as $propertyName => $cork) {
427
+    foreach ($this->propertiesChanged as $propertyName => $cork) {
428 428
       $propertyScheme = static::$_properties[$propertyName];
429
-      if(!empty($propertyScheme[P_DB_FIELDS_LINKED])) {
430
-        foreach($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) {
431
-          if($linkedFieldName == $fieldName) {
429
+      if (!empty($propertyScheme[P_DB_FIELDS_LINKED])) {
430
+        foreach ($propertyScheme[P_DB_FIELDS_LINKED] as $linkedFieldName) {
431
+          if ($linkedFieldName == $fieldName) {
432 432
             $isFieldChanged = $propertyName;
433 433
             break 2;
434 434
           }
435 435
         }
436 436
       }
437
-      if(!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) {
437
+      if (!empty($propertyScheme[P_DB_FIELD]) && $propertyScheme[P_DB_FIELD] == $fieldName) {
438 438
         $isFieldChanged = $propertyName;
439 439
         break;
440 440
       }
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
     $set = array();
457 457
 //pdump($field_set);
458 458
 //pdump($this->propertiesAdjusted);
459
-    foreach($field_set as $fieldName => $value) {
460
-      if(!($changedProperty = $this->isFieldChanged($fieldName))) {
459
+    foreach ($field_set as $fieldName => $value) {
460
+      if (!($changedProperty = $this->isFieldChanged($fieldName))) {
461 461
         continue;
462 462
       }
463 463
 //pdump($changedProperty);
464 464
       // TODO - separate sets from adjusts
465
-      if(array_key_exists($changedProperty, $this->propertiesAdjusted)) {
465
+      if (array_key_exists($changedProperty, $this->propertiesAdjusted)) {
466 466
         $value = "`{$fieldName}` + ($value)"; // braces for negative values
467 467
       }
468 468
 
Please login to merge, or discard this patch.
includes/classes/Fleet.php 2 patches
Doc Comments   +8 added lines, -1 removed lines patch added patch discarded remove patch
@@ -296,6 +296,10 @@  discard block
 block discarded – undo
296 296
    * @return array|bool|mysqli_result|null
297 297
    */
298 298
   // TODO - унести куда-то глубоко. Например в DBAware или даже в БД-драйвер
299
+
300
+  /**
301
+   * @param string $set_safe_string
302
+   */
299 303
   protected function db_fleet_update_set_safe_string($set_safe_string) {
300 304
     $fleet_id_safe = idval($this->_dbId);
301 305
     if(!empty($fleet_id_safe) && !empty($set_safe_string)) {
@@ -561,6 +565,9 @@  discard block
 block discarded – undo
561 565
     $this->core_field_set_list['fleet_mission'] = $this->mission_type = $mission_id;
562 566
   }
563 567
 
568
+  /**
569
+   * @param integer $ship_id
570
+   */
564 571
   public function shipCountById($ship_id) {
565 572
     return $this->unitList->unitCountById($ship_id);
566 573
   }
@@ -672,7 +679,7 @@  discard block
 block discarded – undo
672 679
   /**
673 680
    * Set current resource list from array of units
674 681
    *
675
-   * @param array $resource_list
682
+   * @param integer[] $resource_list
676 683
    */
677 684
   public function replace_resources($resource_list) {
678 685
     // TODO - Resets also delta and changes?!
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
   // TODO - унести куда-то глубоко. Например в DBAware или даже в БД-драйвер
299 299
   protected function db_fleet_update_set_safe_string($set_safe_string) {
300 300
     $fleet_id_safe = idval($this->_dbId);
301
-    if(!empty($fleet_id_safe) && !empty($set_safe_string)) {
301
+    if (!empty($fleet_id_safe) && !empty($set_safe_string)) {
302 302
       $result = doquery("UPDATE `{{fleets}}` SET {$set_safe_string} WHERE `fleet_id` = {$fleet_id_safe} LIMIT 1;");
303 303
     } else {
304 304
       $result = false;
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
    */
363 363
   public function db_delete_this_fleet() {
364 364
     $fleet_id_safe = idval($this->_dbId);
365
-    if(!empty($fleet_id_safe)) {
365
+    if (!empty($fleet_id_safe)) {
366 366
       $result = doquery("DELETE FROM {{fleets}} WHERE `fleet_id` = {$fleet_id_safe} LIMIT 1;");
367 367
     } else {
368 368
       $result = false;
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     $this->flush_changes_to_db();
407 407
 //    $this->dbSave();
408 408
 
409
-    if($this->_group_id) {
409
+    if ($this->_group_id) {
410 410
       // TODO: Make here to delete only one AKS - by adding aks_fleet_count to AKS table
411 411
       db_fleet_aks_purge();
412 412
     }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     sn_db_transaction_check(true);
474 474
 
475 475
     // Если флот уже обработан - не существует или возращается - тогда ничего не делаем
476
-    if(!$this->_dbId || ($this->_is_returning == 1 && $only_resources)) {
476
+    if (!$this->_dbId || ($this->_is_returning == 1 && $only_resources)) {
477 477
       return $result;
478 478
     }
479 479
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 
494 494
     // TODO - Проверка, что планета всё еще существует на указанных координатах, а не телепортировалась, не удалена хозяином, не уничтожена врагом
495 495
     // Флот, который возвращается на захваченную планету, пропадает
496
-    if($start && $this->_is_returning == 1 && $planet_arrival['id_owner'] != $this->_playerOwnerId) {
496
+    if ($start && $this->_is_returning == 1 && $planet_arrival['id_owner'] != $this->_playerOwnerId) {
497 497
       $result = RestoreFleetToPlanet($this, $start, $only_resources, $result);
498 498
 
499 499
       $this->db_delete_this_fleet();
@@ -502,20 +502,20 @@  discard block
 block discarded – undo
502 502
     }
503 503
 
504 504
 //pdump($planet_arrival);
505
-    if(!$only_resources) {
505
+    if (!$only_resources) {
506 506
       // Landing ships
507 507
       $db_changeset = array();
508 508
 
509
-      if($this->_playerOwnerId == $planet_arrival['id_owner']) {
509
+      if ($this->_playerOwnerId == $planet_arrival['id_owner']) {
510 510
         $fleet_array = $this->get_unit_list();
511
-        foreach($fleet_array as $ship_id => $ship_count) {
512
-          if($ship_count) {
511
+        foreach ($fleet_array as $ship_id => $ship_count) {
512
+          if ($ship_count) {
513 513
             $db_changeset['unit'][] = sn_db_unit_changeset_prepare($ship_id, $ship_count, $user, $planet_arrival['id']);
514 514
           }
515 515
         }
516 516
 
517 517
         // Adjusting ship amount on planet
518
-        if(!empty($db_changeset)) {
518
+        if (!empty($db_changeset)) {
519 519
           db_changeset_apply($db_changeset);
520 520
         }
521 521
       }
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
     }
527 527
 
528 528
     // Restoring resources to planet
529
-    if($this->get_resources_amount() != 0) {
529
+    if ($this->get_resources_amount() != 0) {
530 530
       $fleet_resources = $this->get_resource_list();
531 531
       db_planet_set_by_id($planet_arrival['id'],
532 532
         "`metal` = `metal` + '{$fleet_resources[RES_METAL]}', `crystal` = `crystal` + '{$fleet_resources[RES_CRYSTAL]}', `deuterium` = `deuterium` + '{$fleet_resources[RES_DEUTERIUM]}'");
533 533
     }
534 534
 
535
-    if(!$only_resources) {
535
+    if (!$only_resources) {
536 536
       $this->db_delete_this_fleet();
537 537
     }
538 538
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
     $this->unitList->dbSave();
593 593
 
594 594
     // Добавляем REPLACE ресурсов
595
-    if(!empty($this->resource_replace)) {
595
+    if (!empty($this->resource_replace)) {
596 596
       $field_replace_changes = array_merge(
597 597
         $field_replace_changes,
598 598
         UnitResourceLoot::convert_id_to_field_name($this->resource_replace, 'fleet_resource_')
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
     pdie('Replace_ships should be rewritten! Deletes ships by setting their count to 0, adding ship with UnitList standard procedure');
631 631
     !is_array($unit_list) ? $unit_list = array() : false;
632 632
 
633
-    foreach($unit_list as $unit_id => $unit_count) {
633
+    foreach ($unit_list as $unit_id => $unit_count) {
634 634
       // TODO - проверка на допустимые корабли
635 635
 //      if(!UnitShip::is_in_group($unit_id) || !($unit_count = floor($unit_count))) {
636 636
 //        // Not a ship - continuing
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
   public function update_resources($resource_delta_list) {
651 651
     !is_array($resource_delta_list) ? $resource_delta_list = array() : false;
652 652
 
653
-    foreach($resource_delta_list as $resource_id => $unit_delta) {
654
-      if(!UnitResourceLoot::is_in_group($resource_id) || !($unit_delta = floor($unit_delta))) {
653
+    foreach ($resource_delta_list as $resource_id => $unit_delta) {
654
+      if (!UnitResourceLoot::is_in_group($resource_id) || !($unit_delta = floor($unit_delta))) {
655 655
         // Not a resource or no resources - continuing
656 656
         continue;
657 657
       }
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
       $this->resource_list[$resource_id] += $unit_delta;
660 660
 
661 661
       // Check for negative unit value
662
-      if($this->resource_list[$resource_id] < 0) {
662
+      if ($this->resource_list[$resource_id] < 0) {
663 663
         // TODO
664 664
         die('$unit_delta is less then resource amount in ' . __FILE__ . ' ' . __FUNCTION__ . ' ' . __LINE__);
665 665
       }
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
 
681 681
     !is_array($resource_list) ? $resource_list = array() : false;
682 682
 
683
-    foreach($resource_list as $resource_id => $unit_count) {
684
-      if(!UnitResourceLoot::is_in_group($resource_id) || !($unit_count = floor($unit_count))) {
683
+    foreach ($resource_list as $resource_id => $unit_count) {
684
+      if (!UnitResourceLoot::is_in_group($resource_id) || !($unit_count = floor($unit_count))) {
685 685
         // Not a resource or zero resource - continuing
686 686
         continue;
687 687
       }
688 688
 
689 689
       // Check for negative unit value
690
-      if($unit_count < 0) {
690
+      if ($unit_count < 0) {
691 691
         // TODO
692 692
         die('$unit_count can not be negative in ' . __FUNCTION__);
693 693
       }
@@ -713,15 +713,15 @@  discard block
 block discarded – undo
713 713
    * @param $unit_array
714 714
    */
715 715
   public function unitsSetFromArray($unit_array) {
716
-    foreach($unit_array as $unit_id => $unit_count) {
716
+    foreach ($unit_array as $unit_id => $unit_count) {
717 717
       $unit_count = floatval($unit_count);
718
-      if(!$unit_count) {
718
+      if (!$unit_count) {
719 719
         continue;
720 720
       }
721 721
 
722
-      if($this->isUnit($unit_id)) {
722
+      if ($this->isUnit($unit_id)) {
723 723
         $this->unitList->unitSetCount($unit_id, $unit_count);
724
-      } elseif($this->isResource($unit_id)) {
724
+      } elseif ($this->isResource($unit_id)) {
725 725
         $this->resource_list[$unit_id] = $unit_count;
726 726
       } else {
727 727
         throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), ERR_ERROR);
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 
774 774
     // WARNING! MISSION TIMES MUST BE SET WITH set_times() method!
775 775
     // TODO - more checks!
776
-    if(empty($this->_time_launch)) {
776
+    if (empty($this->_time_launch)) {
777 777
       die('Fleet time not set!');
778 778
     }
779 779
 
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
   public function parse_missile_db_row($missile_db_row) {
852 852
 //    $this->_reset();
853 853
 
854
-    if(empty($missile_db_row) || !is_array($missile_db_row)) {
854
+    if (empty($missile_db_row) || !is_array($missile_db_row)) {
855 855
       return;
856 856
     }
857 857
 
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
   public function fleet_recyclers_capacity(array $recycler_info) {
901 901
     $recyclers_incoming_capacity = 0;
902 902
     $fleet_data = $this->get_unit_list();
903
-    foreach($recycler_info as $recycler_id => $recycler_data) {
903
+    foreach ($recycler_info as $recycler_id => $recycler_data) {
904 904
       $recyclers_incoming_capacity += $fleet_data[$recycler_id] * $recycler_data['capacity'];
905 905
     }
906 906
 
Please login to merge, or discard this patch.
includes/classes/UBE/UBE.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
    * Преобразовывает данные симулятора в данные для расчета боя
465 465
    *
466 466
    * @param     $side_info
467
-   * @param     $attacker
467
+   * @param     boolean $attacker
468 468
    * @param int $player_id
469 469
    *
470 470
    * @version 41a6.22
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
   }
573 573
 
574 574
   /**
575
-   * @param $template
575
+   * @param null|template $template
576 576
    *
577 577
    * @return template
578 578
    */
Please login to merge, or discard this patch.
Spacing   +44 added lines, -45 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     $this->players->db_load_player_by_id($player_id, UBE_PLAYER_IS_DEFENDER);
148 148
 
149 149
     $player_db_row = $this->players[$player_id]->getDbRow();
150
-    if($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) {
150
+    if ($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) {
151 151
       $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $fortifier_level);
152 152
     }
153 153
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     $this->rounds[0] = new UBERound(0);
180 180
     $this->rounds[0]->make_snapshot($this->fleet_list);
181 181
 
182
-    for($round = 1; $round <= 10; $round++) {
182
+    for ($round = 1; $round <= 10; $round++) {
183 183
       // Проводим раунд
184 184
       defined('DEBUG_UBE') ? print("Round {$round}<br>") : false;
185 185
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
       // Анализируем итоги текущего раунда и готовим данные для следующего
194 194
       $this->combat_result = $this->fleet_list->ubeAnalyzeFleetOutcome($round);
195
-      if($this->combat_result != UBE_COMBAT_RESULT_DRAW) {
195
+      if ($this->combat_result != UBE_COMBAT_RESULT_DRAW) {
196 196
         break;
197 197
       }
198 198
 
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
     // Генерируем результат боя
222 222
     $this->fleet_list->ube_analyze_fleets($this->is_simulator, $this->debris, $this->resource_exchange_rates);
223 223
 
224
-    if(!$this->is_ube_loaded) {
224
+    if (!$this->is_ube_loaded) {
225 225
       $this->moon_calculator->calculate_moon($this);
226 226
 
227 227
       // Лутаем ресурсы - если аттакер выиграл
228
-      if($this->combat_result == UBE_COMBAT_RESULT_WIN) {
228
+      if ($this->combat_result == UBE_COMBAT_RESULT_WIN) {
229 229
         $this->sn_ube_combat_analyze_loot();
230 230
       }
231 231
     }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
       RES_DEUTERIUM => 0,
246 246
     );
247 247
 
248
-    if(
248
+    if (
249 249
       (($planet_resource_total = $this->fleet_list[0]->get_resources_amount()) > 0)
250 250
       &&
251 251
       (($total_capacity = $this->fleet_list->ube_get_capacity_attackers()) > 0)
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
       $planet_lootable_percent = $planet_lootable / $planet_resource_total;
258 258
 
259 259
       // Вычисляем сколько ресурсов вывезено
260
-      foreach($this->fleet_list->_container as $fleet_id => $fleet) {
260
+      foreach ($this->fleet_list->_container as $fleet_id => $fleet) {
261 261
         $looted_in_metal = 0;
262
-        foreach($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) {
262
+        foreach ($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) {
263 263
           // Вычисляем какой процент общей емкости трюмов атакующих будет задействован
264 264
           $fleet_lootable_percent = $fleet->fleet_capacity / $total_capacity;
265 265
           $looted = floor($resource_amount * $planet_lootable_percent * $fleet_lootable_percent);
@@ -325,16 +325,16 @@  discard block
 block discarded – undo
325 325
     $destination_user_id = $this->fleet_list[0]->owner_id;
326 326
 
327 327
     // Обновляем поле обломков на планете
328
-    if(!$this->is_admin_in_combat && $this->debris->debris_total() > 0) {
328
+    if (!$this->is_admin_in_combat && $this->debris->debris_total() > 0) {
329 329
       db_planet_set_by_gspt($this->ube_planet_info[PLANET_GALAXY], $this->ube_planet_info[PLANET_SYSTEM], $this->ube_planet_info[PLANET_PLANET], PT_PLANET,
330 330
         "`debris_metal` = `debris_metal` + " . $this->debris->debris_get_resource(RES_METAL) . ", `debris_crystal` = `debris_crystal` + " . $this->debris->debris_get_resource(RES_CRYSTAL)
331 331
       );
332 332
     }
333 333
 
334
-    foreach($this->fleet_list->_container as $fleet_id => $UBEFleet) {
334
+    foreach ($this->fleet_list->_container as $fleet_id => $UBEFleet) {
335 335
       $ship_count_lost = $UBEFleet->unit_list->unitCountLost();
336 336
 
337
-      if($fleet_id) {
337
+      if ($fleet_id) {
338 338
         // Флот
339 339
         $UBEFleet->db_save_combat_result_fleet($this->is_small_fleet_recce, $this->moon_calculator->get_reapers_status());
340 340
       } else {
@@ -342,19 +342,19 @@  discard block
 block discarded – undo
342 342
 
343 343
         // Сохраняем изменения ресурсов - если они есть
344 344
         $resource_delta = $UBEFleet->ube_combat_result_calculate_resources();
345
-        if(!empty($resource_delta)) {
345
+        if (!empty($resource_delta)) {
346 346
           $temp = array();
347
-          foreach($resource_delta as $resource_id => $resource_amount) {
347
+          foreach ($resource_delta as $resource_id => $resource_amount) {
348 348
             $resource_db_name = pname_resource_name($resource_id);
349 349
             $temp[] = "`{$resource_db_name}` = `{$resource_db_name}` + ({$resource_amount})";
350 350
           }
351 351
           db_planet_set_by_id($this->ube_planet_info[PLANET_ID], implode(',', $temp));
352 352
         }
353 353
 
354
-        if($ship_count_lost) {
354
+        if ($ship_count_lost) {
355 355
           $db_changeset = array();
356 356
           $planet_row_cache = $this->players[$destination_user_id]->getDbRow();
357
-          foreach($UBEFleet->unit_list->_container as $UBEUnit) {
357
+          foreach ($UBEFleet->unit_list->_container as $UBEUnit) {
358 358
             $db_changeset['unit'][] = sn_db_unit_changeset_prepare($UBEUnit->unitId, -$UBEUnit->units_lost, $planet_row_cache, $this->ube_planet_info[PLANET_ID]);
359 359
           }
360 360
           db_changeset_apply($db_changeset);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     // TODO: Связать сабы с флотами констраинтами ON DELETE SET NULL
366 366
     // Для САБов
367 367
     $fleet_group_id_list = $this->fleet_list->ube_get_groups();
368
-    if(!empty($fleet_group_id_list)) {
368
+    if (!empty($fleet_group_id_list)) {
369 369
       $fleet_group_id_list = implode(',', $fleet_group_id_list);
370 370
       db_acs_delete_by_list($fleet_group_id_list);
371 371
     }
@@ -374,19 +374,19 @@  discard block
 block discarded – undo
374 374
 
375 375
     $bashing_list = array();
376 376
     $players_sides = $this->players->get_player_sides();
377
-    foreach($players_sides as $player_id => $player_side) {
378
-      if($player_side != UBE_PLAYER_IS_ATTACKER) {
377
+    foreach ($players_sides as $player_id => $player_side) {
378
+      if ($player_side != UBE_PLAYER_IS_ATTACKER) {
379 379
         continue;
380 380
       }
381
-      if($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) {
381
+      if ($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) {
382 382
         $bashing_list[] = "({$player_id}, {$this->ube_planet_info[PLANET_ID]}, {$this->combat_timestamp})";
383 383
       }
384
-      if($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) {
384
+      if ($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) {
385 385
         $str_loose_or_win = $this->combat_result == UBE_COMBAT_RESULT_WIN ? 'raidswin' : 'raidsloose';
386 386
         db_user_set_by_id($player_id, "`xpraid` = `xpraid` + 1, `raids` = `raids` + 1, `{$str_loose_or_win}` = `{$str_loose_or_win}` + 1");
387 387
       }
388 388
     }
389
-    if(!empty($bashing_list)) {
389
+    if (!empty($bashing_list)) {
390 390
       $bashing_list = implode(',', $bashing_list);
391 391
       db_bashing_insert($bashing_list);
392 392
     }
@@ -413,20 +413,19 @@  discard block
 block discarded – undo
413 413
       $planet_info[PLANET_SYSTEM],
414 414
       $planet_info[PLANET_PLANET],
415 415
       htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'),
416
-      $lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' :
417
-        ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
416
+      $lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
418 417
     );
419 418
 
420 419
     $text_defender = '';
421 420
     $debris = $this->debris->get_debris();
422
-    foreach($debris as $resource_id => $resource_amount) {
423
-      if($resource_id == RES_DEUTERIUM) {
421
+    foreach ($debris as $resource_id => $resource_amount) {
422
+      if ($resource_id == RES_DEUTERIUM) {
424 423
         continue;
425 424
       }
426 425
 
427 426
       $text_defender .= "{$lang['tech'][$resource_id]}: " . pretty_number($resource_amount) . '<br />';
428 427
     }
429
-    if($text_defender) {
428
+    if ($text_defender) {
430 429
       $text_defender = "{$lang['ube_report_msg_body_debris']}{$text_defender}<br />";
431 430
     }
432 431
 
@@ -436,7 +435,7 @@  discard block
 block discarded – undo
436 435
 
437 436
     // TODO: Оптимизировать отсылку сообщений - отсылать пакетами
438 437
     $player_sides = $this->players->get_player_sides();
439
-    foreach($player_sides as $player_id => $player_side) {
438
+    foreach ($player_sides as $player_id => $player_side) {
440 439
       $message = $text_common . ($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? $lang['ube_report_msg_body_sfr'] : $text_defender);
441 440
       msg_send_simple_message($player_id, '', $this->combat_timestamp, MSG_TYPE_COMBAT, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $message);
442 441
     }
@@ -473,11 +472,11 @@  discard block
 block discarded – undo
473 472
     $player_id = $player_id == -1 ? $this->players->count() : $player_id;
474 473
     $fleet_id = $player_id; // FOR SIMULATOR!
475 474
 
476
-    if(empty($this->players[$player_id])) {
475
+    if (empty($this->players[$player_id])) {
477 476
       $this->players[$player_id] = new UBEPlayer();
478 477
     }
479 478
 
480
-    foreach($side_info as $fleet_data) {
479
+    foreach ($side_info as $fleet_data) {
481 480
       $this->players[$player_id]->name = $player_id;
482 481
       $this->players[$player_id]->setSide($attacker);
483 482
 
@@ -485,32 +484,32 @@  discard block
 block discarded – undo
485 484
       $this->fleet_list[$fleet_id] = $objFleet;
486 485
 
487 486
       $this->fleet_list[$fleet_id]->owner_id = $player_id;
488
-      foreach($fleet_data as $unit_id => $unit_count) {
489
-        if(!$unit_count) {
487
+      foreach ($fleet_data as $unit_id => $unit_count) {
488
+        if (!$unit_count) {
490 489
           continue;
491 490
         }
492 491
 
493 492
         $unit_type = get_unit_param($unit_id, P_UNIT_TYPE);
494 493
 
495
-        if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
494
+        if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
496 495
           $this->fleet_list[$fleet_id]->unit_list->unitAdjustCount($unit_id, $unit_count);
497
-        } elseif($unit_type == UNIT_RESOURCES) {
496
+        } elseif ($unit_type == UNIT_RESOURCES) {
498 497
           $this->fleet_list[$fleet_id]->resource_list[$unit_id] = $unit_count;
499
-        } elseif($unit_type == UNIT_TECHNOLOGIES) {
500
-          if($unit_id == TECH_WEAPON) {
498
+        } elseif ($unit_type == UNIT_TECHNOLOGIES) {
499
+          if ($unit_id == TECH_WEAPON) {
501 500
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_WEAPON, $unit_count);
502
-          } elseif($unit_id == TECH_SHIELD) {
501
+          } elseif ($unit_id == TECH_SHIELD) {
503 502
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_SHIELD, $unit_count);
504
-          } elseif($unit_id == TECH_ARMOR) {
503
+          } elseif ($unit_id == TECH_ARMOR) {
505 504
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_ARMOR, $unit_count);
506 505
           }
507
-        } elseif($unit_type == UNIT_GOVERNORS) {
508
-          if($unit_id == MRC_FORTIFIER) {
506
+        } elseif ($unit_type == UNIT_GOVERNORS) {
507
+          if ($unit_id == MRC_FORTIFIER) {
509 508
             // Фортифаер даёт бонус ко всему
510 509
             $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $unit_count);
511 510
           }
512
-        } elseif($unit_type == UNIT_MERCENARIES) {
513
-          if($unit_id == MRC_ADMIRAL) {
511
+        } elseif ($unit_type == UNIT_MERCENARIES) {
512
+          if ($unit_id == MRC_ADMIRAL) {
514 513
             $this->players[$player_id]->player_bonus->add_unit_by_snid(MRC_ADMIRAL, $unit_count);
515 514
           }
516 515
         }
@@ -581,7 +580,7 @@  discard block
 block discarded – undo
581 580
 
582 581
     $ube_report = new UBEReport();
583 582
     $ube = $ube_report->sn_ube_report_load(sys_get_param_str('cypher'));
584
-    if($ube != UBE_REPORT_NOT_FOUND) {
583
+    if ($ube != UBE_REPORT_NOT_FOUND) {
585 584
       $ube_report->sn_ube_report_generate($ube, $template_result);
586 585
 
587 586
       $template = gettemplate('ube_combat_report', $template);
@@ -614,9 +613,9 @@  discard block
 block discarded – undo
614 613
 //    sn_ube_report_save($combat_data);
615 614
 //  }
616 615
 
617
-    if(sys_get_param_str('reload')) {
616
+    if (sys_get_param_str('reload')) {
618 617
       $ube_new = $ube_report->sn_ube_report_load($ube->get_cypher()); // $combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]);
619
-      if($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) {
618
+      if ($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) {
620 619
         $ube = $ube_new;
621 620
       }
622 621
     }
@@ -664,7 +663,7 @@  discard block
 block discarded – undo
664 663
     $this->debris->load_from_report_row($report_row);
665 664
 
666 665
     $query = doquery("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
667
-    while($player_row = db_fetch($query)) {
666
+    while ($player_row = db_fetch($query)) {
668 667
       $this->players->init_player_from_report_info($player_row);
669 668
     }
670 669
 
Please login to merge, or discard this patch.
includes/classes/UBE/UBEDebris.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
   }
94 94
 
95 95
   /**
96
-   * @param $moon_debris_left_part
96
+   * @param double $moon_debris_left_part
97 97
    */
98 98
   public function debris_adjust_proportional($moon_debris_left_part) {
99 99
     foreach($this->debris as $resource_id => &$resource_amount) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
   /**
105 105
    * @param classConfig $config
106 106
    *
107
-   * @return int
107
+   * @return double
108 108
    */
109 109
   public function debris_in_metal($config) {
110 110
     return floatval(
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
    */
31 31
   public function debris_add_resource($resource_id, $resource_amount) {
32 32
     // В обломках может быть только металл или кристалл
33
-    if($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
33
+    if ($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
34 34
       return;
35 35
     }
36 36
     $this->debris[$resource_id] += $resource_amount;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
    * @param bool  $is_simulator
42 42
    */
43 43
   public function add_wrecks(array $wreckage, $is_simulator) {
44
-    foreach($wreckage as $resource_id => $resource_amount) {
44
+    foreach ($wreckage as $resource_id => $resource_amount) {
45 45
       $this->debris_add_resource($resource_id, floor($resource_amount *
46 46
         ($is_simulator
47 47
           ? UBE_SHIP_WRECKS_TO_DEBRIS_AVG
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
    * @param bool  $is_simulator
58 58
    */
59 59
   public function add_cargo_drop(array $dropped_resources, $is_simulator) {
60
-    foreach($dropped_resources as $resource_id => $resource_amount) {
60
+    foreach ($dropped_resources as $resource_id => $resource_amount) {
61 61
       $this->debris_add_resource($resource_id, floor($resource_amount *
62 62
         ($is_simulator
63 63
           ? UBE_CARGO_DROPPED_TO_DEBRIS_AVG
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
    * @param $moon_debris_left_part
97 97
    */
98 98
   public function debris_adjust_proportional($moon_debris_left_part) {
99
-    foreach($this->debris as $resource_id => &$resource_amount) {
99
+    foreach ($this->debris as $resource_id => &$resource_amount) {
100 100
       $resource_amount = floor($resource_amount * $moon_debris_left_part);
101 101
     }
102 102
   }
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
    */
122 122
   public function report_generate_sql(classConfig $config) {
123 123
     return "
124
-      `ube_report_debris_metal` = " . (float)$this->debris_get_resource(RES_METAL) . ",
125
-      `ube_report_debris_crystal` = " . (float)$this->debris_get_resource(RES_CRYSTAL) . ",
126
-      `ube_report_debris_total_in_metal` = " . (float)$this->debris_in_metal($config) . ", ";
124
+      `ube_report_debris_metal` = " . (float) $this->debris_get_resource(RES_METAL) . ",
125
+      `ube_report_debris_crystal` = " . (float) $this->debris_get_resource(RES_CRYSTAL) . ",
126
+      `ube_report_debris_total_in_metal` = " . (float) $this->debris_in_metal($config) . ", ";
127 127
   }
128 128
 
129 129
   /**
Please login to merge, or discard this patch.