ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.39 by root, Thu Dec 14 14:23:09 2006 UTC vs.
Revision 1.43 by root, Sat Dec 16 03:08:26 2006 UTC

27#include <sounds.h> 27#include <sounds.h>
28#include <living.h> 28#include <living.h>
29#include <object.h> 29#include <object.h>
30#include <spells.h> 30#include <spells.h>
31#include <skills.h> 31#include <skills.h>
32#include <newclient.h>
33 32
34#ifdef COZY_SERVER 33#ifdef COZY_SERVER
35extern int same_party (partylist *a, partylist *b); 34extern int same_party (partylist *a, partylist *b);
36#endif 35#endif
37 36
301 * All we can really get in this is some settings like host and display 300 * All we can really get in this is some settings like host and display
302 * mode. 301 * mode.
303 */ 302 */
304 303
305int 304int
306add_player (client_socket *ns) 305add_player (client *ns)
307{ 306{
308 player *p = new player; 307 player *p = new player;
309 308
310 p->socket = ns; 309 p->socket = ns;
311 ns->pl = p; 310 ns->pl = p;
1879 SET_ANIMATION (arrow, arrow->direction); 1878 SET_ANIMATION (arrow, arrow->direction);
1880 arrow->stats.sp = arrow->stats.wc; /* save original wc and dam */ 1879 arrow->stats.sp = arrow->stats.wc; /* save original wc and dam */
1881 arrow->stats.hp = arrow->stats.dam; 1880 arrow->stats.hp = arrow->stats.dam;
1882 arrow->stats.grace = arrow->attacktype; 1881 arrow->stats.grace = arrow->attacktype;
1883 if (arrow->slaying != NULL) 1882 if (arrow->slaying != NULL)
1884 arrow->spellarg = strdup_local (arrow->slaying); 1883 arrow->spellarg = strdup (arrow->slaying);
1885 1884
1886 /* Note that this was different for monsters - they got their level 1885 /* Note that this was different for monsters - they got their level
1887 * added to the damage. I think the strength bonus is more proper. 1886 * added to the damage. I think the strength bonus is more proper.
1888 */ 1887 */
1889 1888
2545 2544
2546 /* call this here - we also will call this in do_ericserver, but 2545 /* call this here - we also will call this in do_ericserver, but
2547 * the players time has been increased when doericserver has been 2546 * the players time has been increased when doericserver has been
2548 * called, so we recheck it here. 2547 * called, so we recheck it here.
2549 */ 2548 */
2550 HandleClient (op->contr->socket, op->contr); 2549 op->contr->socket->handle_command ();
2551 if (op->speed_left < 0) 2550 if (op->speed_left < 0)
2552 return 0; 2551 return 0;
2553 2552
2554 if (op->direction && (op->contr->run_on || op->contr->fire_on)) 2553 if (op->direction && (op->contr->run_on || op->contr->fire_on))
2555 { 2554 {
2564 if (op->speed_left > 0) 2563 if (op->speed_left > 0)
2565 return 1; 2564 return 1;
2566 else 2565 else
2567 return 0; 2566 return 0;
2568 } 2567 }
2568
2569 return 0; 2569 return 0;
2570} 2570}
2571 2571
2572int 2572int
2573save_life (object *op) 2573save_life (object *op)
2574{ 2574{
2575 object *tmp;
2576
2577 if (!QUERY_FLAG (op, FLAG_LIFESAVE)) 2575 if (!QUERY_FLAG (op, FLAG_LIFESAVE))
2578 return 0; 2576 return 0;
2579 2577
2580 for (tmp = op->inv; tmp != NULL; tmp = tmp->below) 2578 for (object *tmp = op->inv; tmp; tmp = tmp->below)
2581 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) 2579 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE))
2582 { 2580 {
2583 play_sound_map (op->map, op->x, op->y, SOUND_OB_EVAPORATE); 2581 play_sound_map (op->map, op->x, op->y, SOUND_OB_EVAPORATE);
2584 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); 2582 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp));
2585 2583
2596 op->stats.food = 999; 2594 op->stats.food = 999;
2597 2595
2598 fix_player (op); 2596 fix_player (op);
2599 return 1; 2597 return 1;
2600 } 2598 }
2599
2601 LOG (llevError, "Error: LIFESAVE set without applied object.\n"); 2600 LOG (llevError, "Error: LIFESAVE set without applied object.\n");
2602 CLEAR_FLAG (op, FLAG_LIFESAVE); 2601 CLEAR_FLAG (op, FLAG_LIFESAVE);
2603 enter_player_savebed (op); /* bring him home. */ 2602 enter_player_savebed (op); /* bring him home. */
2604 return 0; 2603 return 0;
2605} 2604}
2628 esrv_del_item (env->contr, op->count); 2627 esrv_del_item (env->contr, op->count);
2629 insert_ob_in_map (op, env->map, NULL, 0); 2628 insert_ob_in_map (op, env->map, NULL, 0);
2630 } 2629 }
2631 else if (op->inv) 2630 else if (op->inv)
2632 remove_unpaid_objects (op->inv, env); 2631 remove_unpaid_objects (op->inv, env);
2632
2633 op = next; 2633 op = next;
2634 } 2634 }
2635} 2635}
2636 2636
2637 2637
2652 strcpy (buf2, " R.I.P.\n\n"); 2652 strcpy (buf2, " R.I.P.\n\n");
2653 if (op->type == PLAYER) 2653 if (op->type == PLAYER)
2654 sprintf (buf, "%s the %s\n", &op->name, op->contr->title); 2654 sprintf (buf, "%s the %s\n", &op->name, op->contr->title);
2655 else 2655 else
2656 sprintf (buf, "%s\n", &op->name); 2656 sprintf (buf, "%s\n", &op->name);
2657
2657 strncat (buf2, " ", 20 - strlen (buf) / 2); 2658 strncat (buf2, " ", 20 - strlen (buf) / 2);
2658 strcat (buf2, buf); 2659 strcat (buf2, buf);
2659 if (op->type == PLAYER) 2660 if (op->type == PLAYER)
2660 sprintf (buf, "who was in level %d when killed\n", op->level); 2661 sprintf (buf, "who was in level %d when killed\n", op->level);
2661 else 2662 else
2662 sprintf (buf, "who was in level %d when died.\n\n", op->level); 2663 sprintf (buf, "who was in level %d when died.\n\n", op->level);
2664
2663 strncat (buf2, " ", 20 - strlen (buf) / 2); 2665 strncat (buf2, " ", 20 - strlen (buf) / 2);
2664 strcat (buf2, buf); 2666 strcat (buf2, buf);
2665 if (op->type == PLAYER) 2667 if (op->type == PLAYER)
2666 { 2668 {
2667 sprintf (buf, "by %s.\n\n", op->contr->killer); 2669 sprintf (buf, "by %s.\n\n", op->contr->killer);
2668 strncat (buf2, " ", 21 - strlen (buf) / 2); 2670 strncat (buf2, " ", 21 - strlen (buf) / 2);
2669 strcat (buf2, buf); 2671 strcat (buf2, buf);
2670 } 2672 }
2673
2671 strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now)); 2674 strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now));
2672 strncat (buf2, " ", 20 - strlen (buf) / 2); 2675 strncat (buf2, " ", 20 - strlen (buf) / 2);
2673 strcat (buf2, buf); 2676 strcat (buf2, buf);
2677
2674 return buf2; 2678 return buf2;
2675} 2679}
2676 2680
2677 2681
2678 2682

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines