Crossfire Server, Branch 1.12
R12190
|
00001 /* 00002 * static char *rcsid_c_move_c = 00003 * "$Id: c_move.c 11578 2009-02-23 22:02:27Z lalo $"; 00004 */ 00005 00006 /* 00007 CrossFire, A Multiplayer game for X-windows 00008 00009 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 00010 Copyright (C) 1992 Frank Tore Johansen 00011 00012 This program is free software; you can redistribute it and/or modify 00013 it under the terms of the GNU General Public License as published by 00014 the Free Software Foundation; either version 2 of the License, or 00015 (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with this program; if not, write to the Free Software 00024 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00025 00026 The author can be reached via e-mail to crossfire-devel@real-time.com 00027 */ 00028 00034 #include <global.h> 00035 #ifndef __CEXTRACT__ 00036 #include <sproto.h> 00037 #endif 00038 #include <skills.h> 00039 00052 static int move_internal(object *op, char *params, int dir) { 00053 if (params) { 00054 if (params[0] == 'f') { 00055 if (!op->contr->fire_on) { 00056 op->contr->fire_on = 1; 00057 move_player(op, dir); 00058 op->contr->fire_on = 0; 00059 return 0; 00060 } 00061 } else if (params[0] == 'r' && !op->contr->run_on) 00062 op->contr->run_on = 1; 00063 } 00064 move_player(op, dir); 00065 return 0; 00066 } 00067 00077 int command_east(object *op, char *params) { 00078 return move_internal(op, params, 3); 00079 } 00080 00090 int command_north(object *op, char *params) { 00091 return move_internal(op, params, 1); 00092 } 00093 00103 int command_northeast(object *op, char *params) { 00104 return move_internal(op, params, 2); 00105 } 00106 00116 int command_northwest(object *op, char *params) { 00117 return move_internal(op, params, 8); 00118 } 00119 00129 int command_south(object *op, char *params) { 00130 return move_internal(op, params, 5); 00131 } 00132 00142 int command_southeast(object *op, char *params) { 00143 return move_internal(op, params, 4); 00144 } 00145 00155 int command_southwest(object *op, char *params) { 00156 return move_internal(op, params, 6); 00157 } 00158 00168 int command_west(object *op, char *params) { 00169 return move_internal(op, params, 7); 00170 } 00171 00181 int command_stay(object *op, char *params) { 00182 if (!op->contr->fire_on && (!params || params[0] != 'f')) 00183 return 0; 00184 fire(op, 0); 00185 return 0; 00186 }