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.191 by elmex, Thu Apr 24 10:42:22 2008 UTC vs.
Revision 1.192 by root, Wed Apr 30 06:40:28 2008 UTC

1405 } 1405 }
1406 } 1406 }
1407 else if (arrow->type == ARROW && arrow->race == type) 1407 else if (arrow->type == ARROW && arrow->race == type)
1408 { 1408 {
1409 /* allways prefer assasination/slaying */ 1409 /* allways prefer assasination/slaying */
1410 if (target->race != NULL && arrow->slaying != NULL && strstr (arrow->slaying, target->race)) 1410 if (target->race && arrow->slaying && strstr (arrow->slaying, target->race))
1411 { 1411 {
1412 if (arrow->attacktype & AT_DEATH) 1412 if (arrow->attacktype & AT_DEATH)
1413 { 1413 {
1414 *better = 100; 1414 *better = 100;
1415 return arrow; 1415 return arrow;
2326 * Moved from apply.c to player.c - player.c is what 2326 * Moved from apply.c to player.c - player.c is what
2327 * actually uses this function. player.c may not be quite the 2327 * actually uses this function. player.c may not be quite the
2328 * best, a misc file for object actions is probably better, 2328 * best, a misc file for object actions is probably better,
2329 * but there isn't one in the server directory. 2329 * but there isn't one in the server directory.
2330 */ 2330 */
2331char * 2331const char *
2332gravestone_text (object *op) 2332gravestone_text (object *op)
2333{ 2333{
2334 static char buf2[MAX_BUF]; 2334 static dynbuf_text buf;
2335 char buf[MAX_BUF];
2336 time_t now = time (NULL);
2337 2335
2338 strcpy (buf2, " R.I.P.\n\n"); 2336 buf << "---- R.I.P. ----\n\n";
2337 op->name;
2338
2339 if (op->type == PLAYER) 2339 if (op->type == PLAYER)
2340 sprintf (buf, "%s the %s\n", &op->name, op->contr->title); 2340 buf << " the " << op->contr->title;
2341 else
2342 sprintf (buf, "%s\n", &op->name);
2343 2341
2344 strncat (buf2, " ", 20 - strlen (buf) / 2); 2342 buf << "\n\n";
2345 strcat (buf2, buf); 2343
2344 buf << "who was level ";
2345 buf << (sint32)op->level << "\n\n" // OO breakdown
2346 << " when " << (op->contr ? "killed" : "died") << "\n\n";
2347
2346 if (op->type == PLAYER) 2348 if (op->type == PLAYER)
2347 sprintf (buf, "who was in level %d when killed\n", op->level); 2349 buf << "by " << op->contr->killer_name () << ".\n\n";
2348 else
2349 sprintf (buf, "who was in level %d when died.\n\n", op->level);
2350 2350
2351 strncat (buf2, " ", 20 - strlen (buf) / 2);
2352 strcat (buf2, buf);
2353 if (op->type == PLAYER)
2354 { 2351 {
2355 sprintf (buf, "by %s.\n\n", op->contr->killer); 2352 static char buf2[128];
2356 strncat (buf2, " ", 21 - strlen (buf) / 2); 2353 time_t now = time (NULL);
2357 strcat (buf2, buf);
2358 }
2359
2360 strftime (buf, MAX_BUF, "%b %d %Y\n", localtime (&now)); 2354 strftime (buf2, 128, "%b %d %Y\n\n", localtime (&now));
2361 strncat (buf2, " ", 20 - strlen (buf) / 2); 2355 buf << buf2;
2362 strcat (buf2, buf); 2356 }
2363 2357
2364 return buf2; 2358 return buf;
2365} 2359}
2366 2360
2367void 2361void
2368do_some_living (object *op) 2362do_some_living (object *op)
2369{ 2363{
2643 { 2637 {
2644 tmp->name = format ("%s's finger" , &op->name); 2638 tmp->name = format ("%s's finger" , &op->name);
2645 tmp->name_pl = format ("%s's fingers", &op->name); 2639 tmp->name_pl = format ("%s's fingers", &op->name);
2646 tmp->msg = format ( 2640 tmp->msg = format (
2647 "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n", 2641 "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n",
2648 &op->name, op->contr->title, (int) (op->level), op->contr->killer 2642 &op->name, op->contr->title,
2643 (int)op->level,
2644 op->contr->killer_name ()
2649 ); 2645 );
2650 tmp->value = 0, tmp->type = 0; 2646 tmp->value = 0, tmp->type = 0;
2651 tmp->materialname = "organics"; 2647 tmp->materialname = "organics";
2652 tmp->insert_at (op, tmp); 2648 tmp->insert_at (op, tmp);
2653 } 2649 }
2661 INVOKE_PLAYER (DEATH, op->contr); 2657 INVOKE_PLAYER (DEATH, op->contr);
2662 2658
2663 command_kill_pets (op, 0); 2659 command_kill_pets (op, 0);
2664 2660
2665 if (op->stats.food < 0) 2661 if (op->stats.food < 0)
2666 strcpy (op->contr->killer, "starvation"); 2662 {
2663 op->contr->killer = archetype::get ("killer_starvation");
2664 op->contr->killer->destroy ();
2665 }
2667 2666
2668 op->contr->play_sound (sound_find ("player_dies")); 2667 op->contr->play_sound (sound_find ("player_dies"));
2669 2668
2670 /* save the map location for corpse, gravestone */ 2669 /* save the map location for corpse, gravestone */
2671 x = op->x; 2670 x = op->x;
2804 tmp = arch_to_object (archetype::find ("gravestone")); 2803 tmp = arch_to_object (archetype::find ("gravestone"));
2805 sprintf (buf, "%s's gravestone", &op->name); 2804 sprintf (buf, "%s's gravestone", &op->name);
2806 tmp->name = buf; 2805 tmp->name = buf;
2807 sprintf (buf, "%s's gravestones", &op->name); 2806 sprintf (buf, "%s's gravestones", &op->name);
2808 tmp->name_pl = buf; 2807 tmp->name_pl = buf;
2809 sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer); 2808 sprintf (buf, "RIP\nHere rests the hero %s the %s,\n" "who was killed\n" "by %s.\n", &op->name, op->contr->title, op->contr->killer_name ());
2810 tmp->msg = buf; 2809 tmp->msg = buf;
2811 tmp->x = op->x, tmp->y = op->y; 2810 tmp->x = op->x, tmp->y = op->y;
2812 insert_ob_in_map (tmp, op->map, NULL, 0); 2811 insert_ob_in_map (tmp, op->map, NULL, 0);
2813 2812
2814 /**************************************/ 2813 /**************************************/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines