1 | /* |
1 | /* |
2 | * static char *rcsid_player_c = |
2 | * static char *rcsid_player_c = |
3 | * "$Id: player.C,v 1.3 2006/08/25 13:24:50 root Exp $"; |
3 | * "$Id: player.C,v 1.6 2006/08/26 23:36:34 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
228 | } |
228 | } |
229 | |
229 | |
230 | /* Clears basically the entire player structure except |
230 | /* Clears basically the entire player structure except |
231 | * for next and socket. |
231 | * for next and socket. |
232 | */ |
232 | */ |
233 | memset((void*)((char*)p + offsetof(player, ob)), 0, |
233 | memset (static_cast<player_memset *>(p), 0, sizeof (player_memset)); |
234 | sizeof(player) - offsetof(player, ob)); |
|
|
235 | |
234 | |
236 | /* There are some elements we want initialized to non zero value - |
235 | /* There are some elements we want initialized to non zero value - |
237 | * we deal with that below this point. |
236 | * we deal with that below this point. |
238 | */ |
237 | */ |
239 | p->party=NULL; |
238 | p->party=NULL; |
… | |
… | |
1035 | int x = op->x, y = op->y; |
1034 | int x = op->x, y = op->y; |
1036 | remove_statbonus(op); |
1035 | remove_statbonus(op); |
1037 | remove_ob (op); |
1036 | remove_ob (op); |
1038 | op->arch = get_player_archetype(op->arch); |
1037 | op->arch = get_player_archetype(op->arch); |
1039 | copy_object (&op->arch->clone, op); |
1038 | copy_object (&op->arch->clone, op); |
|
|
1039 | op->instantiate (); |
1040 | op->stats = op->contr->orig_stats; |
1040 | op->stats = op->contr->orig_stats; |
1041 | free_string (op->name); |
1041 | free_string (op->name); |
1042 | op->name = name; |
1042 | op->name = name; |
1043 | free_string(op->name_pl); |
1043 | free_string(op->name_pl); |
1044 | op->name_pl = add_string(name); |
1044 | op->name_pl = add_string(name); |
… | |
… | |
2670 | transfer_ob(op, x, y, 0, NULL); |
2670 | transfer_ob(op, x, y, 0, NULL); |
2671 | op->contr->braced=0; |
2671 | op->contr->braced=0; |
2672 | return; |
2672 | return; |
2673 | } |
2673 | } |
2674 | |
2674 | |
2675 | /* Lauwenmark: Handle for plugin death event */ |
|
|
2676 | if (execute_event(op, EVENT_DEATH,NULL,NULL,NULL,SCRIPT_FIX_ALL) != 0) |
|
|
2677 | return; |
|
|
2678 | |
|
|
2679 | INVOKE_PLAYER (DEATH, op->contr); |
2675 | INVOKE_PLAYER (DEATH, op->contr); |
2680 | |
2676 | |
2681 | command_kill_pets (op, 0); |
2677 | command_kill_pets (op, 0); |
2682 | |
2678 | |
2683 | if(op->stats.food<0) { |
2679 | if(op->stats.food<0) { |