ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_move.C
Revision: 1.6
Committed: Sat Jan 6 14:42:30 2007 UTC (17 years, 4 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.5: +1 -0 lines
Log Message:
added some copyrights

File Contents

# User Rev Content
1 elmex 1.1 /*
2     CrossFire, A Multiplayer game for X-windows
3    
4 pippijn 1.6 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 elmex 1.1 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 root 1.4 The author can be reached via e-mail to <crossfire@schmorp.de>
23 elmex 1.1 */
24    
25     #include <global.h>
26 root 1.5 #include <sproto.h>
27 elmex 1.1 #include <skills.h>
28    
29 root 1.3 static int
30     move_internal (object *op, char *params, int dir)
31 elmex 1.1 {
32 root 1.3 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 elmex 1.1 return 0;
49     }
50    
51 root 1.3 int
52     command_east (object *op, char *params)
53 elmex 1.1 {
54 root 1.3 return move_internal (op, params, 3);
55 elmex 1.1 }
56    
57 root 1.3 int
58     command_north (object *op, char *params)
59 elmex 1.1 {
60 root 1.3 return move_internal (op, params, 1);
61 elmex 1.1 }
62    
63 root 1.3 int
64     command_northeast (object *op, char *params)
65 elmex 1.1 {
66 root 1.3 return move_internal (op, params, 2);
67 elmex 1.1 }
68    
69 root 1.3 int
70     command_northwest (object *op, char *params)
71 elmex 1.1 {
72 root 1.3 return move_internal (op, params, 8);
73 elmex 1.1 }
74    
75 root 1.3 int
76     command_south (object *op, char *params)
77 elmex 1.1 {
78 root 1.3 return move_internal (op, params, 5);
79 elmex 1.1 }
80    
81 root 1.3 int
82     command_southeast (object *op, char *params)
83 elmex 1.1 {
84 root 1.3 return move_internal (op, params, 4);
85 elmex 1.1 }
86    
87 root 1.3 int
88     command_southwest (object *op, char *params)
89 elmex 1.1 {
90 root 1.3 return move_internal (op, params, 6);
91 elmex 1.1 }
92    
93 root 1.3 int
94     command_west (object *op, char *params)
95 elmex 1.1 {
96 root 1.3 return move_internal (op, params, 7);
97 elmex 1.1 }
98    
99 root 1.3 int
100     command_stay (object *op, char *params)
101 elmex 1.1 {
102     if (!op->contr->fire_on && (!params || params[0] != 'f'))
103     return 0;
104 root 1.3 fire (op, 0);
105 elmex 1.1 return 0;
106     }