# HG changeset patch
# User John "Elwin" Edwards
# Date 1635121581 14400
# Node ID ad2570b5b21fd0ae692758d5708ada0a517cec35
# Parent  2f0eb38da609d27cb24891f7cd97831a3ff0e5da
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.

diff -r 2f0eb38da609 -r ad2570b5b21f arogue5/trader.c
--- a/arogue5/trader.c	Thu Oct 21 21:00:15 2021 -0400
+++ b/arogue5/trader.c	Sun Oct 24 20:26:21 2021 -0400
@@ -51,7 +51,16 @@
 	}
 	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;
 	}
 	/*
diff -r 2f0eb38da609 -r ad2570b5b21f arogue7/trader.c
--- a/arogue7/trader.c	Thu Oct 21 21:00:15 2021 -0400
+++ b/arogue7/trader.c	Sun Oct 24 20:26:21 2021 -0400
@@ -55,7 +55,14 @@
 	}
 	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;
 	}
 	/*