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.158 by root, Mon Aug 13 15:46:45 2007 UTC vs.
Revision 1.168 by root, Sat Sep 1 03:56:34 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
284} 285}
285 286
286void 287void
287player::disconnect () 288player::disconnect ()
288{ 289{
290 if (ob)
291 {
292 ob->close_container (); //TODO: client-specific
293 ob->drop_unpaid_items ();
294 }
295
289 if (ns) 296 if (ns)
290 { 297 {
291 if (active) 298 if (active)
292 INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); 299 INVOKE_PLAYER (LOGOUT, this, ARG_INT (0));
293 300
294 INVOKE_PLAYER (DISCONNECT, this); 301 INVOKE_PLAYER (DISCONNECT, this);
295 302
296 ns->reset_stats (); 303 ns->reset_stats ();
297 ns->pl = 0; 304 ns->pl = 0;
298 ns = 0; 305 ns = 0;
299 }
300
301 if (ob)
302 {
303 ob->close_container (); //TODO: client-specific
304 ob->drop_unpaid_items ();
305 } 306 }
306 307
307 observe = ob; 308 observe = ob;
308 309
309 deactivate (); 310 deactivate ();
425 unsigned lastdist; 426 unsigned lastdist;
426 rv_vector rv; 427 rv_vector rv;
427 428
428 for (ol = first_friendly_object, lastdist = 1000; ol; ol = ol->next) 429 for (ol = first_friendly_object, lastdist = 1000; ol; ol = ol->next)
429 { 430 {
430 /* We should not find free objects on this friendly list, but it
431 * does periodically happen. Given that, lets deal with it.
432 * While unlikely, it is possible the next object on the friendly
433 * list is also free, so encapsulate this in a while loop.
434 */
435 while (QUERY_FLAG (ol->ob, FLAG_FREED) || !QUERY_FLAG (ol->ob, FLAG_FRIENDLY))
436 {
437 object *tmp = ol->ob;
438
439 /* Can't do much more other than log the fact, because the object
440 * itself will have been cleared.
441 */
442 LOG (llevDebug, "get_nearest_player: Found free/non friendly object '%s' on friendly list\n",
443 tmp->debug_desc ());
444 ol = ol->next;
445 remove_friendly_object (tmp);
446 if (!ol)
447 return op;
448 }
449
450 /* Remove special check for player from this. First, it looks to cause
451 * some crashes (ol->ob->contr not set properly?), but secondly, a more
452 * complicated method of state checking would be needed in any case -
453 * as it was, a clever player could type quit, and the function would
454 * skip them over while waiting for confirmation. Remove
455 * on_same_map check, as can_detect_enemy also does this
456 */
457 if (!can_detect_enemy (mon, ol->ob, &rv)) 431 if (!can_detect_enemy (mon, ol->ob, &rv))
458 continue; 432 continue;
459 433
460 if (lastdist > rv.distance) 434 if (lastdist > rv.distance)
461 { 435 {
2446 { 2420 {
2447 gen_grace = op->stats.maxgrace; 2421 gen_grace = op->stats.maxgrace;
2448 rate_grace -= rate_grace / 2 * op->contr->gen_grace; 2422 rate_grace -= rate_grace / 2 * op->contr->gen_grace;
2449 } 2423 }
2450 2424
2451 /* Regenerate Spell Points */
2452 if (!op->contr->golem && --op->last_sp < 0)
2453 {
2454 gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour);
2455 if (op->stats.sp < op->stats.maxsp)
2456 {
2457 op->stats.sp++;
2458 /* dms do not consume food */
2459 if (!QUERY_FLAG (op, FLAG_WIZ))
2460 {
2461 op->stats.food--;
2462 if (op->contr->digestion < 0)
2463 op->stats.food += op->contr->digestion;
2464 else if (op->contr->digestion > 0 && random_roll (0, op->contr->digestion, op, PREFER_HIGH))
2465 op->stats.food = last_food;
2466 }
2467 }
2468
2469 if (max_sp > 1)
2470 {
2471 over_sp = (gen_sp + 10) / rate_sp;
2472 if (over_sp > 0)
2473 {
2474 if (op->stats.sp < op->stats.maxsp)
2475 {
2476 op->stats.sp += over_sp > max_sp ? max_sp : over_sp;
2477
2478 if (random_roll (0, rate_sp - 1, op, PREFER_LOW) > ((gen_sp + 10) % rate_sp))
2479 op->stats.sp--;
2480
2481 if (op->stats.sp > op->stats.maxsp)
2482 op->stats.sp = op->stats.maxsp;
2483 }
2484 op->last_sp = 0;
2485 }
2486 else
2487 op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10);
2488 }
2489 else
2490 op->last_sp = rate_sp / (gen_sp < 20 ? 30 : gen_sp + 10);
2491 }
2492
2493 /* Regenerate Grace */ 2425 /* Regenerate Grace */
2494 /* 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. */
2495 if (--op->last_grace < 0) 2427 if (--op->last_grace < 0)
2496 { 2428 {
2497 if (op->stats.grace < op->stats.maxgrace / 2) 2429 if (op->stats.grace < op->stats.maxgrace / 2)
2516 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);
2517 } 2449 }
2518 /* wearing stuff doesn't detract from grace generation. */ 2450 /* wearing stuff doesn't detract from grace generation. */
2519 } 2451 }
2520 2452
2453 if (op->stats.food > 0)
2454 {
2521 /* Regenerate Hit Points */ 2455 /* Regenerate Spell Points */
2522 if (--op->last_heal < 0) 2456 if (!op->contr->golem && --op->last_sp < 0)
2523 {
2524 if (op->stats.hp < op->stats.maxhp)
2525 { 2457 {
2526 op->stats.hp++; 2458 gen_sp = gen_sp * 10 / (op->contr->gen_sp_armour < 10 ? 10 : op->contr->gen_sp_armour);
2527 /* dms do not consume food */ 2459
2528 if (!QUERY_FLAG (op, FLAG_WIZ)) 2460 if (op->stats.sp < op->stats.maxsp)
2529 { 2461 {
2462 op->stats.sp++;
2463
2464 /* dms do not consume food */
2465 if (!QUERY_FLAG (op, FLAG_WIZ))
2466 {
2530 op->stats.food--; 2467 op->stats.food--;
2468
2531 if (op->contr->digestion < 0) 2469 if (op->contr->digestion < 0)
2532 op->stats.food += op->contr->digestion; 2470 op->stats.food += op->contr->digestion;
2533 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))
2534 op->stats.food = last_food; 2472 op->stats.food = last_food;
2473 }
2535 } 2474 }
2536 }
2537 2475
2538 if (max_hp > 1) 2476 if (max_sp > 1)
2539 {
2540 over_hp = (gen_hp < 20 ? 30 : gen_hp + 10) / rate_hp;
2541 if (over_hp > 0)
2542 { 2477 {
2543 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
2544 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);
2545 } 2496 }
2546 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)
2547 { 2505 {
2548 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 }
2549 } 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);
2550 } 2531 }
2551 else 2532 else
2552 {
2553 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);
2554 } 2534 }
2555 } 2535 }
2556 2536
2557 /* Digestion */ 2537 /* Digestion */
2558 if (--op->last_eat < 0) 2538 if (--op->last_eat < 0)
2595 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.");
2596 manual_apply (op, flesh, 0); 2576 manual_apply (op, flesh, 0);
2597 } 2577 }
2598 } 2578 }
2599 2579
2600 while (op->stats.food < 0 && op->stats.hp >= 0) 2580 if (op->stats.food < 0)
2601 op->stats.food++, op->stats.hp--; 2581 {
2582 op->stats.hp += op->stats.food;
2583 op->stats.food = 0;
2584 }
2602 2585
2603 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) 2586 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ))
2604 kill_player (op); 2587 kill_player (op);
2605 } 2588 }
2606} 2589}
2611 * file. 2594 * file.
2612 */ 2595 */
2613void 2596void
2614kill_player (object *op) 2597kill_player (object *op)
2615{ 2598{
2599 int x, y;
2616 char buf[MAX_BUF]; 2600 char buf[MAX_BUF];
2617 int x, y;
2618
2619 //int i;
2620 maptile *map; /* this is for resurrection */ 2601 maptile *map; /* this is for resurrection */
2621
2622 /* int z;
2623 int num_stats_lose;
2624 int lost_a_stat;
2625 int lose_this_stat;
2626 int this_stat; */
2627 int will_kill_again; 2602 int will_kill_again;
2628 archetype *at; 2603 archetype *at;
2629 object *tmp; 2604 object *tmp;
2630 2605
2631 if (save_life (op)) 2606 if (save_life (op))
2653 { 2628 {
2654 tmp->destroy (); 2629 tmp->destroy ();
2655 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2630 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2656 } 2631 }
2657 2632
2658 cure_disease (op, 0); /* remove any disease */ 2633 cure_disease (op, 0, 0); /* remove any disease */
2659 op->stats.hp = op->stats.maxhp; 2634 op->stats.hp = op->stats.maxhp;
2660 if (op->stats.food <= 0) 2635 if (op->stats.food <= 0)
2661 op->stats.food = 999; 2636 op->stats.food = 999;
2662 2637
2663 /* create a bodypart-trophy to make the winner happy */ 2638 /* create a bodypart-trophy to make the winner happy */
2664 if (object *tmp = arch_to_object (archetype::find ("finger"))) 2639 if (object *tmp = arch_to_object (archetype::find ("finger")))
2665 { 2640 {
2666 sprintf (buf, "%s's finger", &op->name); 2641 tmp->name = format ("%s's finger" , &op->name);
2667 tmp->name = buf; 2642 tmp->name_pl = format ("%s's fingers", &op->name);
2668 sprintf (buf, " This finger has been cut off %s\n" 2643 tmp->msg = format (
2669 " 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",
2670 &op->name, op->contr->title, (int) (op->level), op->contr->killer); 2645 &op->name, op->contr->title, (int) (op->level), op->contr->killer
2671 tmp->msg = buf; 2646 );
2672 tmp->value = 0, tmp->type = 0; 2647 tmp->value = 0, tmp->type = 0;
2673 tmp->materialname = "organics"; 2648 tmp->materialname = "organics";
2674 tmp->insert_at (op, tmp); 2649 tmp->insert_at (op, tmp);
2675 } 2650 }
2676 2651
2683 INVOKE_PLAYER (DEATH, op->contr); 2658 INVOKE_PLAYER (DEATH, op->contr);
2684 2659
2685 command_kill_pets (op, 0); 2660 command_kill_pets (op, 0);
2686 2661
2687 if (op->stats.food < 0) 2662 if (op->stats.food < 0)
2688 {
2689 sprintf (buf, "%s starved to death.", &op->name);
2690 strcpy (op->contr->killer, "starvation"); 2663 strcpy (op->contr->killer, "starvation");
2691 }
2692 else
2693 sprintf (buf, "%s died.", &op->name);
2694 2664
2695 op->contr->play_sound (sound_find ("player_dies")); 2665 op->contr->play_sound (sound_find ("player_dies"));
2696 2666
2697 /* save the map location for corpse, gravestone */ 2667 /* save the map location for corpse, gravestone */
2698 x = op->x; 2668 x = op->x;
2863 { 2833 {
2864 tmp->destroy (); 2834 tmp->destroy ();
2865 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2835 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2866 } 2836 }
2867 2837
2868 cure_disease (op, 0); /* remove any disease */ 2838 cure_disease (op, 0, 0); /* remove any disease */
2869 2839
2870 /*add_exp(op, (op->stats.exp * -0.20)); */ 2840 /*add_exp(op, (op->stats.exp * -0.20)); */
2871 apply_death_exp_penalty (op); 2841 apply_death_exp_penalty (op);
2872 if (op->stats.food < 100) 2842 if (op->stats.food < 100)
2873 op->stats.food = 900; 2843 op->stats.food = 900;
3027void 2997void
3028make_visible (object *op) 2998make_visible (object *op)
3029{ 2999{
3030 op->hide = 0; 3000 op->hide = 0;
3031 op->invisible = 0; 3001 op->invisible = 0;
3002
3032 if (op->type == PLAYER) 3003 if (op->type == PLAYER)
3033 { 3004 {
3034 op->contr->tmp_invis = 0; 3005 op->contr->tmp_invis = 0;
3035 op->contr->invis_race = 0; 3006 op->contr->invis_race = 0;
3036 } 3007 }
3049 3020
3050/* look at the surrounding terrain to determine 3021/* look at the surrounding terrain to determine
3051 * the hideability of this object. Positive levels 3022 * the hideability of this object. Positive levels
3052 * indicate greater hideability. 3023 * indicate greater hideability.
3053 */ 3024 */
3054
3055int 3025int
3056hideability (object *ob) 3026hideability (object *ob)
3057{ 3027{
3058 int i, level = 0, mflag; 3028 int i, level = 0, mflag;
3059 sint16 x, y; 3029 sint16 x, y;
3184 * object op. This function works fine for monsters, 3154 * object op. This function works fine for monsters,
3185 * 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
3186 * a pile (say a coin under a table would return "viewable" 3156 * a pile (say a coin under a table would return "viewable"
3187 * by this routine). Another question, should we be 3157 * by this routine). Another question, should we be
3188 * concerned with the direction the player is looking 3158 * concerned with the direction the player is looking
3189 * in? Realistically, most of use cant see stuff behind 3159 * in? Realistically, most of us can't see stuff behind
3190 * our backs...on the other hand, does the "facing" direction 3160 * our backs...on the other hand, does the "facing" direction
3191 * imply the way your head, or body is facing? Its possible 3161 * imply the way your head, or body is facing? It's possible
3192 * 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.
3193 * -b.t. 3163 * -b.t.
3194 * This function is now map tiling safe. 3164 * This function is now map tiling safe.
3195 */ 3165 */
3196
3197int 3166int
3198player_can_view (object *pl, object *op) 3167player_can_view (object *pl, object *op)
3199{ 3168{
3200 rv_vector rv; 3169 rv_vector rv;
3201 int dx, dy; 3170 int dx, dy;
3213 3182
3214 get_rangevector (pl, op, &rv, 0x1); 3183 get_rangevector (pl, op, &rv, 0x1);
3215 3184
3216 /* starting with the 'head' part, lets loop 3185 /* starting with the 'head' part, lets loop
3217 * through the object and find if it has any 3186 * through the object and find if it has any
3218 * part that is in the los array but isnt on 3187 * part that is in the los array but isn't on
3219 * a blocked los square. 3188 * a blocked los square.
3220 * we use the archetype to figure out offsets. 3189 * we use the archetype to figure out offsets.
3221 */ 3190 */
3222 while (op) 3191 while (op)
3223 { 3192 {
3226 3195
3227 /* only the viewable area the player sees is updated by LOS 3196 /* only the viewable area the player sees is updated by LOS
3228 * 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
3229 * for any meaningful values. 3198 * for any meaningful values.
3230 */ 3199 */
3231 if (FABS (dx) <= (pl->contr->ns->mapx / 2) && 3200 if (abs (dx) <= (pl->contr->ns->mapx / 2) &&
3232 FABS (dy) <= (pl->contr->ns->mapy / 2) && 3201 abs (dy) <= (pl->contr->ns->mapy / 2) &&
3233 !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)])
3234 return 1; 3203 return 1;
3204
3235 op = op->more; 3205 op = op->more;
3236 } 3206 }
3207
3237 return 0; 3208 return 0;
3238} 3209}
3239 3210
3240/* routine for both players and monsters. We call this when 3211/* routine for both players and monsters. We call this when
3241 * there is a possibility for our action distrubing our hiding 3212 * there is a possibility for our action distrubing our hiding
3244 * return 0. 3215 * return 0.
3245 */ 3216 */
3246int 3217int
3247action_makes_visible (object *op) 3218action_makes_visible (object *op)
3248{ 3219{
3249
3250 if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE)) 3220 if (op->invisible && QUERY_FLAG (op, FLAG_ALIVE))
3251 { 3221 {
3252 if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) 3222 if (QUERY_FLAG (op, FLAG_MAKE_INVIS))
3253 return 0; 3223 return 0;
3254 3224
3260 { 3230 {
3261 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");
3262 return 1; 3232 return 1;
3263 } 3233 }
3264 } 3234 }
3235
3265 return 0; 3236 return 0;
3266} 3237}
3267 3238
3268/* op_on_battleground - checks if the given object op (usually 3239/* op_on_battleground - checks if the given object op (usually
3269 * a player) is standing on a valid battleground-tile, 3240 * a player) is standing on a valid battleground-tile,
3274 * 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
3275 */ 3246 */
3276int 3247int
3277op_on_battleground (object *op, int *x, int *y) 3248op_on_battleground (object *op, int *x, int *y)
3278{ 3249{
3279 object *tmp;
3280
3281 /* A battleground-tile needs the following attributes to be valid: 3250 /* A battleground-tile needs the following attributes to be valid:
3282 * 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),
3283 * name="battleground", no_pick 1, type=58 (type BATTLEGROUND) 3252 * name="battleground", no_pick 1, type=58 (type BATTLEGROUND)
3284 * and the exit-coordinates sp/hp must both be > 0. 3253 * and the exit-coordinates sp/hp must both be > 0.
3285 * => The intention here is to prevent abuse of the battleground- 3254 * => The intention here is to prevent abuse of the battleground-
3286 * feature (like pickable or hidden battleground tiles). */ 3255 * feature (like pickable or hidden battleground tiles). */
3287 for (tmp = op->below; tmp != NULL; tmp = tmp->below) 3256 for (object *tmp = op->below; tmp; tmp = tmp->below)
3288 { 3257 {
3289 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) 3258 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR))
3290 { 3259 {
3291 if (QUERY_FLAG (tmp, FLAG_NO_PICK) && 3260 if (QUERY_FLAG (tmp, FLAG_NO_PICK)
3292 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))
3293 { 3264 {
3294 /*before we assign the exit, check if this is a teambattle */ 3265 /* before we assign the exit, check if this is a teambattle */
3295 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))
3296 { 3267 {
3297 object *invtmp;
3298
3299 for (invtmp = op->inv; invtmp != NULL; invtmp = invtmp->below) 3268 for (object *invtmp = op->inv; invtmp; invtmp = invtmp->below)
3300 { 3269 {
3301 if (invtmp->type == FORCE && invtmp->slaying && !strcmp (EXIT_PATH (tmp), invtmp->slaying)) 3270 if (invtmp->type == FORCE && invtmp->slaying && tmp->slaying == invtmp->slaying)
3302 { 3271 {
3303 if (x != NULL && y != NULL) 3272 if (x && y)
3304 *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp); 3273 *x = EXIT_ALT_X (tmp), *y = EXIT_ALT_Y (tmp);
3274
3305 return 1; 3275 return 1;
3306 } 3276 }
3307 } 3277 }
3308 } 3278 }
3279
3309 if (x != NULL && y != NULL) 3280 if (x && y)
3310 *x = EXIT_X (tmp), *y = EXIT_Y (tmp); 3281 *x = EXIT_X (tmp), *y = EXIT_Y (tmp);
3282
3311 return 1; 3283 return 1;
3312 } 3284 }
3313 } 3285 }
3314 } 3286 }
3287
3315 /* If we got here, did not find a battleground */ 3288 /* If we got here, did not find a battleground */
3316 return 0; 3289 return 0;
3317} 3290}
3318 3291
3319/* 3292/*
3335 char buf[MAX_BUF]; /* tmp. string buffer */ 3308 char buf[MAX_BUF]; /* tmp. string buffer */
3336 int i = 0, j = 0; 3309 int i = 0, j = 0;
3337 3310
3338 /* get the appropriate treasurelist */ 3311 /* get the appropriate treasurelist */
3339 if (atnr == ATNR_FIRE) 3312 if (atnr == ATNR_FIRE)
3340 trlist = treasurelist::find ("dragon_ability_fire"); 3313 trlist = treasurelist::find (shstr_dragon_ability_fire);
3341 else if (atnr == ATNR_COLD) 3314 else if (atnr == ATNR_COLD)
3342 trlist = treasurelist::find ("dragon_ability_cold"); 3315 trlist = treasurelist::find (shstr_dragon_ability_cold);
3343 else if (atnr == ATNR_ELECTRICITY) 3316 else if (atnr == ATNR_ELECTRICITY)
3344 trlist = treasurelist::find ("dragon_ability_elec"); 3317 trlist = treasurelist::find (shstr_dragon_ability_elec);
3345 else if (atnr == ATNR_POISON) 3318 else if (atnr == ATNR_POISON)
3346 trlist = treasurelist::find ("dragon_ability_poison"); 3319 trlist = treasurelist::find (shstr_dragon_ability_poison);
3347 3320
3348 if (trlist == NULL || who->type != PLAYER) 3321 if (trlist == NULL || who->type != PLAYER)
3349 return; 3322 return;
3350 3323
3351 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++);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines