Пример #1
0
/**
 * Display inventory items.
 */
void inventory ()
{
	int old_fg, old_bg;
	int n;

	/* screen is white with black text */
	old_fg = game.color_fg;
	old_bg = game.color_bg;
	game.color_fg = 0;
	game.color_bg = 15;
	clear_screen (game.color_bg);

	print_text (YOUHAVE_MSG, 0, YOUHAVE_X, YOUHAVE_Y, 40,
		STATUS_FG, STATUS_BG);

	/* FIXME: doesn't check if objects overflow off screen... */

	intobj = malloc (4 + game.num_objects);
	memset(intobj, 0, (4 + game.num_objects));

	n = show_items ();

	if (getflag (F_status_selects_items)) {
		print_text (SELECT_MSG, 0, SELECT_X, SELECT_Y, 40,
			STATUS_FG, STATUS_BG);
	} else {
		print_text (ANY_KEY_MSG, 0, ANY_KEY_X, ANY_KEY_Y, 40,
			STATUS_FG, STATUS_BG);
	}
 
	flush_screen ();

	/* If flag 13 is set, we want to highlight & select an item.
	 * opon selection, put objnum in var 25. Then on esc put in
	 * var 25 = 0xff.
	 */
 
	if (getflag (F_status_selects_items))
		select_items (n);

	free (intobj);

	if (!getflag (F_status_selects_items))
		wait_any_key();

	clear_screen (0);
	write_status ();
	show_pic ();
	game.color_fg = old_fg;
	game.color_bg = old_bg;
	game.has_prompt = 0;
	flush_lines (game.line_user_input, 24);
}
Пример #2
0
void CAI_Stalker::update_sell_info					()
{
	if (m_sell_info_actuality)
		return;

	m_sell_info_actuality	= true;

	m_temp_items.clear		();
	m_current_trader		= 0;
	m_total_money			= get_money();
	u32						money_delta = fill_items(inventory(),this,ALife::_OBJECT_ID(-1));
	m_total_money			+= money_delta;
	std::sort				(m_temp_items.begin(),m_temp_items.end());
	select_items			();

	TIItemContainer::iterator	I = inventory().m_all.begin();
	TIItemContainer::iterator	E = inventory().m_all.end();
	for ( ; I != E; ++I) {
		if (!tradable_item(*I,ID()))
			m_temp_items.push_back	(CTradeItem(*I,ID(),ID()));
	}
}