… | |
… | |
406 | |
406 | |
407 | /** |
407 | /** |
408 | * This returns the sum of nrof of item (arch name). |
408 | * This returns the sum of nrof of item (arch name). |
409 | */ |
409 | */ |
410 | static int |
410 | static int |
411 | check_item (object *op, const char *item) |
411 | check_item (object *op, shstr_cmp item) |
412 | { |
412 | { |
413 | int count = 0; |
413 | int count = 0; |
414 | |
414 | |
415 | if (!item) |
415 | if (!item) |
416 | return 0; |
416 | return 0; |
417 | |
417 | |
418 | for (op = op->below; op; op = op->below) |
418 | for (op = op->below; op; op = op->below) |
419 | { |
|
|
420 | if (strcmp (op->arch->archname, item) == 0) |
419 | if (op->arch->archname == item) |
421 | { |
|
|
422 | if (!QUERY_FLAG (op, FLAG_CURSED) && !QUERY_FLAG (op, FLAG_DAMNED) |
420 | if (!QUERY_FLAG (op, FLAG_CURSED) && !QUERY_FLAG (op, FLAG_DAMNED) |
423 | /* Loophole bug? -FD- */ && !QUERY_FLAG (op, FLAG_UNPAID)) |
421 | && /* Loophole bug? -FD- */ !QUERY_FLAG (op, FLAG_UNPAID)) |
424 | { |
|
|
425 | if (op->nrof == 0) /* this is necessary for artifact sacrifices --FD-- */ |
|
|
426 | count++; |
|
|
427 | else |
|
|
428 | count += op->nrof; |
422 | count += op->number_of (); |
429 | } |
|
|
430 | } |
|
|
431 | } |
|
|
432 | |
423 | |
433 | return count; |
424 | return count; |
434 | } |
425 | } |
435 | |
426 | |
436 | /** |
427 | /** |
… | |
… | |
438 | * op is typically the player, which is only |
429 | * op is typically the player, which is only |
439 | * really used to determine what space to look at. |
430 | * really used to determine what space to look at. |
440 | * Modified to only eat 'nrof' of objects. |
431 | * Modified to only eat 'nrof' of objects. |
441 | */ |
432 | */ |
442 | static void |
433 | static void |
443 | eat_item (object *op, const char *item, uint32 nrof) |
434 | eat_item (object *op, shstr_cmp item, uint32 nrof) |
444 | { |
435 | { |
445 | object *prev; |
436 | object *prev; |
446 | |
437 | |
447 | prev = op; |
438 | prev = op; |
448 | op = op->below; |
439 | op = op->below; |
449 | |
440 | |
450 | while (op) |
441 | while (op) |
451 | { |
442 | { |
452 | if (strcmp (op->arch->archname, item) == 0) |
443 | if (op->arch->archname == item) |
453 | { |
444 | { |
454 | if (op->nrof >= nrof) |
445 | if (op->nrof >= nrof) |
455 | { |
446 | { |
456 | op->decrease (nrof); |
447 | op->decrease (nrof); |
457 | return; |
448 | return; |
… | |
… | |
3923 | } |
3914 | } |
3924 | |
3915 | |
3925 | /* insert the randomitems from the change's treasurelist into |
3916 | /* insert the randomitems from the change's treasurelist into |
3926 | * the player ref: player.c |
3917 | * the player ref: player.c |
3927 | */ |
3918 | */ |
3928 | if (change->randomitems != NULL) |
3919 | if (change->randomitems) |
3929 | give_initial_items (pl, change->randomitems); |
3920 | give_initial_items (pl, change->randomitems); |
3930 | |
3921 | |
3931 | /* set up the face, for some races. */ |
3922 | /* set up the face, for some races. */ |
3932 | |
3923 | |
3933 | /* first, look for the force object banning |
3924 | /* first, look for the force object banning |
3934 | * changing the face. Certain races never change face with class. |
3925 | * changing the face. Certain races never change face with class. |
3935 | */ |
3926 | */ |
3936 | for (walk = pl->inv; walk != NULL; walk = walk->below) |
3927 | for (walk = pl->inv; walk; walk = walk->below) |
3937 | if (!strcmp (walk->name, "NOCLASSFACECHANGE")) |
3928 | if (walk->name == shstr_NOCLASSFACECHANGE) |
3938 | flag_change_face = 0; |
3929 | flag_change_face = 0; |
3939 | |
3930 | |
3940 | if (flag_change_face) |
3931 | if (flag_change_face) |
3941 | { |
3932 | { |
3942 | pl->face = change->face; |
3933 | pl->face = change->face; |
… | |
… | |
3944 | pl->flag [FLAG_ANIMATE] = change->flag [FLAG_ANIMATE]; |
3935 | pl->flag [FLAG_ANIMATE] = change->flag [FLAG_ANIMATE]; |
3945 | } |
3936 | } |
3946 | |
3937 | |
3947 | /* check the special case of can't use weapons */ |
3938 | /* check the special case of can't use weapons */ |
3948 | /*if(QUERY_FLAG(change,FLAG_USE_WEAPON)) CLEAR_FLAG(pl,FLAG_USE_WEAPON); */ |
3939 | /*if(QUERY_FLAG(change,FLAG_USE_WEAPON)) CLEAR_FLAG(pl,FLAG_USE_WEAPON); */ |
3949 | if (!strcmp (change->name, "monk")) |
3940 | if (change->name == shstr_monk) |
3950 | CLEAR_FLAG (pl, FLAG_USE_WEAPON); |
3941 | CLEAR_FLAG (pl, FLAG_USE_WEAPON); |
3951 | |
3942 | |
3952 | break; |
3943 | break; |
3953 | } |
3944 | } |
3954 | } |
3945 | } |
… | |
… | |
3991 | pl->failmsg (format ("You can't use the %s with your %s!", query_name (transformer), query_name (marked))); |
3982 | pl->failmsg (format ("You can't use the %s with your %s!", query_name (transformer), query_name (marked))); |
3992 | return; |
3983 | return; |
3993 | } |
3984 | } |
3994 | |
3985 | |
3995 | /* check whether they are compatible or not */ |
3986 | /* check whether they are compatible or not */ |
3996 | find = strstr (marked->slaying, transformer->arch->archname); |
3987 | find = strstr (&marked->slaying, transformer->arch->archname); |
3997 | if (!find || (*(find + strlen (transformer->arch->archname)) != ':')) |
3988 | if (!find || (*(find + strlen (transformer->arch->archname)) != ':')) |
3998 | { |
3989 | { |
3999 | pl->failmsg (format ("You can't use the %s with your %s!", query_name (transformer), query_name (marked))); |
3990 | pl->failmsg (format ("You can't use the %s with your %s!", query_name (transformer), query_name (marked))); |
4000 | return; |
3991 | return; |
4001 | } |
3992 | } |