Ejemplo n.º 1
0
static int rd_object_memory(void)
{
	int i;
	u16b tmp16u;
	
	/* Object Memory */
	rd_u16b(&tmp16u);
	
	/* Incompatible save files */
	if (tmp16u > z_info->k_max)
	{
		note(format("Too many (%u) object kinds!", tmp16u));
		return (-1);
	}
	
	/* Read the object memory */
	for (i = 0; i < tmp16u; i++)
	{
		byte tmp8u;
		object_kind *k_ptr = &k_info[i];
		
		rd_byte(&tmp8u);
		
		k_ptr->aware = (tmp8u & 0x01) ? TRUE : FALSE;
		k_ptr->tried = (tmp8u & 0x02) ? TRUE : FALSE;
		k_ptr->everseen = (tmp8u & 0x08) ? TRUE : FALSE;

		if (tmp8u & 0x04) kind_squelch_when_aware(k_ptr);
		if (tmp8u & 0x10) kind_squelch_when_unaware(k_ptr);
	}
	
	return 0;
}
Ejemplo n.º 2
0
/*
 * Special key actions for object inscription.
 */
static void o_xtra_act(struct keypress ch, int oid)
{
	object_kind *k = objkind_byid(oid);

	/* Toggle squelch */
	if (squelch_tval(k->tval) && (ch.code == 's' || ch.code == 'S'))
	{
		if (k->aware)
		{
			if (kind_is_squelched_aware(k))
				kind_squelch_clear(k);
			else
				kind_squelch_when_aware(k);
		}
		else
		{
			if (kind_is_squelched_unaware(k))
				kind_squelch_clear(k);
			else
				kind_squelch_when_unaware(k);
		}

		return;
	}

	/* Forget it if we've never seen the thing */
	if (k->flavor && !k->aware)
		return;

	/* Uninscribe */
	if (ch.code == '}') {
		if (k->note)
			remove_autoinscription(oid);
	} else if (ch.code == '{') {
		/* Inscribe */
		char note_text[80] = "";

		/* Avoid the prompt getting in the way */
		screen_save();

		/* Prompt */
		prt("Inscribe with: ", 0, 0);

		/* Default note */
		if (k->note)
			strnfmt(note_text, sizeof(note_text), "%s", get_autoinscription(k));

		/* Get an inscription */
		if (askfor_aux(note_text, sizeof(note_text), NULL))
		{
			/* Remove old inscription if existent */
			if (k->note)
				remove_autoinscription(oid);

			/* Add the autoinscription */
			add_autoinscription(oid, note_text);

			/* Notice stuff (later) */
			p_ptr->notice |= (PN_AUTOINSCRIBE);
			p_ptr->redraw |= (PR_INVEN | PR_EQUIP);
		}

		/* Reload the screen */
		screen_load();
	}
}