1 | /* |
1 | /* |
2 | * static char *rcsid_login_c = |
2 | * static char *rcsid_login_c = |
3 | * "$Id: login.c,v 1.1 2006/02/03 07:14:32 root Exp $"; |
3 | * "$Id: login.c,v 1.2 2006/03/16 21:08:20 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 | |
… | |
… | |
367 | new_draw_info(NDI_UNIQUE, 0,op, "Can't save character."); |
367 | new_draw_info(NDI_UNIQUE, 0,op, "Can't save character."); |
368 | unlink(tmpfilename); |
368 | unlink(tmpfilename); |
369 | free(tmpfilename); |
369 | free(tmpfilename); |
370 | return 0; |
370 | return 0; |
371 | } |
371 | } |
|
|
372 | |
372 | checksum = 0; |
373 | checksum = 0; |
373 | sprintf(backupfile, "%s.tmp", filename); |
374 | sprintf(backupfile, "%s.tmp", filename); |
374 | rename(filename, backupfile); |
375 | rename(filename, backupfile); |
375 | fp = fopen(filename,"w"); |
376 | fp = fopen(filename,"w"); |
376 | if(!fp) { |
377 | if(!fp) { |
… | |
… | |
398 | if (wiz) SET_FLAG(op,FLAG_WIZ); |
399 | if (wiz) SET_FLAG(op,FLAG_WIZ); |
399 | if(!flag) |
400 | if(!flag) |
400 | esrv_send_inventory(op, op); |
401 | esrv_send_inventory(op, op); |
401 | |
402 | |
402 | chmod(filename,SAVE_MODE); |
403 | chmod(filename,SAVE_MODE); |
|
|
404 | |
|
|
405 | execute_global_event (EVENT_PLAYER_SAVE, op, filename); |
|
|
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 |