-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmoves_main.php
More file actions
133 lines (90 loc) · 3.6 KB
/
moves_main.php
File metadata and controls
133 lines (90 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
/*
This file is part of STFC.
Copyright 2006-2007 by Michael Krauss (info@stfc2.de) and Tobias Gafner
STFC is based on STGC,
Copyright 2003-2007 by Florian Brede (florian_brede@hotmail.com) and Philipp Schmidt
STFC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
STFC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$sdl->log('entering file');
// backward
if(!isset($CURRENT_TICK)) $CURRENT_TICK = $ACTUAL_TICK;
include('moves_common.php');
include('moves_combat.php');
include('moves_action_11.php');
include('moves_action_12.php');
include('moves_action_13.php');
include('moves_action_14.php');
include('moves_action_21.php');
include('moves_action_22.php');
include('moves_action_23.php');
include('moves_action_24.php');
include('moves_action_25.php');
include('moves_action_26.php');
include('moves_action_27.php');
include('moves_action_28.php');
include('moves_action_31.php');
include('moves_action_32.php');
include('moves_action_33.php');
include('moves_action_34.php');
include('moves_action_40.php');
include('moves_action_41.php');
include('moves_action_42.php');
include('moves_action_46.php');
;
include('moves_action_51.php');
include('moves_action_52.php');
include('moves_action_53.php');
include('moves_action_54.php');
include('moves_action_55.php');
// #############################################################################
$sql = 'UPDATE scheduler_shipmovement
SET move_status = 2
WHERE action_code = 32 AND
move_status = 0 AND
move_finish <= '.$CURRENT_TICK;
if(!$db->query($sql)) {
$sdl->log('- Moves Database Error: Could not update fake fleets data! CONTINUE');
}
// #############################################################################
$sql = 'UPDATE scheduler_shipmovement
SET remaining_distance = remaining_distance - tick_speed
WHERE move_status = 0 AND total_distance > 0 AND remaining_distance > tick_speed';
if(!$q_moves = $db->query($sql)) {
$sdl->log('- Moves Database Error: Could not update moves data! MOVES ABORTED');
return MV_EXEC_ERROR;
}
$affected_rows = $db->affected_rows();
$sdl->log('- Moves: updated distances on '.$affected_rows.' movements');
$sql = 'SELECT ss.*,
u.user_name, u.user_active, u.user_race, u.user_alliance, u.user_alliance_status, u.user_planets, u.user_capital
FROM (scheduler_shipmovement ss)
INNER JOIN user u ON u.user_id = ss.user_id
WHERE ss.move_finish <= '.$CURRENT_TICK.' AND
ss.move_status = 0
ORDER BY ss.move_id ASC';
if(!$q_moves = $db->query($sql)) {
$sdl->log('- Moves Database Error: Could not select main moves data! MOVES ABORTED');
return MV_EXEC_ERROR;
}
$sdl->log('- Moves: Starting process');
while($cur_move = $db->fetchrow($q_moves)) {
$action_class = 'moves_action_'.$cur_move['action_code'];
//if ($cur_move['action_code']<50 && $cur_move['action_code']!=24 && $cur_move['action_code']!=25)
//{
$mv = new $action_class($db, $cur_move, $CURRENT_TICK);
$mv->_main();
$mv = null;
//}
}
$sdl->log('- Moves: Ending process');
?>