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.196 by root, Mon May 5 15:54:39 2008 UTC vs.
Revision 1.202 by root, Fri Aug 29 02:07:09 2008 UTC

122 continue; 122 continue;
123 123
124 if (*buf == '%') 124 if (*buf == '%')
125 { /* send one news */ 125 { /* send one news */
126 if (size > 0) 126 if (size > 0)
127 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s", (char *)"%s\n%s", subject, news); /*send previously read news */ 127 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op,
128 MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS,
129 "INFORMATION: %s\n%s", (char *)"%s\n%s",
130 subject, news); /*send previously read news */
128 131
129 strcpy (subject, buf + 1); 132 strcpy (subject, buf + 1);
130 strip_endline (subject); 133 strip_endline (subject);
131 size = 0; 134 size = 0;
132 news[0] = '\0'; 135 news[0] = '\0';
321 combat_ob = op; 324 combat_ob = op;
322 break; 325 break;
323 } 326 }
324 327
325 ob->change_weapon (combat_ob ? combat_ob : ranged_ob); 328 ob->change_weapon (combat_ob ? combat_ob : ranged_ob);
326 ob->deactivate (); // change_Weapon activates, fix this better 329 ob->deactivate (); // change_weapon activates, fix this better
327} 330}
328 331
329void 332void
330player::set_observe (object *op) 333player::set_observe (object *op)
331{ 334{
345 savebed_map = first_map_path; /* Init. respawn position */ 348 savebed_map = first_map_path; /* Init. respawn position */
346 349
347 gen_sp_armour = 10; 350 gen_sp_armour = 10;
348 bowtype = bow_normal; 351 bowtype = bow_normal;
349 petmode = pet_normal; 352 petmode = pet_normal;
350 listening = 10;
351 usekeys = containers; 353 usekeys = containers;
352 peaceful = 1; /* default peaceful */ 354 peaceful = 1; /* default peaceful */
353 do_los = 1; 355 do_los = 1;
354 356
355 weapon_sp = 1.0f; 357 weapon_sp = 1.0f;
865 ob->contr->ns->state = ST_PLAYING; 867 ob->contr->ns->state = ST_PLAYING;
866 868
867 if (ob->msg) 869 if (ob->msg)
868 ob->msg = 0; 870 ob->msg = 0;
869 871
870 /* We create this now because some of the unique maps will need it
871 * to save here.
872 */
873 {
874 char buf[MAX_BUF];
875 sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &ob->name);
876 make_path_to_file (buf);
877 }
878
879 start_info (ob); 872 start_info (ob);
880 CLEAR_FLAG (ob, FLAG_WIZ); 873 CLEAR_FLAG (ob, FLAG_WIZ);
881 give_initial_items (ob, ob->randomitems); 874 give_initial_items (ob, ob->randomitems);
882 link_player_skills (ob); 875 link_player_skills (ob);
883 esrv_send_inventory (ob, ob); 876 esrv_send_inventory (ob, ob);
885 878
886 /* This moves the player to a different start map, if there 879 /* This moves the player to a different start map, if there
887 * is one for this race 880 * is one for this race
888 */ 881 */
889 if (*first_map_ext_path) 882 if (*first_map_ext_path)
890 { 883 ob->player_goto (format ("%s/%s", &first_map_ext_path, &ob->arch->archname), ob->x, ob->y);
891 object *tmp;
892 char mapname[MAX_BUF];
893
894 snprintf (mapname, MAX_BUF - 1, "%s/%s", &first_map_ext_path, &ob->arch->archname);
895 tmp = object::create ();
896 EXIT_PATH (tmp) = mapname;
897 EXIT_X (tmp) = ob->x;
898 EXIT_Y (tmp) = ob->y;
899 ob->enter_exit (tmp); /* we don't really care if it succeeded;
900 * if the map isn't there, then stay on the
901 * default initial map */
902 tmp->destroy ();
903 }
904 else 884 else
905 LOG (llevDebug, "first_map_ext_path not set\n"); 885 LOG (llevDebug, "first_map_ext_path not set\n");
906} 886}
907 887
908void 888void
1327 if (op->contr->mode & PU_RATIO) 1307 if (op->contr->mode & PU_RATIO)
1328 { 1308 {
1329 /* use value density to decide what else to grab */ 1309 /* use value density to decide what else to grab */
1330 /* >=7 was >= op->contr->mode */ 1310 /* >=7 was >= op->contr->mode */
1331 /* >=7 is the old standard setting. Now we take the last 4 bits 1311 /* >=7 is the old standard setting. Now we take the last 4 bits
1332 * and multiply them by 5, giving 0..15*5== 5..75 */ 1312 */
1333 wvratio = (op->contr->mode & PU_RATIO) * 5; 1313 wvratio = op->contr->mode & PU_RATIO;
1334 if ((query_cost (tmp, op, F_TRUE) * 100 / (tmp->weight * MAX (tmp->nrof, 1))) >= (unsigned int) wvratio) 1314 if (1000 * query_cost (tmp, op, F_TRUE) / tmp->total_weight () >= wvratio * 100)
1335 { 1315 {
1336 CHK_PICK_PICKUP; 1316 CHK_PICK_PICKUP;
1337#if 0 1317#if 0
1338 fprintf (stderr, "HIGH WEIGHT/VALUE ["); 1318 fprintf (stderr, "HIGH WEIGHT/VALUE [");
1339 if (tmp->name != NULL) 1319 if (tmp->name != NULL)
2585 2565
2586 if (op->stats.food < 0) 2566 if (op->stats.food < 0)
2587 { 2567 {
2588 op->stats.hp += op->stats.food; 2568 op->stats.hp += op->stats.food;
2589 op->stats.food = 0; 2569 op->stats.food = 0;
2570
2571 if (op->stats.hp < 0)
2572 {
2573 op->contr->killer = archetype::get ("killer_starvation");
2574 op->contr->killer->destroy ();
2590 } 2575 }
2576 }
2591 2577
2578 /* killer should be set here already */
2592 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) 2579 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ))
2593 kill_player (op); 2580 kill_player (op);
2594 } 2581 }
2595} 2582}
2596 2583
2664 } 2651 }
2665 2652
2666 INVOKE_PLAYER (DEATH, op->contr); 2653 INVOKE_PLAYER (DEATH, op->contr);
2667 2654
2668 command_kill_pets (op, 0); 2655 command_kill_pets (op, 0);
2669
2670 if (op->stats.food < 0)
2671 {
2672 op->contr->killer = archetype::get ("killer_starvation");
2673 op->contr->killer->destroy ();
2674 }
2675 2656
2676 op->contr->play_sound (sound_find ("player_dies")); 2657 op->contr->play_sound (sound_find ("player_dies"));
2677 2658
2678 /* save the map location for corpse, gravestone */ 2659 /* save the map location for corpse, gravestone */
2679 x = op->x; 2660 x = op->x;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines