Crossfire Server, Trunk  1.75.0
player_changer.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
18 #include "global.h"
19 
20 #include <string.h>
21 
22 #include "ob_methods.h"
23 #include "ob_types.h"
24 #include "sounds.h"
25 #include "sproto.h"
26 
27 static method_ret player_changer_type_process(object *op);
28 
34 }
35 
49  object *player;
50  char c;
51 
52  if (!op->above || !EXIT_PATH(op))
53  return METHOD_OK;
54 
55  /* This isn't all that great - means that the player_mover
56  * needs to be on top.
57  */
58  if (op->above->type == PLAYER) {
59  if (events_execute_object_event(op, EVENT_TRIGGER, op->above, NULL, NULL, SCRIPT_FIX_NOTHING) != 0)
60  return METHOD_OK;
61  player = op->above;
62  FOR_INV_PREPARE(op, walk)
65 
69 
70  /* update players death & WoR home-position */
71  sscanf(EXIT_PATH(op), "%c", &c);
72  if (c == '/') {
74  sizeof(player->contr->savebed_map));
75  player->contr->bed_x = EXIT_X(op);
76  player->contr->bed_y = EXIT_Y(op);
77  } else
78  LOG(llevDebug, "WARNING: destination '%s' in player_changer must be an absolute path!\n", EXIT_PATH(op));
79 
80  enter_exit(op->above, op);
81  save_player(player, 1);
82  }
83 
84  return METHOD_OK;
85 }
apply_changes_to_player
void apply_changes_to_player(object *pl, object *change, int limit_stats)
Applies (race) changes to a player.
Definition: apply.cpp:1668
player::bed_y
int16_t bed_y
x,y - coordinates of respawn (savebed).
Definition: player.h:111
PLAYER
@ PLAYER
Definition: object.h:112
global.h
UPD_FACE
#define UPD_FACE
Definition: newclient.h:321
safe_strncpy
#define safe_strncpy
Definition: compat.h:27
LOG
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
Definition: logger.cpp:58
player
One player.
Definition: player.h:105
esrv_send_inventory
void esrv_send_inventory(object *pl, object *op)
Sends inventory of a container.
Definition: item.cpp:316
c
static event_registration c
Definition: citylife.cpp:424
player::bed_x
int16_t bed_x
Definition: player.h:111
EVENT_TRIGGER
#define EVENT_TRIGGER
Button pushed, lever pulled, etc.
Definition: events.h:42
METHOD_OK
#define METHOD_OK
Definition: ob_methods.h:15
EXIT_PATH
#define EXIT_PATH(xyz)
Definition: define.h:433
player::savebed_map
char savebed_map[MAX_BUF]
Map where player will respawn after death.
Definition: player.h:110
fix_object
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
Definition: living.cpp:1132
register_process
void register_process(int ob_type, process_func method)
Registers the process method for the given type.
Definition: ob_types.cpp:71
events_execute_object_event
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Execute an event on the specified object.
Definition: events.cpp:309
object::above
object * above
Pointer to the object stacked above this one.
Definition: object.h:296
object::type
uint8_t type
PLAYER, BULLET, etc.
Definition: object.h:348
FOR_INV_FINISH
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
Definition: define.h:671
sproto.h
EXIT_X
#define EXIT_X(xyz)
Definition: define.h:435
method_ret
char method_ret
Define some standard return values for callbacks which don't need to return any other results.
Definition: ob_methods.h:14
ob_types.h
sounds.h
SCRIPT_FIX_NOTHING
#define SCRIPT_FIX_NOTHING
Definition: global.h:381
player
same as sound ncom command like but with extra the client want tick commands so it knows animation timing the client wants to be informed of pickup mode changes Mode will be sent when the player successfully logs and afterward any time the value is but over many options have become defaults This documents those now obsolete client can handle the bit exp values that are now used values are sent as bit Setting this flag also means that skill exp will be and it will be sent in revised method as described in the stats command Value is an integer in string format else Deprecated client should presume all servers support this server will return FALSE Deprecated replaced with sound2 setup but rather that the server was unable to complete the given protocol request the command(just the command name) that generated the failure. reason the server will only keep track of the latest mark sent The server will generally send a drawinfo command informing the player
Definition: protocol.txt:475
PLAYER_CHANGER
@ PLAYER_CHANGER
Definition: object.h:167
enter_exit
void enter_exit(object *op, object *exit_ob)
Tries to move 'op' to exit_ob.
Definition: server.cpp:727
AC_PLAYER_STAT_LIMIT
#define AC_PLAYER_STAT_LIMIT
Definition: define.h:590
player_changer_type_process
static method_ret player_changer_type_process(object *op)
Move for PLAYER_CHANGER.
Definition: player_changer.cpp:48
esrv_update_item
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
Definition: main.cpp:359
EXIT_Y
#define EXIT_Y(xyz)
Definition: define.h:436
save_player
int save_player(object *op, int flag)
Saves a player to disk.
Definition: login.cpp:239
init_type_player_changer
void init_type_player_changer(void)
Initializer for the player changer object type.
Definition: player_changer.cpp:32
ob_methods.h
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
Definition: define.h:664
llevDebug
@ llevDebug
Only for debugging purposes.
Definition: logger.h:13