/* * Tweak an item */ static void wiz_tweak_item(object_type *o_ptr) { const char *p; char tmp_val[80]; int i, val; /* Hack -- leave artifacts alone */ if (o_ptr->artifact) return; p = "Enter new ego item index: "; strnfmt(tmp_val, sizeof(tmp_val), "0"); if (o_ptr->ego) strnfmt(tmp_val, sizeof(tmp_val), "%d", o_ptr->ego->eidx); if (!get_string(p, tmp_val, 6)) return; val = atoi(tmp_val); if (val) { o_ptr->ego = &e_info[val]; ego_apply_magic(o_ptr, p_ptr->depth); } else o_ptr->ego = 0; wiz_display_item(o_ptr, TRUE); p = "Enter new artifact index: "; strnfmt(tmp_val, sizeof(tmp_val), "0"); if (o_ptr->artifact) strnfmt(tmp_val, sizeof(tmp_val), "%d", o_ptr->artifact->aidx); if (!get_string(p, tmp_val, 6)) return; val = atoi(tmp_val); if (val) { o_ptr->artifact = &a_info[val]; copy_artifact_data(o_ptr, o_ptr->artifact); } else o_ptr->artifact = 0; wiz_display_item(o_ptr, TRUE); #define WIZ_TWEAK(attribute) do {\ p = "Enter new '" #attribute "' setting: ";\ strnfmt(tmp_val, sizeof(tmp_val), "%d", o_ptr->attribute);\ if (!get_string(p, tmp_val, 6)) return;\ o_ptr->attribute = atoi(tmp_val);\ wiz_display_item(o_ptr, TRUE);\ } while (0) for (i = 0; i < MAX_PVALS; i++) { WIZ_TWEAK(pval[i]); if (o_ptr->pval[i]) o_ptr->num_pvals = (i + 1); } WIZ_TWEAK(to_a); WIZ_TWEAK(to_h); WIZ_TWEAK(to_d); }
/* * Tweak an item */ static void wiz_tweak_item(object_type *o_ptr) { cptr p; char tmp_val[80]; /* Hack -- leave artifacts alone */ if (artifact_p(o_ptr)) return; #define WIZ_TWEAK(attribute) do {\ p = "Enter new '" #attribute "' setting: ";\ strnfmt(tmp_val, sizeof(tmp_val), "%d", o_ptr->attribute);\ if (!get_string(p, tmp_val, 6)) return;\ o_ptr->attribute = atoi(tmp_val);\ wiz_display_item(o_ptr, TRUE);\ } while (0) WIZ_TWEAK(pval); WIZ_TWEAK(to_a); WIZ_TWEAK(to_h); WIZ_TWEAK(to_d); WIZ_TWEAK(name1); WIZ_TWEAK(name2); }