Crossfire Server, Branch 1.12
R12190
|
00001 /* 00002 CrossFire, A Multiplayer game for X-windows 00003 00004 Copyright (C) 2008 Crossfire Development Team 00005 Copyright (C) 1992 Frank Tore Johansen 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 00021 The authors can be reached via e-mail at crossfire-devel@real-time.com 00022 */ 00023 00028 #include <global.h> 00029 #include <ob_methods.h> 00030 #include <ob_types.h> 00031 #include <sounds.h> 00032 #include <sproto.h> 00033 00034 static method_ret player_changer_type_process(ob_methods *context, object *op); 00035 00039 void init_type_player_changer(void) { 00040 register_process(PLAYER_CHANGER, player_changer_type_process); 00041 } 00042 00056 static method_ret player_changer_type_process(ob_methods *context, object *op) { 00057 object *player; 00058 object *walk; 00059 char c; 00060 00061 if (!op->above || !EXIT_PATH(op)) 00062 return METHOD_OK; 00063 00064 /* This isn't all that great - means that the player_mover 00065 * needs to be on top. 00066 */ 00067 if (op->above->type == PLAYER) { 00068 /* Lauwenmark: Handle for plugin TRIGGER event */ 00069 if (execute_event(op, EVENT_TRIGGER, op->above, NULL, NULL, SCRIPT_FIX_NOTHING) != 0) 00070 return METHOD_OK; 00071 player = op->above; 00072 for (walk = op->inv; walk != NULL; walk = walk->below) 00073 apply_changes_to_player(player, walk); 00074 00075 fix_object(player); 00076 esrv_send_inventory(op->above, op->above); 00077 esrv_update_item(UPD_FACE, op->above, op->above); 00078 00079 /* update players death & WoR home-position */ 00080 sscanf(EXIT_PATH(op), "%c", &c); 00081 if (c == '/') { 00082 strcpy(player->contr->savebed_map, EXIT_PATH(op)); 00083 player->contr->bed_x = EXIT_X(op); 00084 player->contr->bed_y = EXIT_Y(op); 00085 } else 00086 LOG(llevDebug, "WARNING: destination '%s' in player_changer must be an absolute path!\n", EXIT_PATH(op)); 00087 00088 enter_exit(op->above, op); 00089 save_player(player, 1); 00090 } 00091 00092 return METHOD_OK; 00093 }