Test Failed
Branch trunk (d809b8)
by SuperNova.WS
05:48
created
includes/includes/ube_attack_calculate.php 1 patch
Braces   +45 added lines, -70 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
 // ------------------------------------------------------------------------------------------------
81 81
 // Заполняет данные по игроку
82
-function ube_attack_prepare_player(&$combat_data, $player_id, $is_attacker)
83
-{
82
+function ube_attack_prepare_player(&$combat_data, $player_id, $is_attacker) {
84 83
   global $ube_convert_techs;
85 84
 
86 85
   if(!isset($combat_data[UBE_PLAYERS][$player_id]))
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
     {
100 99
       $player_info[UBE_BONUSES][$ube_id] += mrc_get_level($player_data, false, $unit_id) * get_unit_param($unit_id, P_BONUS_VALUE) / 100 + $admiral_bonus;
101 100
     }
102
-  }
103
-  else
101
+  } else
104 102
   {
105 103
     $combat_data[UBE_PLAYERS][$player_id][UBE_ATTACKER] = $combat_data[UBE_PLAYERS][$player_id][UBE_ATTACKER] || $is_attacker;
106 104
   }
@@ -109,8 +107,7 @@  discard block
 block discarded – undo
109 107
 // ------------------------------------------------------------------------------------------------
110 108
 // Заполняет данные по флоту
111 109
 function ube_attack_prepare_fleet(&$combat_data, &$fleet, $is_attacker){return sn_function_call('ube_attack_prepare_fleet', array(&$combat_data, &$fleet, $is_attacker));}
112
-function sn_ube_attack_prepare_fleet(&$combat_data, &$fleet, $is_attacker)
113
-{
110
+function sn_ube_attack_prepare_fleet(&$combat_data, &$fleet, $is_attacker) {
114 111
   $fleet_owner_id = $fleet['fleet_owner'];
115 112
   $fleet_id = $fleet['fleet_id'];
116 113
 
@@ -257,8 +254,7 @@  discard block
 block discarded – undo
257 254
     foreach($acs_fleet_list as $fleet) {
258 255
       ube_attack_prepare_fleet($combat_data, $fleet, true);
259 256
     }
260
-  }
261
-  else
257
+  } else
262 258
   {
263 259
     ube_attack_prepare_fleet($combat_data, $fleet_row, true);
264 260
   }
@@ -273,8 +269,7 @@  discard block
 block discarded – undo
273 269
 }
274 270
 
275 271
 // ------------------------------------------------------------------------------------------------
276
-function sn_ube_combat_prepare_first_round(&$combat_data)
277
-{
272
+function sn_ube_combat_prepare_first_round(&$combat_data) {
278 273
   global $ube_combat_bonus_list, $ube_convert_to_techs;
279 274
 
280 275
   // Готовим информацию для первого раунда - проводим все нужные вычисления из исходных данных
@@ -339,8 +334,7 @@  discard block
 block discarded – undo
339 334
 
340 335
 // ------------------------------------------------------------------------------------------------
341 336
 // Вычисление дополнительной информации для расчета раунда
342
-function sn_ube_combat_round_prepare(&$combat_data, $round)
343
-{
337
+function sn_ube_combat_round_prepare(&$combat_data, $round) {
344 338
   global $ube_combat_bonus_list;
345 339
 
346 340
   $is_simulator = $combat_data[UBE_OPTIONS][UBE_SIMULATOR];
@@ -401,8 +395,7 @@  discard block
 block discarded – undo
401 395
 
402 396
 // ------------------------------------------------------------------------------------------------
403 397
 // Рассчитывает результат столкновения флотов ака раунд
404
-function sn_ube_combat_round_crossfire_fleet(&$combat_data, $round)
405
-{
398
+function sn_ube_combat_round_crossfire_fleet(&$combat_data, $round) {
406 399
   if(BE_DEBUG === true)
407 400
   {
408 401
     // sn_ube_combat_helper_round_header($round);
@@ -437,8 +430,7 @@  discard block
 block discarded – undo
437 430
 
438 431
 // ------------------------------------------------------------------------------------------------
439 432
 // Рассчитывает результат столкновения двух юнитов ака ход
440
-function sn_ube_combat_round_crossfire_unit(&$attack_fleet_data, &$defend_fleet_data, $attack_unit_id, $defend_unit_id, &$combat_options)
441
-{
433
+function sn_ube_combat_round_crossfire_unit(&$attack_fleet_data, &$defend_fleet_data, $attack_unit_id, $defend_unit_id, &$combat_options) {
442 434
   $attack_fleet_info = &$attack_fleet_data[UBE_FLEET_INFO];
443 435
   $defend_fleet_info = &$defend_fleet_data[UBE_FLEET_INFO];
444 436
   $defend_unit_armor = $defend_fleet_info[UBE_ARMOR][$defend_unit_id];
@@ -518,8 +510,7 @@  discard block
 block discarded – undo
518 510
   }
519 511
 }
520 512
 
521
-function sn_ube_combat_round_crossfire_unit_damage_current(&$defend_fleet_data, $defend_unit_id, &$amplified_damage, &$units_lost, &$units_boomed, &$combat_options)
522
-{
513
+function sn_ube_combat_round_crossfire_unit_damage_current(&$defend_fleet_data, $defend_unit_id, &$amplified_damage, &$units_lost, &$units_boomed, &$combat_options) {
523 514
   $unit_is_lost = false;
524 515
 
525 516
   $units_boomed = $units_boomed ? $units_boomed : 0;
@@ -580,8 +571,7 @@  discard block
 block discarded – undo
580 571
 
581 572
 // ------------------------------------------------------------------------------------------------
582 573
 // Рассчитывает результат столкновения двух юнитов ака ход
583
-function sn_ube_combat_round_crossfire_unit2(&$attack_fleet_data, &$defend_fleet_data, $attack_unit_id, $defend_unit_id, &$combat_options)
584
-{
574
+function sn_ube_combat_round_crossfire_unit2(&$attack_fleet_data, &$defend_fleet_data, $attack_unit_id, $defend_unit_id, &$combat_options) {
585 575
   if($defend_fleet_data[UBE_COUNT][$defend_unit_id] <= 0)
586 576
   {
587 577
     return;
@@ -618,8 +608,7 @@  discard block
 block discarded – undo
618 608
 
619 609
 // ------------------------------------------------------------------------------------------------
620 610
 // Анализирует результаты раунда и генерирует данные для следующего раунда
621
-function sn_ube_combat_round_analyze(&$combat_data, $round)
622
-{
611
+function sn_ube_combat_round_analyze(&$combat_data, $round) {
623 612
   $round_data = &$combat_data[UBE_ROUNDS][$round];
624 613
   $round_data[UBE_OUTCOME] = UBE_COMBAT_RESULT_DRAW;
625 614
 
@@ -649,12 +638,10 @@  discard block
 block discarded – undo
649 638
   if(count($outcome) == 0 || $round == 10)
650 639
   {
651 640
     $round_data[UBE_OUTCOME] = UBE_COMBAT_RESULT_DRAW_END;
652
-  }
653
-  elseif(count($outcome) == 1)
641
+  } elseif(count($outcome) == 1)
654 642
   {
655 643
     $round_data[UBE_OUTCOME] = isset($outcome[UBE_ATTACKERS]) ? UBE_COMBAT_RESULT_WIN : UBE_COMBAT_RESULT_LOSS;
656
-  }
657
-  elseif(count($outcome) == 2)
644
+  } elseif(count($outcome) == 2)
658 645
   {
659 646
     if($round < 10)
660 647
     {
@@ -667,8 +654,7 @@  discard block
 block discarded – undo
667 654
 
668 655
 // ------------------------------------------------------------------------------------------------
669 656
 // Общий алгоритм расчета боя
670
-function sn_ube_combat(&$combat_data)
671
-{
657
+function sn_ube_combat(&$combat_data) {
672 658
   // TODO: Сделать атаку по типам,  когда они будут
673 659
 
674 660
   $start = microtime(true);
@@ -696,8 +682,7 @@  discard block
 block discarded – undo
696 682
 
697 683
 // ------------------------------------------------------------------------------------------------
698 684
 // Разбирает данные боя для генерации отчета
699
-function sn_ube_combat_analyze(&$combat_data)
700
-{
685
+function sn_ube_combat_analyze(&$combat_data) {
701 686
   global $config;
702 687
 
703 688
 //  $combat_data[UBE_OUTCOME] = array();
@@ -742,14 +727,12 @@  discard block
 block discarded – undo
742 727
         if($combat_data[UBE_OPTIONS][UBE_SIMULATOR])
743 728
         { // for simulation just return 75% of loss
744 729
           $units_giveback = round($units_lost * $giveback_chance / 100);
745
-        }
746
-        else
730
+        } else
747 731
         {
748 732
           if($unit_count > 10)
749 733
           { // if there were more then 10 defense elements - mass-calculating giveback
750 734
             $units_giveback = round($units_lost * mt_rand($giveback_chance * 0.8, $giveback_chance * 1.2) / 100);
751
-          }
752
-          else
735
+          } else
753 736
           { //if there were less then 10 defense elements - calculating giveback per element
754 737
             $units_giveback = 0;
755 738
             for($i = 1; $i <= $units_lost; $i++)
@@ -852,8 +835,7 @@  discard block
 block discarded – undo
852 835
     if($combat_data[UBE_OPTIONS][UBE_MOON_WAS])
853 836
     {
854 837
       $outcome[UBE_MOON] = UBE_MOON_WAS;
855
-    }
856
-    else
838
+    } else
857 839
     {
858 840
       sn_ube_combat_analyze_moon($outcome, $combat_data[UBE_OPTIONS][UBE_SIMULATOR]);
859 841
     }
@@ -872,8 +854,7 @@  discard block
 block discarded – undo
872 854
 }
873 855
 
874 856
 // ------------------------------------------------------------------------------------------------
875
-function sn_ube_combat_analyze_loot(&$combat_data)
876
-{
857
+function sn_ube_combat_analyze_loot(&$combat_data) {
877 858
   $exchange = &$combat_data[UBE_OPTIONS][UBE_EXCHANGE];
878 859
   $planet_resource_list = &$combat_data[UBE_FLEETS][0][UBE_RESOURCES];
879 860
   $outcome = &$combat_data[UBE_OUTCOME];
@@ -916,13 +897,14 @@  discard block
 block discarded – undo
916 897
 }
917 898
 
918 899
 // ------------------------------------------------------------------------------------------------
919
-function sn_ube_combat_analyze_moon(&$outcome, $is_simulator)
920
-{
900
+function sn_ube_combat_analyze_moon(&$outcome, $is_simulator) {
921 901
   $outcome[UBE_DEBRIS_TOTAL] = 0;
922
-  foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) // TODO via array
902
+  foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) {
903
+    // TODO via array
923 904
   {
924 905
     $outcome[UBE_DEBRIS_TOTAL] += $outcome[UBE_DEBRIS][$resource_id];
925 906
   }
907
+  }
926 908
 
927 909
   if($outcome[UBE_DEBRIS_TOTAL])
928 910
   {
@@ -941,35 +923,33 @@  discard block
 block discarded – undo
941 923
         {
942 924
           $outcome[UBE_DEBRIS_TOTAL] = 0;
943 925
           $outcome[UBE_DEBRIS] = array();
944
-        }
945
-        else
926
+        } else
946 927
         {
947 928
           $moon_debris_spent = 30000000;
948 929
           $moon_debris_left_percent = ($outcome[UBE_DEBRIS_TOTAL] - $moon_debris_spent) / $outcome[UBE_DEBRIS_TOTAL];
949 930
 
950 931
           $outcome[UBE_DEBRIS_TOTAL] = 0;
951
-          foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) // TODO via array
932
+          foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) {
933
+            // TODO via array
952 934
           {
953 935
             $outcome[UBE_DEBRIS][$resource_id] = floor($outcome[UBE_DEBRIS][$resource_id] * $moon_debris_left_percent);
936
+          }
954 937
             $outcome[UBE_DEBRIS_TOTAL] += $outcome[UBE_DEBRIS][$resource_id];
955 938
           }
956 939
         }
957
-      }
958
-      else
940
+      } else
959 941
       {
960 942
         $outcome[UBE_MOON] = UBE_MOON_CREATE_FAILED;
961 943
       }
962 944
     }
963
-  }
964
-  else
945
+  } else
965 946
   {
966 947
     $outcome[UBE_MOON] = UBE_MOON_NONE;
967 948
   }
968 949
 }
969 950
 
970 951
 // ------------------------------------------------------------------------------------------------
971
-function sn_ube_combat_analyze_moon_destroy(&$combat_data)
972
-{
952
+function sn_ube_combat_analyze_moon_destroy(&$combat_data) {
973 953
   // TODO: $is_simulator
974 954
   $reapers = 0;
975 955
   foreach($combat_data[UBE_ROUNDS][count($combat_data[UBE_ROUNDS])-1][UBE_FLEETS] as $fleet_data)
@@ -993,8 +973,7 @@  discard block
 block discarded – undo
993 973
     $combat_data[UBE_OUTCOME][UBE_MOON] = $random <= $combat_data[UBE_OUTCOME][UBE_MOON_DESTROY_CHANCE] ? UBE_MOON_DESTROY_SUCCESS : UBE_MOON_DESTROY_FAILED;
994 974
     $random = mt_rand(1, 100);
995 975
     $combat_data[UBE_OUTCOME][UBE_MOON_REAPERS] = $random <= $combat_data[UBE_OUTCOME][UBE_MOON_REAPERS_DIE_CHANCE] ? UBE_MOON_REAPERS_DIED : UBE_MOON_REAPERS_RETURNED;
996
-  }
997
-  else
976
+  } else
998 977
   {
999 978
     $combat_data[UBE_OUTCOME][UBE_MOON_REAPERS] = UBE_MOON_REAPERS_NONE;
1000 979
   }
@@ -1002,8 +981,7 @@  discard block
 block discarded – undo
1002 981
 
1003 982
 // ------------------------------------------------------------------------------------------------
1004 983
 // Рассылает письма всем участникам боя
1005
-function sn_ube_message_send(&$combat_data)
1006
-{
984
+function sn_ube_message_send(&$combat_data) {
1007 985
   global $lang;
1008 986
 
1009 987
   // TODO: Отсылать каждому игроку сообщение на его языке!
@@ -1042,8 +1020,7 @@  discard block
 block discarded – undo
1042 1020
   if($outcome[UBE_MOON] == UBE_MOON_CREATE_SUCCESS)
1043 1021
   {
1044 1022
     $text_defender .= "{$lang['ube_report_moon_created']} {$outcome[UBE_MOON_SIZE]} {$lang['sys_kilometers_short']}<br /><br />";
1045
-  }
1046
-  elseif($outcome[UBE_MOON] == UBE_MOON_CREATE_FAILED)
1023
+  } elseif($outcome[UBE_MOON] == UBE_MOON_CREATE_FAILED)
1047 1024
   {
1048 1025
     $text_defender .= "{$lang['ube_report_moon_chance']} {$outcome[UBE_MOON_CHANCE]}%<br /><br />";
1049 1026
   }
@@ -1053,8 +1030,7 @@  discard block
 block discarded – undo
1053 1030
     if($outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_NONE)
1054 1031
     {
1055 1032
       $text_defender .= $lang['ube_report_moon_reapers_none'];
1056
-    }
1057
-    else
1033
+    } else
1058 1034
     {
1059 1035
       $text_defender .= "{$lang['ube_report_moon_reapers_wave']}. {$lang['ube_report_moon_reapers_chance']} {$outcome[UBE_MOON_DESTROY_CHANCE]}%. ";
1060 1036
       $text_defender .= $lang[$outcome[UBE_MOON] == UBE_MOON_DESTROY_SUCCESS ? 'ube_report_moon_reapers_success' : 'ube_report_moon_reapers_failure'] . "<br />";
@@ -1081,8 +1057,7 @@  discard block
 block discarded – undo
1081 1057
 // Записывает результат боя в БД
1082 1058
 /** @noinspection SpellCheckingInspection */
1083 1059
 function ube_combat_result_apply(&$combat_data){return sn_function_call('ube_combat_result_apply', array(&$combat_data));}
1084
-function sn_ube_combat_result_apply(&$combat_data)
1085
-{
1060
+function sn_ube_combat_result_apply(&$combat_data) {
1086 1061
 // TODO: Поменять все отладки на запросы
1087 1062
   $destination_user_id = $combat_data[UBE_FLEETS][0][UBE_OWNER];
1088 1063
 
@@ -1130,8 +1105,7 @@  discard block
 block discarded – undo
1130 1105
         {
1131 1106
           // Не планета - всегда сразу записываем строку итогов флота
1132 1107
           $fleet_query[$unit_id] = "{$unit_id},{$units_left}";
1133
-        }
1134
-        elseif($units_lost)
1108
+        } elseif($units_lost)
1135 1109
         {
1136 1110
           // Планета - записываем в ИД юнита его потери только если есть потери
1137 1111
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$units_lost, $combat_data[UBE_PLAYERS][$destination_user_id][UBE_PLAYER_DATA], $planet_id);
@@ -1186,11 +1160,13 @@  discard block
 block discarded – undo
1186 1160
 
1187 1161
 //global $debug;
1188 1162
 //    $fleet_query = implode(',', $fleet_query);
1189
-    if($fleet_id) // Не планета
1163
+    if($fleet_id) {
1164
+      // Не планета
1190 1165
     {
1191 1166
       if($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED)
1192 1167
       {
1193 1168
         $new_fleet_count = 0;
1169
+    }
1194 1170
       }
1195 1171
 
1196 1172
       if($new_fleet_count)
@@ -1202,16 +1178,14 @@  discard block
 block discarded – undo
1202 1178
           $fleet_query['fleet_amount'] = $new_fleet_count;
1203 1179
           fleet_update_set($fleet_id, $fleet_query, $fleet_delta);
1204 1180
         }
1205
-      }
1206
-      else
1181
+      } else
1207 1182
       {
1208 1183
         // Удаляем пустые флоты
1209 1184
         // doquery("DELETE FROM {{fleets}} WHERE `fleet_id` = {$fleet_id} LIMIT 1");
1210 1185
         db_fleet_delete($fleet_id);
1211 1186
         DBStaticUnit::db_unit_list_delete(0, LOC_FLEET, $fleet_id, 0);
1212 1187
       }
1213
-    }
1214
-    else // Планета
1188
+    } else // Планета
1215 1189
     {
1216 1190
       // Сохраняем изменения ресурсов - если они есть
1217 1191
       if(!empty($fleet_delta))
@@ -1222,10 +1196,12 @@  discard block
 block discarded – undo
1222 1196
         }
1223 1197
         DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp));
1224 1198
       }
1225
-      if(!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть
1199
+      if(!empty($db_changeset)) {
1200
+        // Сохраняем изменения юнитов на планете - если они есть
1226 1201
       {
1227 1202
         OldDbChangeSet::db_changeset_apply($db_changeset);
1228 1203
       }
1204
+      }
1229 1205
     }
1230 1206
   }
1231 1207
 
@@ -1242,8 +1218,7 @@  discard block
 block discarded – undo
1242 1218
     $moon_row = uni_create_moon($planet_info[PLANET_GALAXY], $planet_info[PLANET_SYSTEM], $planet_info[PLANET_PLANET], $destination_user_id, $outcome[UBE_MOON_SIZE], '', false);
1243 1219
     $outcome[UBE_MOON_NAME] = $moon_row['name'];
1244 1220
     unset($moon_row);
1245
-  }
1246
-  elseif($outcome[UBE_MOON] == UBE_MOON_DESTROY_SUCCESS)
1221
+  } elseif($outcome[UBE_MOON] == UBE_MOON_DESTROY_SUCCESS)
1247 1222
   {
1248 1223
     DBStaticPlanet::db_planet_delete_by_id($planet_id);
1249 1224
   }
Please login to merge, or discard this patch.
includes/includes/art_artifact.php 1 patch
Braces   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function art_use(&$user, &$planetrow, $unit_id)
4
-{
3
+function art_use(&$user, &$planetrow, $unit_id) {
5 4
   global $lang;
6 5
 
7 6
   if(!in_array($unit_id, sn_get_groups('artifacts')))
@@ -34,14 +33,12 @@  discard block
 block discarded – undo
34 33
           {
35 34
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
36 35
             $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
37
-          }
38
-          else
36
+          } else
39 37
           {
40 38
             $message = $lang['art_lhc_moon_fail'];
41 39
           }
42 40
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message);
43
-        }
44
-        else
41
+        } else
45 42
         {
46 43
           $message = $lang['art_moon_exists'];
47 44
         }
@@ -69,8 +66,9 @@  discard block
 block discarded – undo
69 66
         $sectors_used = 0;
70 67
         foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level)
71 68
         {
72
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true))))
73
-            continue;
69
+          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
70
+                      continue;
71
+          }
74 72
           $sectors_used += $levels_deployed;
75 73
           $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']);
76 74
         }
@@ -104,8 +102,7 @@  discard block
 block discarded – undo
104 102
           DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']);
105 103
           $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left']));
106 104
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message);
107
-        }
108
-        else
105
+        } else
109 106
         {
110 107
           $message = $lang['art_heurestic_chip_no_research'];
111 108
         }
@@ -133,8 +130,7 @@  discard block
 block discarded – undo
133 130
             $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left'])
134 131
           );
135 132
           msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message);
136
-        }
137
-        else
133
+        } else
138 134
         {
139 135
           $message = $lang['art_nano_builder_no_que'];
140 136
         }
@@ -146,8 +142,7 @@  discard block
 block discarded – undo
146 142
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user);
147 143
       OldDbChangeSet::db_changeset_apply($db_changeset);
148 144
     }
149
-  }
150
-  else
145
+  } else
151 146
   {
152 147
     $message = $lang['art_err_no_artifact'];
153 148
   }
Please login to merge, or discard this patch.
includes/includes/flt_functions.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function flt_fleet_speed($user, $fleet)
4
-{
3
+function flt_fleet_speed($user, $fleet) {
5 4
   if (!is_array($fleet))
6 5
   {
7 6
     $fleet = array($fleet => 1);
@@ -29,16 +28,13 @@  discard block
 block discarded – undo
29 28
   if($from['galaxy'] != $to['galaxy'])
30 29
   {
31 30
     $distance = abs($from['galaxy'] - $to['galaxy']) * $config->uni_galaxy_distance;
32
-  }
33
-  elseif($from['system'] != $to['system'])
31
+  } elseif($from['system'] != $to['system'])
34 32
   {
35 33
     $distance = abs($from['system'] - $to['system']) * 5 * 19 + 2700;
36
-  }
37
-  elseif($from['planet'] != $to['planet'])
34
+  } elseif($from['planet'] != $to['planet'])
38 35
   {
39 36
     $distance = abs($from['planet'] - $to['planet']) * 5 + 1000;
40
-  }
41
-  else
37
+  } else
42 38
   {
43 39
     $distance = 5;
44 40
   }
@@ -55,8 +51,7 @@  discard block
 block discarded – undo
55 51
  *
56 52
  * @return array
57 53
  */
58
-function flt_travel_data($user_row, $from, $to, $fleet_array, $speed_percent = 10)
59
-{
54
+function flt_travel_data($user_row, $from, $to, $fleet_array, $speed_percent = 10) {
60 55
   $distance = flt_travel_distance($from, $to);
61 56
 
62 57
   $consumption = 0;
@@ -120,8 +115,7 @@  discard block
 block discarded – undo
120 115
   );
121 116
 }
122 117
 
123
-function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0)
124
-{
118
+function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0) {
125 119
   global $config;
126 120
 
127 121
   $config_bashing_attacks = $config->fleet_bashing_attacks;
@@ -531,8 +525,7 @@  discard block
 block discarded – undo
531 525
       $fleet_ship_count += $amount;
532 526
       $fleet_string     .= "{$unit_id},{$amount};";
533 527
       $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$amount, $user, $from['id']);
534
-    }
535
-    elseif(in_array($unit_id, sn_get_groups('resources_loot')))
528
+    } elseif(in_array($unit_id, sn_get_groups('resources_loot')))
536 529
     {
537 530
       $planet_fields[pname_resource_name($unit_id)]['delta'] -= $amount;
538 531
     }
@@ -624,8 +617,7 @@  discard block
 block discarded – undo
624 617
 //ini_set('error_reporting', E_ALL ^ E_NOTICE);
625 618
 }
626 619
 
627
-function flt_calculate_ship_to_transport_sort($a, $b)
628
-{
620
+function flt_calculate_ship_to_transport_sort($a, $b) {
629 621
   return $a['transport_effectivness'] == $b['transport_effectivness'] ? 0 : ($a['transport_effectivness'] > $b['transport_effectivness'] ? -1 : 1);
630 622
 }
631 623
 
@@ -634,8 +626,7 @@  discard block
 block discarded – undo
634 626
 // $resource_amount - how much amount of resources need to be transported
635 627
 // $from - transport from
636 628
 // $to - transport to
637
-function flt_calculate_fleet_to_transport($ship_list, $resource_amount, $from, $to)
638
-{
629
+function flt_calculate_fleet_to_transport($ship_list, $resource_amount, $from, $to) {
639 630
   global $user;
640 631
 
641 632
   $ship_data = array();
Please login to merge, or discard this patch.
jumpgate.php 1 patch
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
     messageBox($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
122 121
   }
Please login to merge, or discard this patch.
annonce.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@
 block discarded – undo
57 57
     {
58 58
       doquery("INSERT INTO {{annonce}} SET `user` ='{$users['username']}', `galaxie` ='{$users['galaxy']}', `systeme` ='{$users['system']}', `metala` ='{$metalvendre}', `cristala` ='{$cristalvendre}', `deuta` ='{$deutvendre}', `metals` ='{$metalsouhait}', `cristals` ='{$cristalsouhait}', `deuts` ='{$deutsouhait}'");
59 59
       messageBox ($lang['Your_announce_was_recorded'], $lang['announce_status'],"annonce.php");
60
-    }
61
-    else
60
+    } else
62 61
     {
63 62
       messageBox ($lang['Your_announce_not_recorded'], $lang['announce_status'],"annonce.php?action=1");
64 63
     }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin.inc 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,14 +74,12 @@  discard block
 block discarded – undo
74 74
     doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
75 75
     sys_redirect('alliance.php?mode=admin&edit=ally');
76 76
   }
77
-}
78
-elseif(sys_get_param_str('isSaveText'))
77
+} elseif(sys_get_param_str('isSaveText'))
79 78
 {
80 79
   $text = sys_get_param_str_both('text');
81 80
   doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';");
82 81
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
83
-}
84
-elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
82
+} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader'))
85 83
 {
86 84
   if(!$isAllyOwner)
87 85
   {
@@ -98,8 +96,7 @@  discard block
 block discarded – undo
98 96
     sn_db_transaction_commit();
99 97
     sys_redirect('alliance.php');
100 98
   }
101
-}
102
-elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
99
+} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband'))
103 100
 {
104 101
   if(!$isAllyOwner)
105 102
   {
Please login to merge, or discard this patch.
includes/alliance/ali_info.inc 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,16 +23,14 @@  discard block
 block discarded – undo
23 23
     $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']);
24 24
     messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']);
25 25
   }
26
-}
27
-elseif($mode == 'ainfo')
26
+} elseif($mode == 'ainfo')
28 27
 {
29 28
   $tag = sys_get_param_str('tag');
30 29
   $id_ally = sys_get_param_id('a');
31 30
   if($tag)
32 31
   {
33 32
     $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
34
-  }
35
-  elseif($id_ally)
33
+  } elseif($id_ally)
36 34
   {
37 35
     $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true);
38 36
   }
@@ -52,20 +50,17 @@  discard block
 block discarded – undo
52 50
     'USER_ALLY_ID' => $user['ally_id'],
53 51
   ));
54 52
   $page_header          = $lang['sys_alliance'];
55
-}
56
-else
53
+} else
57 54
 {
58 55
   $page_header = $lang['your_alliance'];
59 56
 
60 57
   if($ally['ally_owner'] == $user['id'])
61 58
   {
62 59
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder'];
63
-  }
64
-  elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
60
+  } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name']))
65 61
   {
66 62
     $range = $ranks[$user['ally_rank_id']]['name'];
67
-  }
68
-  else
63
+  } else
69 64
   {
70 65
     $range = $lang['member'];
71 66
   }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_diplomacy.inc 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
       ->doInsert();
67 67
 
68 68
     $accept_offer = false;
69
-  }
70
-  else
69
+  } else
71 70
   {
72 71
     $accept_offer = true;
73 72
     $negotiation = array(
@@ -78,8 +77,7 @@  discard block
 block discarded – undo
78 77
       'alliance_negotiation_relation' => $alliance_negotiation_relation,
79 78
     );
80 79
   }
81
-}
82
-else
80
+} else
83 81
 {
84 82
   $offer_id = sys_get_param_id('offer_id');
85 83
   if($offer_id)
@@ -90,31 +88,26 @@  discard block
 block discarded – undo
90 88
     if(!$negotiation)
91 89
     {
92 90
       messageBox($lang['ali_dip_err_offer_none'], $page_title);
93
-    }
94
-    elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
91
+    } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id'])
95 92
     {
96 93
       // TODO: Add log of hack attempt
97 94
       messageBox($lang['ali_dip_err_offer_alien'], $page_title);
98
-    }
99
-    elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
95
+    } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id'])
100 96
     {
101 97
       if($offer_answer == 'accept')
102 98
       {
103 99
         // TODO: Add log of hack attempt
104 100
         messageBox($lang['ali_dip_err_offer_accept_own'], $page_title);
105
-      }
106
-      elseif($offer_answer == 'deny')
101
+      } elseif($offer_answer == 'deny')
107 102
       {
108 103
         doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
109 104
       }
110
-    }
111
-    else
105
+    } else
112 106
     {
113 107
       if($offer_answer == 'accept')
114 108
       {
115 109
         $accept_offer = true;
116
-      }
117
-      elseif($offer_answer == 'deny')
110
+      } elseif($offer_answer == 'deny')
118 111
       {
119 112
         DBStaticAlly::db_ally_negotiation_update_status_1($offer_id);
120 113
       }
Please login to merge, or discard this patch.
admin/statbuilder.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@
 block discarded – undo
37 37
   </script>';
38 38
 
39 39
   messageBoxAdmin("{$script}<img src=\"design/images/progressbar.gif\"><br>{$lang['sys_wait']}", $lang['adm_stat_title'], '', 0);
40
-}
41
-else
40
+} else
42 41
 {
43 42
   messageBoxAdmin($lang['adm_stat_already_started'], $lang['adm_stat_title'], 'admin/overview.php');
44 43
 }
Please login to merge, or discard this patch.