Add CONTAINER_FLESH container subtype

This is used to match the other_arch property of items attempting to be
put into a container. These other_arch values are checked against the
container's "race" string. Example:
    * flesh sack -> race -> "hill_giant,beholder"
    * "hill giant's head" will match if other_arch is "hill_giant"
    * "beholder's tongue" will match if other_arch is "beholder"

It also might be good to match by name instead, but we'll see.
master
kts of kettek (nyaa) 2018-06-29 17:57:34 -07:00
parent 198f3e83b1
commit 4ea30c22d0
2 changed files with 20 additions and 4 deletions

View File

@ -403,4 +403,9 @@ extern int nroffreeobjects;
#define ARCH_DEPLETION "depletion" /**< Archetype for depletion. */
#define ARCH_SYMPTOM "symptom" /**< Archetype for disease symptom. */
/* This isn't the right place for this, but we need a container subtype for
* special "flesh sack" bonus handling. -kts
*/
#define CONTAINER_NORMAL 0
#define CONTAINER_FLESH 1
#endif /* OBJECT_H */

View File

@ -297,7 +297,16 @@ int sack_can_hold(const object *pl, const object *sack, const object *op, uint32
name);
return 0;
}
if (sack->race
/* Special handling for "flesh bags" --kts */
if (sack->subtype == CONTAINER_FLESH
&& (!op->other_arch || (op->other_arch && sack->race && strstr(sack->race, op->other_arch->name) == NULL)) ) {
draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR,
"You can only put %s parts into the %s.",
"You can only put %s parts into the %s.",
sack->race, sack->name);
return 0;
}
if (sack->race && sack->subtype != CONTAINER_FLESH
&& (sack->race != op->race || op->type == CONTAINER || (sack->stats.food && sack->stats.food != op->type))) {
draw_ext_info_format(NDI_UNIQUE, 0, pl, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR,
"You can put only %s into the %s.",
@ -574,14 +583,15 @@ void pick_up(object *op, object *alt) {
/* startequip items are not allowed to be put into containers
* Not sure why we have this limitation
* @@ BE LIMITED NO LONGER !!!!
*/
if (op->type == PLAYER
/*if (op->type == PLAYER
&& alt->type == CONTAINER
&& QUERY_FLAG(tmp, FLAG_STARTEQUIP)) {
draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR,
"This object cannot be put into containers!", NULL);
return;
}
}*/
tag = tmp->count;
pick_up_object(op, alt, tmp, count);
@ -712,7 +722,8 @@ void put_object_in_sack(object *op, object *sack, object *tmp, uint32 nrof) {
name_sack);
return;
}
if (QUERY_FLAG(tmp, FLAG_STARTEQUIP)) {
/* Changed to allow god-given materials to be placed into a cauldron -kts */
if (QUERY_FLAG(tmp, FLAG_STARTEQUIP) && !QUERY_FLAG(tmp, FLAG_IS_CAULDRON)) {
query_name(tmp, name_tmp, MAX_BUF);
draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_ERROR,
"You cannot put the %s in the %s.",