avoid complaints regarding "and" placement
This commit is contained in:
+48
-31
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 version.c $NHDT-Date: 1434446944 2015/06/16 09:29:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
|
/* NetHack 3.6 version.c $NHDT-Date: 1434505027 2015/06/17 01:37:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#define BETA_INFO "Beta2"
|
#define BETA_INFO "Beta2"
|
||||||
|
|
||||||
STATIC_DCL void FDECL(insert_rtoptions, (winid,char *));
|
STATIC_DCL void FDECL(insert_rtoptions, (winid,char *,const char *));
|
||||||
|
|
||||||
/* fill buffer with short version (so caller can avoid including date.h) */
|
/* fill buffer with short version (so caller can avoid including date.h) */
|
||||||
char *
|
char *
|
||||||
@@ -112,13 +112,13 @@ doextversion()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!rtadded) {
|
if (!rtadded) {
|
||||||
pd = eos(buf);
|
const char *catchphrase = ", and basic NetHack features.";
|
||||||
pd--;
|
pd = strstri(buf, catchphrase);
|
||||||
if (*pd == '.' && strlen(buf) > 1) {
|
if (pd) {
|
||||||
insert_rtoptions(win, buf);
|
*pd = '\0';
|
||||||
rtadded = TRUE; /* only do it once */
|
insert_rtoptions(win, buf, &catchphrase[2]);
|
||||||
*buf = 0;
|
rtadded = TRUE; /* only do it once */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*buf)
|
if (*buf)
|
||||||
putstr(win, 0, buf);
|
putstr(win, 0, buf);
|
||||||
@@ -144,42 +144,59 @@ static const char indent[] = " ";
|
|||||||
* game image, so we insert those options here.
|
* game image, so we insert those options here.
|
||||||
*/
|
*/
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
insert_rtoptions(win, buf)
|
insert_rtoptions(win, buf, finalphrase)
|
||||||
winid win;
|
winid win;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
const char *finalphrase;
|
||||||
{
|
{
|
||||||
char rtbuf[BUFSZ];
|
char rtbuf[BUFSZ];
|
||||||
char *pd;
|
int l, i, k;
|
||||||
int l, i = 0;
|
const char *s1 = 0, *s2 = 0, *s3 = 0, *s4 = 0;
|
||||||
|
|
||||||
if (strlen(buf) >= BUFSZ - 3)
|
if ((int)strlen(buf) >= (BUFSZ - 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strcpy(rtbuf, buf);
|
strcpy(rtbuf, buf);
|
||||||
pd = eos(rtbuf);
|
k = SIZE(rt_opts) + 1;
|
||||||
pd--;
|
|
||||||
if (*pd == '.')
|
|
||||||
*pd = 0;
|
|
||||||
Strcat(rtbuf, ", ");
|
|
||||||
l = strlen(rtbuf);
|
|
||||||
|
|
||||||
for (i = 0; i < SIZE(rt_opts); i++) {
|
for (i = 0; i < (SIZE(rt_opts) + 1); i += 2) {
|
||||||
if (l + strlen(rt_opts[i]) > COLNO - 5) {
|
if (i < SIZE(rt_opts)) {
|
||||||
putstr(win, 0, rtbuf);
|
s1 = ", ";
|
||||||
if (strlen(rt_opts[i]) < BUFSZ - (1 + strlen(indent))) {
|
s2 = rt_opts[i];
|
||||||
Strcpy(rtbuf, indent);
|
s3 = " ";
|
||||||
}
|
s4 = rt_opts[i+1];
|
||||||
|
} else {
|
||||||
|
s1 = " ";
|
||||||
|
s2 = finalphrase;
|
||||||
|
s3 = "";
|
||||||
|
s4 = "";
|
||||||
}
|
}
|
||||||
Strcat(rtbuf, rt_opts[i]);
|
l = (int)strlen(rtbuf) + (int)strlen(s1) + (int)strlen(s2) +
|
||||||
l = strlen(rtbuf);
|
(int)strlen(s3) + (int)strlen(s4) + 1;
|
||||||
if (i % 2)
|
if (l <= (COLNO - 5) && l < (BUFSZ-1)) {
|
||||||
Strcat(rtbuf, (i < SIZE(rt_opts)- 1) ? "," : "."), l++;
|
Strcat(rtbuf, s1);
|
||||||
else
|
Strcat(rtbuf, s2);
|
||||||
Strcat(rtbuf, " "), l++;
|
Strcat(rtbuf, s3);
|
||||||
|
Strcat(rtbuf, s4);
|
||||||
|
} else {
|
||||||
|
putstr(win, 0, rtbuf);
|
||||||
|
if (i >= SIZE(rt_opts))
|
||||||
|
s1 = "";
|
||||||
|
l = (int)strlen(indent) + (int)strlen(s1) + (int)strlen(s2) +
|
||||||
|
(int)strlen(s3) + (int)strlen(s4) + 1;
|
||||||
|
if (l <= (COLNO -5) && l < (BUFSZ-1)) {
|
||||||
|
Strcpy(rtbuf, indent);
|
||||||
|
Strcat(rtbuf, s1);
|
||||||
|
Strcat(rtbuf, s2);
|
||||||
|
Strcat(rtbuf, s3);
|
||||||
|
Strcat(rtbuf, s4);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l)
|
if (l)
|
||||||
putstr(win, 0, rtbuf);
|
putstr(win, 0, rtbuf);
|
||||||
|
*buf = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MICRO
|
#ifdef MICRO
|
||||||
|
|||||||
Reference in New Issue
Block a user