@@ -1,14 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // ---------------------------------------------------------------------------------------------------------------- |
4 | -function lng_try_filepath($path, $file_path_relative) |
|
5 | -{ |
|
4 | +function lng_try_filepath($path, $file_path_relative) { |
|
6 | 5 | $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
7 | 6 | return file_exists($file_path) ? $file_path : false; |
8 | 7 | } |
9 | 8 | |
10 | -function lng_die_not_an_object() |
|
11 | -{ |
|
9 | +function lng_die_not_an_object() { |
|
12 | 10 | print('Ошибка - $lang не объект! Сообщите Администратору сервера и приложите содержимое страницы'); |
13 | 11 | $trace = debug_backtrace(); |
14 | 12 | unset($trace[0]); |
@@ -17,32 +15,27 @@ discard block |
||
17 | 15 | } |
18 | 16 | |
19 | 17 | // ---------------------------------------------------------------------------------------------------------------- |
20 | -function lng_include($filename, $path = '', $ext = '.mo.php') |
|
21 | -{ |
|
18 | +function lng_include($filename, $path = '', $ext = '.mo.php') { |
|
22 | 19 | global $lang; |
23 | 20 | return is_object($lang) ? $lang->lng_include($filename, $path, $ext) : lng_die_not_an_object(); |
24 | 21 | } |
25 | 22 | |
26 | -function lng_get_list() |
|
27 | -{ |
|
23 | +function lng_get_list() { |
|
28 | 24 | global $lang; |
29 | 25 | return is_object($lang) ? $lang->lng_get_list() : lng_die_not_an_object(); |
30 | 26 | } |
31 | 27 | |
32 | -function lng_get_info($entry) |
|
33 | -{ |
|
28 | +function lng_get_info($entry) { |
|
34 | 29 | global $lang; |
35 | 30 | return is_object($lang) ? $lang->lng_get_info($entry) : lng_die_not_an_object(); |
36 | 31 | } |
37 | 32 | |
38 | -function lng_switch($language_new) |
|
39 | -{ |
|
33 | +function lng_switch($language_new) { |
|
40 | 34 | global $lang; |
41 | 35 | return is_object($lang) ? $lang->lng_switch($language_new) : lng_die_not_an_object(); |
42 | 36 | } |
43 | 37 | |
44 | -function lng_load_i18n($i18n) |
|
45 | -{ |
|
38 | +function lng_load_i18n($i18n) { |
|
46 | 39 | global $lang; |
47 | 40 | return is_object($lang) ? $lang->lng_load_i18n($i18n) : lng_die_not_an_object(); |
48 | 41 | } |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function eco_lab_sort_effectivness($a, $b) |
|
4 | -{ |
|
3 | +function eco_lab_sort_effectivness($a, $b) { |
|
5 | 4 | return $a['laboratory_effective_level'] > $b['laboratory_effective_level'] ? -1 : ($a['laboratory_effective_level'] < $b['laboratory_effective_level'] ? 1 : 0); |
6 | 5 | } |
7 | 6 | |
@@ -11,8 +10,7 @@ discard block |
||
11 | 10 | * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws |
12 | 11 | * @version 1.0 |
13 | 12 | */ |
14 | -function eco_get_lab_max_effective_level(&$user, $lab_require) |
|
15 | -{ |
|
13 | +function eco_get_lab_max_effective_level(&$user, $lab_require) { |
|
16 | 14 | if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
17 | 15 | { |
18 | 16 | $user['laboratories_active'] = array(); |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | if($user['user_as_ally']) |
39 | 37 | { |
40 | 38 | $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); |
41 | - } |
|
42 | - else |
|
39 | + } else |
|
43 | 40 | { |
44 | 41 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; |
45 | 42 | $lab_level['effective_level'] = 0; |
@@ -193,8 +190,7 @@ discard block |
||
193 | 190 | return $result; |
194 | 191 | } |
195 | 192 | |
196 | -function eco_is_builds_in_que($planet_que, $unit_list) |
|
197 | -{ |
|
193 | +function eco_is_builds_in_que($planet_que, $unit_list) { |
|
198 | 194 | $eco_is_builds_in_que = false; |
199 | 195 | |
200 | 196 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
@@ -216,8 +212,7 @@ discard block |
||
216 | 212 | } |
217 | 213 | |
218 | 214 | function eco_unit_busy(&$user, &$planet, $unit_id){return sn_function_call('eco_unit_busy', array(&$user, &$planet, $unit_id, &$result));} |
219 | -function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) |
|
220 | -{ |
|
215 | +function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) { |
|
221 | 216 | global $config; |
222 | 217 | |
223 | 218 | $result = isset($result) ? $result : false; |
@@ -238,8 +233,7 @@ discard block |
||
238 | 233 | //{ |
239 | 234 | // $result = true; |
240 | 235 | //} |
241 | - } |
|
242 | - elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
236 | + } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
243 | 237 | { |
244 | 238 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
245 | 239 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function flt_mission_hold(&$mission_data) |
|
4 | -{ |
|
3 | +function flt_mission_hold(&$mission_data) { |
|
5 | 4 | if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
6 | 5 | { |
7 | 6 | fleet_send_back($mission_data['fleet']); |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | * @copyright 2008 By Chlorel for XNova |
8 | 8 | */ |
9 | 9 | |
10 | -function flt_mission_recycle(&$mission_data) |
|
11 | -{ |
|
10 | +function flt_mission_recycle(&$mission_data) { |
|
12 | 11 | $fleet_row = &$mission_data['fleet']; |
13 | 12 | $destination_planet = &$mission_data['dst_planet']; |
14 | 13 | |
@@ -37,8 +36,7 @@ discard block |
||
37 | 36 | if(in_array($unit_id, sn_get_groups('flt_recyclers'))) |
38 | 37 | { |
39 | 38 | $RecyclerCapacity += $capacity; |
40 | - } |
|
41 | - else |
|
39 | + } else |
|
42 | 40 | { |
43 | 41 | $OtherFleetCapacity += $capacity; |
44 | 42 | } |
@@ -55,16 +53,14 @@ discard block |
||
55 | 53 | { |
56 | 54 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
57 | 55 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
58 | - } |
|
59 | - else |
|
56 | + } else |
|
60 | 57 | { |
61 | 58 | if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
62 | 59 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
63 | 60 | { |
64 | 61 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
65 | 62 | $RecycledGoods["crystal"] = $RecyclerCapacity / 2; |
66 | - } |
|
67 | - else |
|
63 | + } else |
|
68 | 64 | { |
69 | 65 | if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) |
70 | 66 | { |
@@ -72,20 +68,17 @@ discard block |
||
72 | 68 | if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $RecycledGoods["crystal"])) |
73 | 69 | { |
74 | 70 | $RecycledGoods["metal"] = $RecyclerCapacity - $RecycledGoods["crystal"]; |
75 | - } |
|
76 | - else |
|
71 | + } else |
|
77 | 72 | { |
78 | 73 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
79 | 74 | } |
80 | - } |
|
81 | - else |
|
75 | + } else |
|
82 | 76 | { |
83 | 77 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
84 | 78 | if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $RecycledGoods["metal"])) |
85 | 79 | { |
86 | 80 | $RecycledGoods["crystal"] = $RecyclerCapacity - $RecycledGoods["metal"]; |
87 | - } |
|
88 | - else |
|
81 | + } else |
|
89 | 82 | { |
90 | 83 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
91 | 84 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * @version 1.1 |
9 | 9 | * @copyright 2008 by Chlorel for XNova |
10 | 10 | */ |
11 | -function flt_mission_relocate($mission_data) |
|
12 | -{ |
|
11 | +function flt_mission_relocate($mission_data) { |
|
13 | 12 | $fleet_row = &$mission_data['fleet']; |
14 | 13 | $destination_planet = &$mission_data['dst_planet']; |
15 | 14 |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function sn_user_birthday_celebrate() |
|
4 | -{ |
|
3 | +function sn_user_birthday_celebrate() { |
|
5 | 4 | global $config, $lang; |
6 | 5 | |
7 | 6 | sn_db_transaction_start(); |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function sn_ube_simulator_encode_replay($combat, $type) |
|
4 | -{ |
|
3 | +function sn_ube_simulator_encode_replay($combat, $type) { |
|
5 | 4 | $strPacked = "{$type}!"; |
6 | 5 | |
7 | 6 | foreach($combat as $fleetID => $fleetCompress) |
@@ -17,8 +16,7 @@ discard block |
||
17 | 16 | return $strPacked; |
18 | 17 | } |
19 | 18 | |
20 | -function sn_ube_simulator_decode_replay($str_data) |
|
21 | -{ |
|
19 | +function sn_ube_simulator_decode_replay($str_data) { |
|
22 | 20 | $fleet_id = 0; |
23 | 21 | |
24 | 22 | $arr_data_unpacked = explode('!', $str_data); |
@@ -58,8 +56,7 @@ discard block |
||
58 | 56 | |
59 | 57 | // ------------------------------------------------------------------------------------------------ |
60 | 58 | // Преобразовывает данные симулятора в данные для расчета боя |
61 | -function sn_ube_simulator_fill_side(&$combat_data, $side_info, $attacker, $player_id = -1) |
|
62 | -{ |
|
59 | +function sn_ube_simulator_fill_side(&$combat_data, $side_info, $attacker, $player_id = -1) { |
|
63 | 60 | global $ube_convert_techs; |
64 | 61 | |
65 | 62 | $player_id = $player_id == -1 ? count($combat_data[UBE_PLAYERS]) : $player_id; |
@@ -82,16 +79,13 @@ discard block |
||
82 | 79 | if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) |
83 | 80 | { |
84 | 81 | $combat_data[UBE_FLEETS][$player_id][UBE_COUNT][$unit_id] = $unit_count; |
85 | - } |
|
86 | - elseif($unit_type == UNIT_RESOURCES) |
|
82 | + } elseif($unit_type == UNIT_RESOURCES) |
|
87 | 83 | { |
88 | 84 | $combat_data[UBE_FLEETS][$player_id][UBE_RESOURCES][$unit_id] = $unit_count; |
89 | - } |
|
90 | - elseif($unit_type == UNIT_TECHNOLOGIES) |
|
85 | + } elseif($unit_type == UNIT_TECHNOLOGIES) |
|
91 | 86 | { |
92 | 87 | $combat_data[UBE_PLAYERS][$player_id][UBE_BONUSES][$ube_convert_techs[$unit_id]] += $unit_count * get_unit_param($unit_id, P_BONUS_VALUE) / 100; |
93 | - } |
|
94 | - elseif($unit_type == UNIT_GOVERNORS) |
|
88 | + } elseif($unit_type == UNIT_GOVERNORS) |
|
95 | 89 | { |
96 | 90 | if($unit_id == MRC_FORTIFIER) |
97 | 91 | { |
@@ -100,8 +94,7 @@ discard block |
||
100 | 94 | $combat_data[UBE_FLEETS][$player_id][UBE_BONUSES][$ube_id] += $unit_count * get_unit_param($unit_id, P_BONUS_VALUE) / 100; |
101 | 95 | } |
102 | 96 | } |
103 | - } |
|
104 | - elseif($unit_type == UNIT_MERCENARIES) |
|
97 | + } elseif($unit_type == UNIT_MERCENARIES) |
|
105 | 98 | { |
106 | 99 | if($unit_id == MRC_ADMIRAL) |
107 | 100 | { |
@@ -115,8 +108,7 @@ discard block |
||
115 | 108 | } |
116 | 109 | } |
117 | 110 | |
118 | -function sn_ube_simulator_fleet_converter($sym_attacker, $sym_defender) |
|
119 | -{ |
|
111 | +function sn_ube_simulator_fleet_converter($sym_attacker, $sym_defender) { |
|
120 | 112 | $combat_data = array( |
121 | 113 | UBE_OPTIONS => array( |
122 | 114 | UBE_SIMULATOR => sys_get_param_int('simulator'), |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * @copyright 2008 By Chlorel for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -function flt_mission_transport(&$mission_data) |
|
12 | -{ |
|
11 | +function flt_mission_transport(&$mission_data) { |
|
13 | 12 | $fleet_row = &$mission_data['fleet']; |
14 | 13 | $source_planet = &$mission_data['src_planet']; |
15 | 14 | $destination_planet = &$mission_data['dst_planet']; |
@@ -10,8 +10,7 @@ |
||
10 | 10 | // ---------------------------------------------------------------------------------------------------------------- |
11 | 11 | // Mission Case 9: -> Coloniser |
12 | 12 | // |
13 | -function flt_mission_colonize(&$mission_data) |
|
14 | -{ |
|
13 | +function flt_mission_colonize(&$mission_data) { |
|
15 | 14 | $fleet_row = &$mission_data['fleet']; |
16 | 15 | $src_user_row = &$mission_data['src_user']; |
17 | 16 |