ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_move.C
Revision: 1.4
Committed: Thu Sep 14 22:34:03 2006 UTC (17 years, 9 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.3: +1 -7 lines
Log Message:
indent

File Contents

# Content
1 /*
2 CrossFire, A Multiplayer game for X-windows
3
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 The author can be reached via e-mail to <crossfire@schmorp.de>
22 */
23
24 #include <global.h>
25 #ifndef __CEXTRACT__
26 # include <sproto.h>
27 #endif
28 #include <skills.h>
29
30 static int
31 move_internal (object *op, char *params, int dir)
32 {
33 if (params)
34 {
35 if (params[0] == 'f')
36 {
37 if (!op->contr->fire_on)
38 {
39 op->contr->fire_on = 1;
40 move_player (op, dir);
41 op->contr->fire_on = 0;
42 return 0;
43 }
44 }
45 else if (params[0] == 'r' && !op->contr->run_on)
46 op->contr->run_on = 1;
47 }
48 move_player (op, dir);
49 return 0;
50 }
51
52 int
53 command_east (object *op, char *params)
54 {
55 return move_internal (op, params, 3);
56 }
57
58 int
59 command_north (object *op, char *params)
60 {
61 return move_internal (op, params, 1);
62 }
63
64 int
65 command_northeast (object *op, char *params)
66 {
67 return move_internal (op, params, 2);
68 }
69
70 int
71 command_northwest (object *op, char *params)
72 {
73 return move_internal (op, params, 8);
74 }
75
76 int
77 command_south (object *op, char *params)
78 {
79 return move_internal (op, params, 5);
80 }
81
82 int
83 command_southeast (object *op, char *params)
84 {
85 return move_internal (op, params, 4);
86 }
87
88 int
89 command_southwest (object *op, char *params)
90 {
91 return move_internal (op, params, 6);
92 }
93
94 int
95 command_west (object *op, char *params)
96 {
97 return move_internal (op, params, 7);
98 }
99
100 int
101 command_stay (object *op, char *params)
102 {
103 if (!op->contr->fire_on && (!params || params[0] != 'f'))
104 return 0;
105 fire (op, 0);
106 return 0;
107 }