1 | /* |
1 | /* |
2 | * static char *rcsid_login_c = |
2 | * static char *rcsid_login_c = |
3 | * "$Id: login.c,v 1.1.1.1 2006/02/03 07:14:32 root Exp $"; |
3 | * "$Id: login.c,v 1.4 2006/08/13 17:16:04 elmex dead $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
277 | /* Eneq(@csd.uu.se): If we have an open container hide it. */ |
277 | /* Eneq(@csd.uu.se): If we have an open container hide it. */ |
278 | if (op->container) { |
278 | if (op->container) { |
279 | container=op->container; |
279 | container=op->container; |
280 | op->container=NULL; |
280 | op->container=NULL; |
281 | } |
281 | } |
|
|
282 | |
|
|
283 | execute_global_event (EVENT_PLAYER_SAVE, op, filename); |
282 | |
284 | |
283 | fprintf(fp,"password %s\n",pl->password); |
285 | fprintf(fp,"password %s\n",pl->password); |
284 | if (settings.set_title == TRUE) |
286 | if (settings.set_title == TRUE) |
285 | if(pl->own_title[0]!='\0') |
287 | if(pl->own_title[0]!='\0') |
286 | fprintf(fp,"title %s\n",pl->own_title); |
288 | fprintf(fp,"title %s\n",pl->own_title); |
… | |
… | |
367 | new_draw_info(NDI_UNIQUE, 0,op, "Can't save character."); |
369 | new_draw_info(NDI_UNIQUE, 0,op, "Can't save character."); |
368 | unlink(tmpfilename); |
370 | unlink(tmpfilename); |
369 | free(tmpfilename); |
371 | free(tmpfilename); |
370 | return 0; |
372 | return 0; |
371 | } |
373 | } |
|
|
374 | |
372 | checksum = 0; |
375 | checksum = 0; |
373 | sprintf(backupfile, "%s.tmp", filename); |
376 | sprintf(backupfile, "%s.tmp", filename); |
374 | rename(filename, backupfile); |
377 | rename(filename, backupfile); |
375 | fp = fopen(filename,"w"); |
378 | fp = fopen(filename,"w"); |
376 | if(!fp) { |
379 | if(!fp) { |
… | |
… | |
398 | if (wiz) SET_FLAG(op,FLAG_WIZ); |
401 | if (wiz) SET_FLAG(op,FLAG_WIZ); |
399 | if(!flag) |
402 | if(!flag) |
400 | esrv_send_inventory(op, op); |
403 | esrv_send_inventory(op, op); |
401 | |
404 | |
402 | chmod(filename,SAVE_MODE); |
405 | chmod(filename,SAVE_MODE); |
|
|
406 | |
403 | return 1; |
407 | return 1; |
404 | } |
408 | } |
405 | |
409 | |
406 | void copy_file(const char *filename, FILE *fpout) { |
410 | void copy_file(const char *filename, FILE *fpout) { |
407 | FILE *fp; |
411 | FILE *fp; |
… | |
… | |
695 | |
699 | |
696 | new_draw_info(NDI_UNIQUE, 0,op,"Welcome Back!"); |
700 | new_draw_info(NDI_UNIQUE, 0,op,"Welcome Back!"); |
697 | new_draw_info_format(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, |
701 | new_draw_info_format(NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, |
698 | "%s has entered the game.",pl->ob->name); |
702 | "%s has entered the game.",pl->ob->name); |
699 | |
703 | |
|
|
704 | execute_global_event (EVENT_PLAYER_LOAD, op, filename); |
|
|
705 | |
700 | /* Lauwenmark : Here we handle the LOGIN global event */ |
706 | /* Lauwenmark : Here we handle the LOGIN global event */ |
701 | execute_global_event(EVENT_LOGIN, pl, pl->socket.host); |
707 | execute_global_event(EVENT_LOGIN, pl, pl->socket.host); |
702 | op->contr->socket.update_look=1; |
708 | op->contr->socket.update_look=1; |
703 | /* If the player should be dead, call kill_player for them |
709 | /* If the player should be dead, call kill_player for them |
704 | * Only check for hp - if player lacks food, let the normal |
710 | * Only check for hp - if player lacks food, let the normal |