ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_move.C
Revision: 1.8
Committed: Fri Mar 2 12:14:57 2007 UTC (17 years, 3 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_0
Changes since 1.7: +1 -0 lines
Log Message:
- run, fire, mark in perl
- no more NewServerCommands

File Contents

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