Completed
Push — work-fleets ( 9522d3...bdccb3 )
by SuperNova.WS
05:13
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
define('SN_IN_FLEET', true);
4
define('SN_RENDER_NAVBAR_PLANET', true);
5
6
include('common.' . substr(strrchr(__FILE__, '.'), 1));
7
8
// TODO - Переместить это куда-нибудь
9
$fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode'));
10
if($fleet_ship_sort = sys_get_param_id('sort_elements') && $fleet_page == 0) {
11
  define('IN_AJAX', true);
12
  if(!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
13
    // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort);
14
    // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0));
15
    classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort;
16
    classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE] = sys_get_param_id('sort_elements_inverse', 0);
17
  }
18
  die();
19
}
20
21
global $template_result, $user, $planetrow;
22
$template_result = !empty($template_result) && is_array($template_result) ? $template_result : array();
23
24
25
require_once('includes/includes/flt_functions.php');
26
27
lng_include('fleet');
28
29
//$galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']);
30
//$system = sys_get_param_int('system', $planetrow['system']);
31
//$planet = sys_get_param_int('planet', $planetrow['planet']);
32
33
$targetVector = new Vector(VECTOR_READ_PARAMS, $planetrow);
34
$target_mission = sys_get_param_int('target_mission', MT_NONE);
35
$ships = sys_get_param_array('ships');
36
$fleet_group_mr = sys_get_param_id('fleet_group');
37
$speed_percent = sys_get_param_int('speed', 10);
38
39
40
// Инициализируем объекты значениями по умолчанию
41
$objFleet5 = new Fleet();
42
$objFleet5->initDefaults($user, $planetrow, $targetVector, $target_mission, $ships, $fleet_group_mr, $speed_percent);
43
44
45
// TODO
46
//if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
47
//  $planet_type = PT_PLANET;
48
//} elseif($target_mission == MT_RECYCLE) {
49
//  $planet_type = PT_DEBRIS;
50
//} elseif($target_mission == MT_DESTROY) {
51
//  $planet_type = PT_MOON;
52
//} else {
53
//  $planet_type = sys_get_param_int('planet_type');
54
//  if(!$planet_type) {
55
//    $planet_type = sys_get_param_int('planettype', $planetrow['planet_type']);
56
//  }
57
//}
58
59
// TODO
60
//$options = array();
61
//$MaxFleets = $options['fleets_max'] = GetMaxFleets($user);
62
//
63
//$FlyingFleets = FleetList::fleet_count_flying($user['id']);
64
//if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
65
//  message(classLocale::$lang['fl_noslotfree'], classLocale::$lang['fl_error'], "fleet." . PHP_EX, 5);
66
//}
67
//
68
//$MaxExpeditions = get_player_max_expeditons($user);
69
//if($MaxExpeditions) {
70
//  $FlyingExpeditions = FleetList::fleet_count_flying($user['id'], MT_EXPLORE);
71
//} else {
72
//  $FlyingExpeditions = 0;
73
//}
74
75
76
switch($fleet_page) {
77
  case 3:
78
79
  case 2:
80
//    $objFleet5->restrictMission();
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
81
  // No Break
82
83
  case 1:
84
//    if($galaxy && $system && $planet) {
85
//      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
86
//
87
//      $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
88
//    }
89
90
}
91
92
$objFleet5->fleetPage0Prepare();
93
94
switch($fleet_page) {
95
  case 1:
96
    $objFleet5->fleetPage1();
97
  break;
98
99
  case 2:
100
    $objFleet5->fleetPage2();
101
  break;
102
103
  case 3:
104
    require_once('includes/includes/flt_page3.inc');
105
    sn_fleet_page3($duration);
106
  break;
107
108
  case 4:
109
    require('includes/includes/flt_page4.inc');
110
  break;
111
112
  case 5:
113
    require('includes/includes/flt_page5.inc');
114
  break;
115
116
  default:
117
    $objFleet5->fleetPage0();
118
  break;
119
}
120