Fix lua quest data output types

...so the texts are given exactly the same way as they were given previously.
This commit is contained in:
Pasi Kallinen
2019-11-25 09:21:34 +02:00
parent 88324a38d1
commit b66bcc2f5a
2 changed files with 34 additions and 21 deletions

View File

@@ -141,6 +141,7 @@ of us all: Go bravely with %d!]],
essential in locating the Amulet of Yendor."]], essential in locating the Amulet of Yendor."]],
}, },
quest_portal = { quest_portal = {
output = "pline",
text = [[You receive a faint telepathic message from %l: text = [[You receive a faint telepathic message from %l:
Your help is urgently needed at %H! Your help is urgently needed at %H!
Look for a ...ic transporter. Look for a ...ic transporter.
@@ -215,7 +216,7 @@ taught you."]],
}, },
firsttime = { firsttime = {
synopsis = "[You arrive at %H, but all is not well.]", synopsis = "[You arrive at %H, but all is not well.]",
output = "menu", output = "text",
text = [[You are suddenly in familiar surroundings. The buildings in the distance text = [[You are suddenly in familiar surroundings. The buildings in the distance
seem to be those of your old alma mater, but something is wrong. It feels seem to be those of your old alma mater, but something is wrong. It feels
as if there has been a riot recently, or %H has as if there has been a riot recently, or %H has
@@ -441,7 +442,7 @@ defeat %ni."]],
}, },
firsttime = { firsttime = {
synopsis = "[You reach the vicinity of %H, but sense evil magic nearby.]", synopsis = "[You reach the vicinity of %H, but sense evil magic nearby.]",
output = "menu", output = "text",
text = [[Warily you scan your surroundings, all of your senses alert for signs text = [[Warily you scan your surroundings, all of your senses alert for signs
of possible danger. Off in the distance, you can %x the familiar shapes of possible danger. Off in the distance, you can %x the familiar shapes
of %H. of %H.
@@ -679,7 +680,7 @@ a difficult quest as that I propose to give you.
}, },
firsttime = { firsttime = {
synopsis = "[You arrive back at %H, but something is wrong here.]", synopsis = "[You arrive back at %H, but something is wrong here.]",
output = "menu", output = "text",
text = [[You descend through a barely familiar stairwell that you remember text = [[You descend through a barely familiar stairwell that you remember
%l showing you when you embarked upon your vision quest. %l showing you when you embarked upon your vision quest.
@@ -900,7 +901,7 @@ with good conscience.
}, },
firsttime = { firsttime = {
synopsis = "[You arrive back at %H and must find %l.]", synopsis = "[You arrive back at %H and must find %l.]",
output = "menu", output = "text",
text = [[What sorcery has brought you back to %H? The smell text = [[What sorcery has brought you back to %H? The smell
of fresh funeral pyres tells you that something is amiss with the healing of fresh funeral pyres tells you that something is amiss with the healing
powers that used to practice here. powers that used to practice here.
@@ -1137,7 +1138,7 @@ Our presence when thou hast attained the noble title of %R."]],
}, },
firsttime = { firsttime = {
synopsis = "[Signs of battle include long gouges in the walls of %H.]", synopsis = "[Signs of battle include long gouges in the walls of %H.]",
output = "menu", output = "text",
text = [[You materialize in the shadows of %H. Immediately, you notice text = [[You materialize in the shadows of %H. Immediately, you notice
that something is wrong. The fields around the castle are trampled and that something is wrong. The fields around the castle are trampled and
withered, as if some great battle has been recently fought. withered, as if some great battle has been recently fought.
@@ -1347,7 +1348,7 @@ return when you have attained the post of %R."]],
}, },
firsttime = { firsttime = {
synopsis = "[You have reached %H but something is wrong. %lC needs your aid.]", synopsis = "[You have reached %H but something is wrong. %lC needs your aid.]",
output = "menu", output = "text",
text = [[You find yourself standing in sight of %H. text = [[You find yourself standing in sight of %H.
Something is obviously wrong here. Strange shapes lumber around Something is obviously wrong here. Strange shapes lumber around
outside %H! outside %H!
@@ -1560,7 +1561,7 @@ when you have attained the post of %R."]],
}, },
firsttime = { firsttime = {
synopsis = "[You are at %H; the doors are closed. %lC needs your help!]", synopsis = "[You are at %H; the doors are closed. %lC needs your help!]",
output = "menu", output = "text",
text = [[You find yourself standing in sight of %H. Something text = [[You find yourself standing in sight of %H. Something
is obviously wrong here. The doors to %H, which usually is obviously wrong here. The doors to %H, which usually
stand open, are closed. Strange human shapes shamble around stand open, are closed. Strange human shapes shamble around
@@ -1783,7 +1784,7 @@ which we need you to do. %RA might just be able to do this thing.
}, },
firsttime = { firsttime = {
synopsis = "[The ancient forest grove is surrounded by centaurs.]", synopsis = "[The ancient forest grove is surrounded by centaurs.]",
output = "menu", output = "text",
text = [[You arrive in familiar surroundings. In the distance, you %x the text = [[You arrive in familiar surroundings. In the distance, you %x the
ancient forest grove, the place of worship to %d. ancient forest grove, the place of worship to %d.
@@ -2003,7 +2004,7 @@ leave you, %p? Oh yeah, I remember, I was going to kill you!"]],
}, },
firsttime = { firsttime = {
synopsis = "[You are in Ransmannsby, where you trained. Find %l.]", synopsis = "[You are in Ransmannsby, where you trained. Find %l.]",
output = "menu", output = "text",
text = [[Unexpectedly, you find yourself back in Ransmannsby, where you trained to text = [[Unexpectedly, you find yourself back in Ransmannsby, where you trained to
be a thief. Quickly you make the guild sign, hoping that you AND word be a thief. Quickly you make the guild sign, hoping that you AND word
of your arrival reach %ls den.]], of your arrival reach %ls den.]],
@@ -2219,7 +2220,7 @@ are ready, return to me."]],
}, },
firsttime = { firsttime = {
synopsis = "[The banner of %n flies above town. What has happened to %l?]", synopsis = "[The banner of %n flies above town. What has happened to %l?]",
output = "menu", output = "text",
text = [[Even before your senses adjust, you recognize the kami of text = [[Even before your senses adjust, you recognize the kami of
%H. %H.
@@ -2451,7 +2452,7 @@ you will be ready.
}, },
firsttime = { firsttime = {
synopsis = "[You find yourself back at %H, but the quiet is ominous.]", synopsis = "[You find yourself back at %H, but the quiet is ominous.]",
output = "menu", output = "text",
text = [[You breathe a sigh of relief as you find yourself back in the familiar text = [[You breathe a sigh of relief as you find yourself back in the familiar
surroundings of %H. surroundings of %H.
@@ -2672,7 +2673,7 @@ Only when you have returned %Ra will you be able to defeat %n."]],
}, },
firsttime = { firsttime = {
synopsis = "[You arrive below %H. Something is wrong; there is lava present.]", synopsis = "[You arrive below %H. Something is wrong; there is lava present.]",
output = "menu", output = "text",
text = [[You materialize at the base of a snowy hill. Atop the hill sits text = [[You materialize at the base of a snowy hill. Atop the hill sits
a place you know well, %H. You immediately realize a place you know well, %H. You immediately realize
that something here is very wrong! that something here is very wrong!
@@ -2889,7 +2890,7 @@ renown as %Ra."]],
}, },
firsttime = { firsttime = {
synopsis = "[You have arrived at %ls tower but something is very wrong.]", synopsis = "[You have arrived at %ls tower but something is very wrong.]",
output = "menu", output = "text",
text = [[You are suddenly in familiar surroundings. You notice what appears to text = [[You are suddenly in familiar surroundings. You notice what appears to
be a large, squat stone structure nearby. Wait! That looks like the be a large, squat stone structure nearby. Wait! That looks like the
tower of your former teacher, %l. tower of your former teacher, %l.

View File

@@ -395,11 +395,23 @@ static void
deliver_by_pline(str) deliver_by_pline(str)
const char *str; const char *str;
{ {
const char *msgp = str;
const char *msgend = eos((char *)str);
char in_line[BUFSZ], out_line[BUFSZ]; char in_line[BUFSZ], out_line[BUFSZ];
Strcpy(in_line, str); while (msgp && msgp != msgend) {
convert_line(in_line, out_line); int i = 0;
pline("%s", out_line); while (*msgp != '\0' && *msgp != '\n' && (i < BUFSZ-2)) {
in_line[i] = *msgp;
i++;
msgp++;
}
if (*msgp == '\n')
msgp++;
in_line[i] = '\0';
convert_line(in_line, out_line);
pline("%s", out_line);
}
} }
static void static void
@@ -445,8 +457,8 @@ com_pager_core(section, msgid)
const char *section; const char *section;
const char *msgid; const char *msgid;
{ {
const char *const howtoput[] = { "pline", "window", "menu", NULL }; const char *const howtoput[] = { "pline", "window", "text", "menu", "default", NULL };
const int howtoput2i[] = { 1, 2, 3, 0 }; const int howtoput2i[] = { 1, 2, 2, 3, 0, 0 };
int output; int output;
lua_State *L; lua_State *L;
char *synopsis; char *synopsis;
@@ -487,7 +499,7 @@ const char *msgid;
synopsis = get_table_str_opt(L, "synopsis", NULL); synopsis = get_table_str_opt(L, "synopsis", NULL);
text = get_table_str_opt(L, "text", NULL); text = get_table_str_opt(L, "text", NULL);
output = howtoput2i[get_table_option(L, "output", "pline", howtoput)]; output = howtoput2i[get_table_option(L, "output", "default", howtoput)];
if (!synopsis && !text) { if (!synopsis && !text) {
int nelems; int nelems;
@@ -505,10 +517,10 @@ const char *msgid;
text = dupstr(luaL_checkstring(L, -1)); text = dupstr(luaL_checkstring(L, -1));
} }
if ((index(text, '\n') || (strlen(text) >= (BUFSZ - 1))) && output == 1) if (output == 0 && (index(text, '\n') || (strlen(text) >= (BUFSZ - 1))))
output = 2; output = 2;
if (output == 1) if (output == 0 || output == 1)
deliver_by_pline(text); deliver_by_pline(text);
else if (output == 3) else if (output == 3)
deliver_by_window(text, NHW_MENU); deliver_by_window(text, NHW_MENU);