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.160 by root, Wed Aug 22 20:46:46 2007 UTC vs.
Revision 1.171 by root, Sat Sep 8 07:06:51 2007 UTC

183 183
184 if (ob->map) 184 if (ob->map)
185 maplevel = ob->map->path; 185 maplevel = ob->map->path;
186 186
187 ob->remove (); 187 ob->remove ();
188 ob->enemy = 0; // sometimes keeps an extra refcount on itself
188 ob->map = 0; 189 ob->map = 0;
189 party = 0; 190 party = 0;
190 191
191 combat_ob = ranged_ob = 0; //TODO, should be special marker, non-refcounted, not this 192 combat_ob = ranged_ob = 0; //TODO, should be special marker, non-refcounted, not this
192 193
1963 1964
1964 if (door->type == DOOR) 1965 if (door->type == DOOR)
1965 hit_player (door, 9998, op, AT_PHYSICAL, 1); /* Break through the door */ 1966 hit_player (door, 9998, op, AT_PHYSICAL, 1); /* Break through the door */
1966 else if (door->type == LOCKED_DOOR) 1967 else if (door->type == LOCKED_DOOR)
1967 { 1968 {
1968 new_draw_info_format (NDI_UNIQUE, NDI_BROWN, op, "You open the door with the %s", query_short_name (key)); 1969 op->statusmsg (format ("You open the door with the %s", query_short_name (key)), NDI_BROWN);
1969 remove_door2 (door); /* remove door without violence ;-) */ 1970 remove_door2 (door); /* remove door without violence ;-) */
1970 } 1971 }
1971 1972
1972 /* Do this after we print the message */ 1973 /* Do this after we print the message */
1973 decrease_ob (key); /* Use up one of the keys */ 1974 decrease_ob (key); /* Use up one of the keys */
1978 return 1; /* Nothing more to do below */ 1979 return 1; /* Nothing more to do below */
1979 } 1980 }
1980 else if (door->type == LOCKED_DOOR) 1981 else if (door->type == LOCKED_DOOR)
1981 { 1982 {
1982 /* Might as well return now - no other way to open this */ 1983 /* Might as well return now - no other way to open this */
1983 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, door->msg); 1984 op->failmsg (door->msg ? &door->msg : "Hmm, you miss the certain something to open this door...");
1984 return 1; 1985 return 1;
1985 } 1986 }
1986 1987
1987 return 0; 1988 return 0;
1988} 1989}
2108 { 2109 {
2109 op->play_sound (sound_find ("push_player")); 2110 op->play_sound (sound_find ("push_player"));
2110 push_ob (mon, dir, op); 2111 push_ob (mon, dir, op);
2111 } 2112 }
2112 else 2113 else
2113 new_draw_info (0, 0, op, "You withhold your attack"); 2114 op->statusmsg ("You withhold your attack");
2114 2115
2115 if (op->contr->tmp_invis || op->hide) 2116 if (op->contr->tmp_invis || op->hide)
2116 make_visible (op); 2117 make_visible (op);
2117 2118
2118 return true; 2119 return true;
2417 gen_grace = (op->contr->gen_grace + 1) * op->stats.maxgrace; 2418 gen_grace = (op->contr->gen_grace + 1) * op->stats.maxgrace;
2418 else 2419 else
2419 { 2420 {
2420 gen_grace = op->stats.maxgrace; 2421 gen_grace = op->stats.maxgrace;
2421 rate_grace -= rate_grace / 2 * op->contr->gen_grace; 2422 rate_grace -= rate_grace / 2 * op->contr->gen_grace;
2422 }
2423
2424 /* Regenerate Spell Points */
2425 if (!op->contr->golem && --op->last_sp < 0)
2426 {
2427 gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour);
2428 if (op->stats.sp < op->stats.maxsp)
2429 {
2430 op->stats.sp++;
2431 /* dms do not consume food */
2432 if (!QUERY_FLAG (op, FLAG_WIZ))
2433 {
2434 op->stats.food--;
2435 if (op->contr->digestion < 0)
2436 op->stats.food += op->contr->digestion;
2437 else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH))
2438 op->stats.food = last_food;
2439 }
2440 }
2441
2442 if (max_sp > 1)
2443 {
2444 over_sp = (gen_sp + 10) / rate_sp;
2445 if (over_sp > 0)
2446 {
2447 if (op->stats.sp < op->stats.maxsp)
2448 {
2449 op->stats.sp += over_sp > max_sp ? max_sp : over_sp;
2450
2451 if (random_roll (0, rate_sp - 1, op, PREFER_LOW) > ((gen_sp + 10) % rate_sp))
2452 op->stats.sp--;
2453
2454 if (op->stats.sp > op->stats.maxsp)
2455 op->stats.sp = op->stats.maxsp;
2456 }
2457 op->last_sp = 0;
2458 }
2459 else
2460 op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10);
2461 }
2462 else
2463 op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10);
2464 } 2423 }
2465 2424
2466 /* Regenerate Grace */ 2425 /* Regenerate Grace */
2467 /* I altered this a little - maximum grace is ony achieved through prayer -b.t. */ 2426 /* I altered this a little - maximum grace is ony achieved through prayer -b.t. */
2468 if (--op->last_grace < 0) 2427 if (--op->last_grace < 0)
2489 op->last_grace = rate_grace / (gen_grace < 20 ? 30 : gen_grace + 10); 2448 op->last_grace = rate_grace / (gen_grace < 20 ? 30 : gen_grace + 10);
2490 } 2449 }
2491 /* wearing stuff doesn't detract from grace generation. */ 2450 /* wearing stuff doesn't detract from grace generation. */
2492 } 2451 }
2493 2452
2453 if (op->stats.food > 0)
2454 {
2494 /* Regenerate Hit Points */ 2455 /* Regenerate Spell Points */
2495 if (--op->last_heal < 0) 2456 if (!op->contr->golem && --op->last_sp < 0)
2496 {
2497 if (op->stats.hp < op->stats.maxhp)
2498 { 2457 {
2499 op->stats.hp++; 2458 gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour);
2500 /* dms do not consume food */ 2459
2501 if (!QUERY_FLAG (op, FLAG_WIZ)) 2460 if (op->stats.sp < op->stats.maxsp)
2502 { 2461 {
2462 op->stats.sp++;
2463
2464 /* dms do not consume food */
2465 if (!QUERY_FLAG (op, FLAG_WIZ))
2466 {
2503 op->stats.food--; 2467 op->stats.food--;
2468
2504 if (op->contr->digestion < 0) 2469 if (op->contr->digestion < 0)
2505 op->stats.food += op->contr->digestion; 2470 op->stats.food += op->contr->digestion;
2506 else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH)) 2471 else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH))
2507 op->stats.food = last_food; 2472 op->stats.food = last_food;
2473 }
2508 } 2474 }
2509 }
2510 2475
2511 if (max_hp > 1) 2476 if (max_sp > 1)
2512 {
2513 over_hp = (gen_hp < 20 ? 30 : gen_hp + 10) / rate_hp;
2514 if (over_hp > 0)
2515 { 2477 {
2516 op->stats.sp += over_hp + (RANDOM () % rate_hp > ((gen_hp < 20 ? 30 : gen_hp + 10) % rate_hp)) ? -1 : 0; 2478 over_sp = (gen_sp + 10) / rate_sp;
2479 if (over_sp > 0)
2480 {
2481 if (op->stats.sp < op->stats.maxsp)
2482 {
2483 op->stats.sp += over_sp > max_sp ? max_sp : over_sp;
2484
2485 if (random_roll (0, rate_sp - 1, op, PREFER_LOW) > ((gen_sp + 10) % rate_sp))
2486 op->stats.sp--;
2487
2488 if (op->stats.sp > op->stats.maxsp)
2489 op->stats.sp = op->stats.maxsp;
2490 }
2491
2517 op->last_heal = 0; 2492 op->last_sp = 0;
2493 }
2494 else
2495 op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10);
2518 } 2496 }
2519 else 2497 else
2498 op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10);
2499 }
2500
2501 /* Regenerate Hit Points */
2502 if (--op->last_heal < 0)
2503 {
2504 if (op->stats.hp < op->stats.maxhp)
2520 { 2505 {
2521 op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); 2506 op->stats.hp++;
2507
2508 /* dms do not consume food */
2509 if (!QUERY_FLAG (op, FLAG_WIZ))
2510 {
2511 op->stats.food--;
2512
2513 if (op->contr->digestion < 0)
2514 op->stats.food += op->contr->digestion;
2515 else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH))
2516 op->stats.food = last_food;
2517 }
2522 } 2518 }
2519
2520 if (max_hp > 1)
2521 {
2522 over_hp = (gen_hp < 20 ? 30 : gen_hp + 10) / rate_hp;
2523
2524 if (over_hp > 0)
2525 {
2526 op->stats.sp += over_hp + (RANDOM () % rate_hp > ((gen_hp < 20 ? 30 : gen_hp + 10) % rate_hp)) ? -1 : 0;
2527 op->last_heal = 0;
2528 }
2529 else
2530 op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10);
2523 } 2531 }
2524 else 2532 else
2525 {
2526 op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10); 2533 op->last_heal = rate_hp / (gen_hp < 20 ? 30 : gen_hp + 10);
2527 } 2534 }
2528 } 2535 }
2529 2536
2530 /* Digestion */ 2537 /* Digestion */
2531 if (--op->last_eat < 0) 2538 if (--op->last_eat < 0)
2568 new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food."); 2575 new_draw_info (NDI_UNIQUE, 0, op, "You blindly grab for a bite of food.");
2569 manual_apply (op, flesh, 0); 2576 manual_apply (op, flesh, 0);
2570 } 2577 }
2571 } 2578 }
2572 2579
2573 while (op->stats.food < 0 && op->stats.hp >= 0) 2580 if (op->stats.food < 0)
2574 op->stats.food++, op->stats.hp--; 2581 {
2582 op->stats.hp += op->stats.food;
2583 op->stats.food = 0;
2584 }
2575 2585
2576 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) 2586 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ))
2577 kill_player (op); 2587 kill_player (op);
2578 } 2588 }
2579} 2589}
2584 * file. 2594 * file.
2585 */ 2595 */
2586void 2596void
2587kill_player (object *op) 2597kill_player (object *op)
2588{ 2598{
2599 int x, y;
2589 char buf[MAX_BUF]; 2600 char buf[MAX_BUF];
2590 int x, y;
2591
2592 //int i;
2593 maptile *map; /* this is for resurrection */ 2601 maptile *map; /* this is for resurrection */
2594
2595 /* int z;
2596 int num_stats_lose;
2597 int lost_a_stat;
2598 int lose_this_stat;
2599 int this_stat; */
2600 int will_kill_again; 2602 int will_kill_again;
2601 archetype *at; 2603 archetype *at;
2602 object *tmp; 2604 object *tmp;
2603 2605
2604 if (save_life (op)) 2606 if (save_life (op))
2626 { 2628 {
2627 tmp->destroy (); 2629 tmp->destroy ();
2628 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2630 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2629 } 2631 }
2630 2632
2631 cure_disease (op, 0); /* remove any disease */ 2633 cure_disease (op, 0, 0); /* remove any disease */
2632 op->stats.hp = op->stats.maxhp; 2634 op->stats.hp = op->stats.maxhp;
2633 if (op->stats.food <= 0) 2635 if (op->stats.food <= 0)
2634 op->stats.food = 999; 2636 op->stats.food = 999;
2635 2637
2636 /* create a bodypart-trophy to make the winner happy */ 2638 /* create a bodypart-trophy to make the winner happy */
2637 if (object *tmp = arch_to_object (archetype::find ("finger"))) 2639 if (object *tmp = arch_to_object (archetype::find ("finger")))
2638 { 2640 {
2639 sprintf (buf, "%s's finger", &op->name); 2641 tmp->name = format ("%s's finger" , &op->name);
2640 tmp->name = buf; 2642 tmp->name_pl = format ("%s's fingers", &op->name);
2641 sprintf (buf, " This finger has been cut off %s\n" 2643 tmp->msg = format (
2642 " the %s, when he was defeated at\n level %d by %s.\n", 2644 "This finger has been cut off of %s the %s, when he was defeated at level %d by %s.\n",
2643 &op->name, op->contr->title, (int) (op->level), op->contr->killer); 2645 &op->name, op->contr->title, (int) (op->level), op->contr->killer
2644 tmp->msg = buf; 2646 );
2645 tmp->value = 0, tmp->type = 0; 2647 tmp->value = 0, tmp->type = 0;
2646 tmp->materialname = "organics"; 2648 tmp->materialname = "organics";
2647 tmp->insert_at (op, tmp); 2649 tmp->insert_at (op, tmp);
2648 } 2650 }
2649 2651
2656 INVOKE_PLAYER (DEATH, op->contr); 2658 INVOKE_PLAYER (DEATH, op->contr);
2657 2659
2658 command_kill_pets (op, 0); 2660 command_kill_pets (op, 0);
2659 2661
2660 if (op->stats.food < 0) 2662 if (op->stats.food < 0)
2661 {
2662 sprintf (buf, "%s starved to death.", &op->name);
2663 strcpy (op->contr->killer, "starvation"); 2663 strcpy (op->contr->killer, "starvation");
2664 }
2665 else
2666 sprintf (buf, "%s died.", &op->name);
2667 2664
2668 op->contr->play_sound (sound_find ("player_dies")); 2665 op->contr->play_sound (sound_find ("player_dies"));
2669 2666
2670 /* save the map location for corpse, gravestone */ 2667 /* save the map location for corpse, gravestone */
2671 x = op->x; 2668 x = op->x;
2836 { 2833 {
2837 tmp->destroy (); 2834 tmp->destroy ();
2838 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2835 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2839 } 2836 }
2840 2837
2841 cure_disease (op, 0); /* remove any disease */ 2838 cure_disease (op, 0, 0); /* remove any disease */
2842 2839
2843 /*add_exp(op, (op->stats.exp * -0.20)); */ 2840 /*add_exp(op, (op->stats.exp * -0.20)); */
2844 apply_death_exp_penalty (op); 2841 apply_death_exp_penalty (op);
2845 if (op->stats.food < 100) 2842 if (op->stats.food < 100)
2846 op->stats.food = 900; 2843 op->stats.food = 900;
3000void 2997void
3001make_visible (object *op) 2998make_visible (object *op)
3002{ 2999{
3003 op->hide = 0; 3000 op->hide = 0;
3004 op->invisible = 0; 3001 op->invisible = 0;
3002
3005 if (op->type == PLAYER) 3003 if (op->type == PLAYER)
3006 { 3004 {
3007 op->contr->tmp_invis = 0; 3005 op->contr->tmp_invis = 0;
3008 op->contr->invis_race = 0; 3006 op->contr->invis_race = 0;
3009 } 3007 }
3022 3020
3023/* look at the surrounding terrain to determine 3021/* look at the surrounding terrain to determine
3024 * the hideability of this object. Positive levels 3022 * the hideability of this object. Positive levels
3025 * indicate greater hideability. 3023 * indicate greater hideability.
3026 */ 3024 */
3027
3028int 3025int
3029hideability (object *ob) 3026hideability (object *ob)
3030{ 3027{
3031 int i, level = 0, mflag; 3028 int i, level = 0, mflag;
3032 sint16 x, y; 3029 sint16 x, y;
3157 * object op. This function works fine for monsters, 3154 * object op. This function works fine for monsters,
3158 * but we dont worry if the object isnt the top one in 3155 * but we dont worry if the object isnt the top one in
3159 * a pile (say a coin under a table would return "viewable" 3156 * a pile (say a coin under a table would return "viewable"
3160 * by this routine). Another question, should we be 3157 * by this routine). Another question, should we be
3161 * concerned with the direction the player is looking 3158 * concerned with the direction the player is looking
3162 * in? Realistically, most of use cant see stuff behind 3159 * in? Realistically, most of us can't see stuff behind
3163 * our backs...on the other hand, does the "facing" direction 3160 * our backs...on the other hand, does the "facing" direction
3164 * imply the way your head, or body is facing? Its possible 3161 * imply the way your head, or body is facing? It's possible
3165 * for them to differ. Sigh, this fctn could get a bit more complex. 3162 * for them to differ. Sigh, this fctn could get a bit more complex.
3166 * -b.t. 3163 * -b.t.
3167 * This function is now map tiling safe. 3164 * This function is now map tiling safe.
3168 */ 3165 */
3169
3170int 3166int
3171player_can_view (object *pl, object *op) 3167player_can_view (object *pl, object *op)
3172{ 3168{
3173 rv_vector rv; 3169 rv_vector rv;
3174 int dx, dy; 3170 int dx, dy;
3186 3182
3187 get_rangevector (pl, op, &rv, 0x1); 3183 get_rangevector (pl, op, &rv, 0x1);
3188 3184
3189 /* starting with the 'head' part, lets loop 3185 /* starting with the 'head' part, lets loop
3190 * through the object and find if it has any 3186 * through the object and find if it has any
3191 * part that is in the los array but isnt on 3187 * part that is in the los array but isn't on
3192 * a blocked los square. 3188 * a blocked los square.
3193 * we use the archetype to figure out offsets. 3189 * we use the archetype to figure out offsets.
3194 */ 3190 */
3195 while (op) 3191 while (op)
3196 { 3192 {
3199 3195
3200 /* only the viewable area the player sees is updated by LOS 3196 /* only the viewable area the player sees is updated by LOS
3201 * code, so we need to restrict ourselves to that range of values 3197 * code, so we need to restrict ourselves to that range of values
3202 * for any meaningful values. 3198 * for any meaningful values.
3203 */ 3199 */
3204 if (FABS (dx) <= (pl->contr->ns->mapx / 2) && 3200 if (abs (dx) <= (pl->contr->ns->mapx / 2) &&
3205 FABS (dy) <= (pl->contr->ns->mapy / 2) && 3201 abs (dy) <= (pl->contr->ns->mapy / 2) &&
3206 !pl->contr->blocked_los[dx + (pl->contr->ns->mapx / 2)][dy + (pl->contr->ns->mapy / 2)]) 3202 !pl->contr->blocked_los[dx + (pl->contr->ns->mapx / 2)][dy + (pl->contr->ns->mapy / 2)])
3207 return 1; 3203 return 1;
3204
3208 op = op->more; 3205 op = op->more;
3209 } 3206 }
3207
3210 return 0; 3208 return 0;
3211} 3209}
3212 3210
3213/* routine for both players and monsters. We call this when 3211/* routine for both players and monsters. We call this when
3214 * there is a possibility for our action distrubing our hiding 3212 * there is a possibility for our action distrubing our hiding
3217 * return 0. 3215 * return 0.
3218 */ 3216 */
3219int 3217int
3220action_makes_visible (object *op) 3218action_makes_visible (object *op)
3221{ 3219{
3222
3223 if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE)) 3220 if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE))
3224 { 3221 {
3225 if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) 3222 if (QUERY_FLAG (op, FLAG_MAKE_INVIS))
3226 return 0; 3223 return 0;
3227 3224
3233 { 3230 {
3234 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible"); 3231 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible");
3235 return 1; 3232 return 1;
3236 } 3233 }
3237 } 3234 }
3235
3238 return 0; 3236 return 0;
3239} 3237}
3240 3238
3241/* op_on_battleground - checks if the given object op (usually 3239/* op_on_battleground - checks if the given object op (usually
3242 * a player) is standing on a valid battleground-tile, 3240 * a player) is standing on a valid battleground-tile,
3247 * Default is to do the same as before, so only people wanting to have different points need worry about this 3245 * Default is to do the same as before, so only people wanting to have different points need worry about this
3248 */ 3246 */
3249int 3247int
3250op_on_battleground (object *op, int *x, int *y) 3248op_on_battleground (object *op, int *x, int *y)
3251{ 3249{
3252 object *tmp;
3253
3254 /* A battleground-tile needs the following attributes to be valid: 3250 /* A battleground-tile needs the following attributes to be valid:
3255 * is_floor 1 (has to be the FIRST floor beneath the player's feet), 3251 * is_floor 1 (has to be the FIRST floor beneath the player's feet),
3256 * name="battleground", no_pick 1, type=58 (type BATTLEGROUND) 3252 * name="battleground", no_pick 1, type=58 (type BATTLEGROUND)
3257 * and the exit-coordinates sp/hp must both be > 0. 3253 * and the exit-coordinates sp/hp must both be > 0.
3258 * => The intention here is to prevent abuse of the battleground- 3254 * => The intention here is to prevent abuse of the battleground-
3259 * feature (like pickable or hidden battleground tiles). */ 3255 * feature (like pickable or hidden battleground tiles). */
3260 for (tmp = op->below; tmp != NULL; tmp = tmp->below) 3256 for (object *tmp = op->below; tmp; tmp = tmp->below)
3261 { 3257 {
3262 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) 3258 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR))
3263 { 3259 {
3264 if (QUERY_FLAG (tmp, FLAG_NO_PICK) && 3260 if (QUERY_FLAG (tmp, FLAG_NO_PICK)
3265 strcmp (tmp->name, "battleground") == 0 && tmp->type == BATTLEGROUND && EXIT_X (tmp) && EXIT_Y (tmp)) 3261 && tmp->type == BATTLEGROUND
3262 && tmp->name == shstr_battleground
3263 && EXIT_X (tmp) && EXIT_Y (tmp))
3266 { 3264 {
3267 /*before we assign the exit, check if this is a teambattle */ 3265 /* before we assign the exit, check if this is a teambattle */
3268 if (EXIT_ALT_X (tmp) && EXIT_ALT_Y (tmp) && EXIT_PATH (tmp)) 3266 if (EXIT_ALT_X (tmp) && EXIT_ALT_Y (tmp) && EXIT_PATH (tmp))
3269 { 3267 {
3270 object *invtmp;
3271
3272 for (invtmp = op->inv; invtmp != NULL; invtmp = invtmp->below) 3268 for (object *invtmp = op->inv; invtmp; invtmp = invtmp->below)
3273 { 3269 {
3274 if (invtmp->type == FORCE && invtmp->slaying && !strcmp (EXIT_PATH (tmp), invtmp->slaying)) 3270 if (invtmp->type == FORCE && invtmp->slaying && tmp->slaying == invtmp->slaying)
3275 { 3271 {
3276 if (x != NULL && y != NULL) 3272 if (x && y)
3277 *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp); 3273 *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp);
3274
3278 return 1; 3275 return 1;
3279 } 3276 }
3280 } 3277 }
3281 } 3278 }
3279
3282 if (x != NULL && y != NULL) 3280 if (x && y)
3283 *x = EXIT_X (tmp), *y = EXIT_Y (tmp); 3281 *x = EXIT_X (tmp), *y = EXIT_Y (tmp);
3282
3284 return 1; 3283 return 1;
3285 } 3284 }
3286 } 3285 }
3287 } 3286 }
3287
3288 /* If we got here, did not find a battleground */ 3288 /* If we got here, did not find a battleground */
3289 return 0; 3289 return 0;
3290} 3290}
3291 3291
3292/* 3292/*
3308 char buf[MAX_BUF]; /* tmp. string buffer */ 3308 char buf[MAX_BUF]; /* tmp. string buffer */
3309 int i = 0, j = 0; 3309 int i = 0, j = 0;
3310 3310
3311 /* get the appropriate treasurelist */ 3311 /* get the appropriate treasurelist */
3312 if (atnr == ATNR_FIRE) 3312 if (atnr == ATNR_FIRE)
3313 trlist = treasurelist::find ("dragon_ability_fire"); 3313 trlist = treasurelist::find (shstr_dragon_ability_fire);
3314 else if (atnr == ATNR_COLD) 3314 else if (atnr == ATNR_COLD)
3315 trlist = treasurelist::find ("dragon_ability_cold"); 3315 trlist = treasurelist::find (shstr_dragon_ability_cold);
3316 else if (atnr == ATNR_ELECTRICITY) 3316 else if (atnr == ATNR_ELECTRICITY)
3317 trlist = treasurelist::find ("dragon_ability_elec"); 3317 trlist = treasurelist::find (shstr_dragon_ability_elec);
3318 else if (atnr == ATNR_POISON) 3318 else if (atnr == ATNR_POISON)
3319 trlist = treasurelist::find ("dragon_ability_poison"); 3319 trlist = treasurelist::find (shstr_dragon_ability_poison);
3320 3320
3321 if (trlist == NULL || who->type != PLAYER) 3321 if (trlist == NULL || who->type != PLAYER)
3322 return; 3322 return;
3323 3323
3324 for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++); 3324 for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++);
3483 if (!IN_RANGE_EXC (x, 0, ns->mapx) || !IN_RANGE_EXC (y, 0, ns->mapy)) 3483 if (!IN_RANGE_EXC (x, 0, ns->mapx) || !IN_RANGE_EXC (y, 0, ns->mapy))
3484 return 0; 3484 return 0;
3485 3485
3486 return 100 - blocked_los [x][y]; 3486 return 100 - blocked_los [x][y];
3487} 3487}
3488
3489void
3490player::infobox (const char *title, const char *msg, int color)
3491{
3492 send_msg (color | NDI_DEF | NDI_REPLY | NDI_CLEAR, title, msg);
3493}
3494
3495void
3496player::statusmsg (const char *msg, int color)
3497{
3498 send_msg (color | NDI_REPLY, INFO_CHANNEL, msg);
3499}
3500
3501void
3502player::failmsg (const char *msg, int color)
3503{
3504 play_sound (sound_find ("generic_failure"));
3505 statusmsg (msg, color);
3506}
3507

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines