Esempio n. 1
0
/**
 * Display the equipment.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_equip(int mode, item_tester tester)
{
	int i;
	bool in_term = (mode & OLIST_WINDOW) ? true : false;

	/* Intialize */
	wipe_obj_list();

	/* Build the object list */
	build_obj_list(player->body.count - 1, NULL, tester, mode);

	/* Show the quiver in subwindows */
	if (in_term) {
		int last_slot = -1;

		strnfmt(items[num_obj].label, sizeof(items[num_obj].label),
				"In quiver");
		items[num_obj].object = NULL;
		num_obj++;

		/* Find the last occupied quiver slot */
		for (i = 0; i < z_info->quiver_size; i++)
			if (player->upkeep->quiver[i] != NULL) last_slot = i;

		/* Extend the object list */
		build_obj_list(last_slot, player->upkeep->quiver, tester, mode);
	}

	/* Display the object list */
	num_head = 0;
	show_obj_list(mode);
}
Esempio n. 2
0
/*
 * Display the floor.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_floor(const int *floor_list, int floor_num, int mode)
{
	int i;

	object_type *o_ptr;

	int num_obj = 0;
	char labels[50][80];
	object_type *objects[50];

	if (floor_num > MAX_FLOOR_STACK) floor_num = MAX_FLOOR_STACK;

	/* Build the object list */
	for (i = 0; i < floor_num; i++)
	{
		o_ptr = object_byid(floor_list[i]);

		/* Tester always skips gold. When gold should be displayed,
		 * only test items that are not gold.
		 */
		if ((o_ptr->tval != TV_GOLD || !(mode & OLIST_GOLD)) &&
		    !item_tester_okay(o_ptr))
			continue;

		strnfmt(labels[num_obj], sizeof(labels[num_obj]),
		        "%c) ", index_to_label(i));

		/* Save the object */
		objects[num_obj] = o_ptr;
		num_obj++;
	}

	/* Display the object list */
	show_obj_list(num_obj, 0, labels, objects, mode);
}
Esempio n. 3
0
/*
 * Display the inventory.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_inven(olist_detail_t mode)
{
    int i, last_slot = 0;
    int diff = weight_remaining();

    char header[80];

    object_type *o_ptr;

    bool in_term = (mode & OLIST_WINDOW) ? TRUE : FALSE;

    /* Include burden for term windows */
    if (in_term) {
	strnfmt(header, sizeof(header),
		"Burden %d.%d lb (%d.%d lb %s) ", p_ptr->total_weight / 10,
		p_ptr->total_weight % 10, abs(diff) / 10, abs(diff) % 10,
		(diff < 0 ? "overweight" : "remaining"));
	put_str(header, 0, 0);
    }

    /* Find the last occupied inventory slot */
    for (i = 0; i < INVEN_PACK; i++) {
	o_ptr = &p_ptr->inventory[i];
	if (o_ptr->k_idx)
	    last_slot = i;
    }

    /* Build the object list */
    build_obj_list(0, last_slot, NULL, mode);

    /* Display the object list */
    show_obj_list(num_obj, PW_INVEN, mode);
}
Esempio n. 4
0
/*
 * Display the inventory.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_inven(olist_detail_t mode)
{
	int i, last_slot = 0;
	int diff = weight_remaining();

	object_type *o_ptr;

   int num_obj = 0;
   char labels[50][80];
   object_type *objects[50];

   bool in_term = (mode & OLIST_WINDOW) ? TRUE : FALSE;

	/* Include burden for term windows */
	if (in_term)
	{
		strnfmt(labels[num_obj], sizeof(labels[num_obj]),
		        "Burden %d.%d lb (%d.%d lb %s) ",
		        p_ptr->total_weight / 10, p_ptr->total_weight % 10,
		        abs(diff) / 10, abs(diff) % 10,
		        (diff < 0 ? "overweight" : "remaining"));

		objects[num_obj] = NULL;
		num_obj++;
	}

	/* Find the last occupied inventory slot */
	for (i = 0; i < INVEN_PACK; i++)
	{
		o_ptr = &p_ptr->inventory[i];
		if (o_ptr->k_idx) last_slot = i;
	}

	/* Build the object list */
	for (i = 0; i <= last_slot; i++)
	{
		o_ptr = &p_ptr->inventory[i];

		/* Acceptable items get a label */
		if (item_tester_okay(o_ptr))
			strnfmt(labels[num_obj], sizeof(labels[num_obj]), "%c) ", index_to_label(i));

		/* Unacceptable items are still displayed in term windows */
		else if (in_term)
			my_strcpy(labels[num_obj], "   ", sizeof(labels[num_obj]));

		/* Unacceptable items are skipped in the main window */
		else continue;

		/* Save the object */
		objects[num_obj] = o_ptr;
		num_obj++;
	}

	/* Display the object list */
	show_obj_list(num_obj, labels, objects, mode);
}
Esempio n. 5
0
/*
 * Display the floor.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_floor(const int *floor_list, int floor_num, olist_detail_t mode)
{
    if (floor_num > MAX_FLOOR_STACK)
	floor_num = MAX_FLOOR_STACK;

    /* Build the object list */
    build_obj_list(0, floor_num - 1, floor_list, mode);

    /* Display the object list */
    show_obj_list(num_obj, 0, mode);
}
Esempio n. 6
0
/**
 * Display the floor.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_floor(struct object **floor_list, int floor_num, int mode,
				item_tester tester)
{
	/* Intialize */
	wipe_obj_list();

	if (floor_num > z_info->floor_size)
		floor_num = z_info->floor_size;

	/* Build the object list */
	build_obj_list(floor_num - 1, floor_list, tester, mode);

	/* Display the object list */
	num_head = 0;
	show_obj_list(mode);
}
Esempio n. 7
0
/**
 * Display the quiver.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_quiver(int mode, item_tester tester)
{
	int i, last_slot = -1;

	/* Intialize */
	wipe_obj_list();

	/* Find the last occupied quiver slot */
	for (i = 0; i < z_info->quiver_size; i++)
		if (player->upkeep->quiver[i] != NULL) last_slot = i;

	/* Build the object list */
	build_obj_list(last_slot, player->upkeep->quiver, tester, mode);

	/* Display the object list */
	num_head = 0;
	show_obj_list(mode);
}
Esempio n. 8
0
/*
 * Display the equipment.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_equip(olist_detail_t mode)
{
    int i, last_slot = 0;

    object_type *o_ptr;

    /* Find the last equipment slot to display */
    for (i = INVEN_WIELD; i < ALL_INVEN_TOTAL; i++) {
	o_ptr = &p_ptr->inventory[i];
	if (i < ALL_INVEN_TOTAL && o_ptr->k_idx)
	    last_slot = i;
    }

    /* Build the object list */
    build_obj_list(INVEN_WIELD, last_slot, NULL, mode);

    /* Display the object list */
    show_obj_list(num_obj, PW_EQUIP, mode);
}
Esempio n. 9
0
/**
 * Display the inventory.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_inven(int mode, item_tester tester)
{
	int i, last_slot = -1;
	int diff = weight_remaining(player);

	bool in_term = (mode & OLIST_WINDOW) ? true : false;

	/* Intialize */
	wipe_obj_list();

	/* Include burden for term windows */
	if (in_term) {
		strnfmt(items[num_obj].label, sizeof(items[num_obj].label),
		        "Burden %d.%d lb (%d.%d lb %s) ",
		        player->upkeep->total_weight / 10,
				player->upkeep->total_weight % 10,
		        abs(diff) / 10, abs(diff) % 10,
		        (diff < 0 ? "overweight" : "remaining"));

		items[num_obj].object = NULL;
		num_obj++;
	}

	/* Find the last occupied inventory slot */
	for (i = 0; i < z_info->pack_size; i++)
		if (player->upkeep->inven[i] != NULL) last_slot = i;

	/* Build the object list */
	build_obj_list(last_slot, player->upkeep->inven, tester, mode);

	/* Term window starts with a burden header */
	num_head = in_term ? 1 : 0;

	/* Display the object list */
	show_obj_list(mode);
}
Esempio n. 10
0
/*
 * Display the equipment.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_equip(int mode)
{
	int i, last_slot = 0;

	object_type *o_ptr;

	int num_obj = 0;
	char labels[50][80];
	object_type *objects[50];

	char tmp_val[80];

	bool in_term = (mode & OLIST_WINDOW) ? TRUE : FALSE;
	bool show_empty = (mode & OLIST_SEMPTY) ? TRUE : FALSE;

	/* Find the last equipment slot to display */
	for (i = INVEN_WIELD; i < ALL_INVEN_TOTAL; i++)
	{
		o_ptr = &p_ptr->inventory[i];
		if (i < INVEN_TOTAL || o_ptr->kind) last_slot = i;
	}

	/* Build the object list */
	for (i = INVEN_WIELD; i <= last_slot; i++)
	{
		o_ptr = &p_ptr->inventory[i];

		/* May need a blank line to separate the quiver */
		if (i == INVEN_TOTAL)
		{
			int j;
			bool need_spacer = FALSE;
			
			/* Scan the rest of the items for acceptable entries */
			for (j = i; j < last_slot; j++)
			{
				o_ptr = &p_ptr->inventory[j];
				if (item_tester_okay(o_ptr)) need_spacer = TRUE;
			}

			/* Add a spacer between equipment and quiver */
			if (num_obj > 0 && need_spacer)
			{
				my_strcpy(labels[num_obj], "", sizeof(labels[num_obj]));
				objects[num_obj] = NULL;
				num_obj++;
			}

			continue;
		}

		/* Acceptable items get a label */
		if (item_tester_okay(o_ptr))
			strnfmt(labels[num_obj], sizeof(labels[num_obj]), "%c) ", index_to_label(i));

		/* Unacceptable items are still sometimes shown */
		else if ((!o_ptr->kind && show_empty) || in_term)
			my_strcpy(labels[num_obj], "   ", sizeof(labels[num_obj]));

		/* Unacceptable items are skipped in the main window */
		else continue;

		/* Show full slot labels */
		strnfmt(tmp_val, sizeof(tmp_val), "%-14s: ", mention_use(i));
		my_strcat(labels[num_obj], tmp_val, sizeof(labels[num_obj]));

		/* Save the object */
		objects[num_obj] = o_ptr;
		num_obj++;
	}

	/* Display the object list */
	show_obj_list(num_obj, 0, labels, objects, mode);
}
Esempio n. 11
0
/*
 * Display the equipment.  Builds a list of objects and passes them
 * off to show_obj_list() for display.  Mode flags documented in
 * object.h
 */
void show_equip(olist_detail_t mode)
{
	int i, last_slot = 0;

	object_type *o_ptr;

   int num_obj = 0;
   char labels[50][80];
   object_type *objects[50];

	char tmp_val[80];

   bool in_term = (mode & OLIST_WINDOW) ? TRUE : FALSE;

	/* Find the last equipment slot to display */
	for (i = INVEN_WIELD; i < ALL_INVEN_TOTAL; i++)
	{
		o_ptr = &p_ptr->inventory[i];
		if (i < INVEN_TOTAL || o_ptr->k_idx) last_slot = i;
	}

	/* Build the object list */
	for (i = INVEN_WIELD; i <= last_slot; i++)
	{
		if (((i >= INVEN_WIELD) && (i < (INVEN_WIELD + rp_ptr->melee_slots)))
			|| ((i >= INVEN_BOW) && (i < (INVEN_BOW + rp_ptr->range_slots)))
			|| ((i >= INVEN_FINGER) && (i < (INVEN_FINGER + rp_ptr->ring_slots)))
			|| ((i >= INVEN_NECK) && (i < (INVEN_NECK + rp_ptr->amulet_slots)))
			|| ((i >= INVEN_LIGHT) && (i < (INVEN_LIGHT + rp_ptr->light_slots)))
			|| ((i >= INVEN_BODY) && (i < (INVEN_BODY + rp_ptr->body_slots)))
			|| ((i >= INVEN_OUTER) && (i < (INVEN_OUTER + rp_ptr->cloak_slots)))
			|| ((i >= INVEN_ARM) && (i < (INVEN_ARM + rp_ptr->shield_slots)))
			|| ((i >= INVEN_HEAD) && (i < (INVEN_HEAD + rp_ptr->helm_slots)))
			|| ((i >= INVEN_HANDS) && (i < (INVEN_HANDS + rp_ptr->glove_slots)))
			|| ((i >= INVEN_FEET) && (i < (INVEN_FEET + rp_ptr->boot_slots))))
		{
			o_ptr = &p_ptr->inventory[i];

			/* May need a blank line to separate the quiver */
			if (i == INVEN_TOTAL)
			{
				int j;
				bool need_spacer = FALSE;
				
				/* Scan the rest of the items for acceptable entries */
				for (j = i; j < last_slot; j++)
				{
					o_ptr = &p_ptr->inventory[j];
					if (item_tester_okay(o_ptr)) need_spacer = TRUE;
				}

				/* Add a spacer between equipment and quiver */
				if (num_obj > 0 && need_spacer)
				{
					my_strcpy(labels[num_obj], "", sizeof(labels[num_obj]));
					objects[num_obj] = NULL;
					num_obj++;
				}

				continue;
			}

			/* Acceptable items get a label */
			//if (item_tester_okay(o_ptr))
				strnfmt(labels[num_obj], sizeof(labels[num_obj]), "%c) ", index_to_label(num_obj));

			/* Unacceptable items are still displayed in term windows */
			//else if (in_term)
			//	my_strcpy(labels[num_obj], "   ", sizeof(labels[num_obj]));

			/* Unacceptable items are skipped in the main window */
			//else continue;

			/* Show full slot labels */
			if (TRUE)//OPT(show_labels))
			{
				strnfmt(tmp_val, sizeof(tmp_val), "%-14s: ", mention_use(i));
				my_strcat(labels[num_obj], tmp_val, sizeof(labels[num_obj]));
			}

			/* Otherwise only show short quiver labels */
			else if (i >= QUIVER_START)
			{
				strnfmt(tmp_val, sizeof(tmp_val), "[f%d]: ", i - QUIVER_START);
				my_strcat(labels[num_obj], tmp_val, sizeof(labels[num_obj]));
			}

			/* Save the object */
			objects[num_obj] = o_ptr;
			num_obj++;
		}
	}

	/* Display the object list */
	show_obj_list(num_obj, labels, objects, mode);
}