Advanced Rogue 5, 7: fix some trading post messages.

When attempting to buy an unaffordable object, messages were often of
the form "You can't afford that a scroll of hold monster !", because
the object description (stored in curpurch) was the same text used in
inventory displays.

This has been worked around by inspecting the contents of curpurch and
using different message templates.
This commit is contained in:
John "Elwin" Edwards 2021-10-24 20:26:21 -04:00
parent b6067e102e
commit 2a9d279baa
2 changed files with 18 additions and 2 deletions

View file

@ -51,7 +51,16 @@ buy_it(void)
}
mpos = 0;
if (curprice > purse) {
msg("You can't afford to buy that %s !",curpurch);
if (!strncmp(curpurch, "a ", 2))
msg("You can't afford to buy that %s!", curpurch + 2);
else if (!strncmp(curpurch, "an ", 3))
msg("You can't afford to buy that %s!", curpurch + 3);
else if (!strncmp(curpurch, "some ", 5))
msg("You can't afford to buy that %s!", curpurch + 5);
else if (isdigit(curpurch[0]))
msg("You can't afford to buy those %s!", curpurch);
else
msg("You can't afford to buy that %s!", curpurch);
return;
}
/*

View file

@ -55,7 +55,14 @@ buy_it(void)
}
mpos = 0;
if (curprice > purse) {
msg("You can't afford to buy that %s !",curpurch);
if (!strncmp(curpurch, "a ", 2))
msg("You can't afford to buy that %s!", curpurch + 2);
else if (!strncmp(curpurch, "an ", 3))
msg("You can't afford to buy that %s!", curpurch + 3);
else if (isdigit(curpurch[0]))
msg("You can't afford to buy those %s!", curpurch);
else
msg("You can't afford to buy that %s!", curpurch);
return;
}
/*