more updates

Changes to be committed:
	modified:   include/botl.h
	modified:   src/botl.c
	modified:   src/windows.c
	modified:   win/tty/wintty.c
This commit is contained in:
nhmall
2015-05-31 15:18:59 -04:00
parent 4bb21a08f2
commit 40f1dc8bc3
4 changed files with 38 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.h $NHDT-Date: 1433082340 2015/05/31 14:25:40 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.12 $ */ /* NetHack 3.6 botl.h $NHDT-Date: 1433099923 2015/05/31 19:18:43 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.13 $ */
/* Copyright (c) Michael Allison, 2003 */ /* Copyright (c) Michael Allison, 2003 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -22,7 +22,7 @@
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
#if 0 #if 0
/* clang-format off */ /* clang-format off */
#define BL_BOGUS -1 #define BL_FLUSH -1
#define BL_TITLE 0 #define BL_TITLE 0
#define BL_STR 1 #define BL_STR 1
#define BL_DX 2 #define BL_DX 2
@@ -47,12 +47,12 @@
#define BL_EXP 21 #define BL_EXP 21
#define BL_CONDITION 22 #define BL_CONDITION 22
/* clang-format on */ /* clang-format on */
#else #else
enum statusfields { BL_BOGUS = -1, BL_TITLE = 0, BL_STR, BL_DX, BL_CO, BL_IN, enum statusfields { BL_FLUSH = -1, BL_TITLE = 0, BL_STR, BL_DX, BL_CO, BL_IN,
BL_WI, BL_CH, BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX, BL_WI, BL_CH, BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX,
BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_LEVELDESC, BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_LEVELDESC,
BL_EXP, BL_CONDITION }; BL_EXP, BL_CONDITION };
#define BL_FLUSH BL_BOGUS
#define MAXBLSTATS BL_CONDITION+1 #define MAXBLSTATS BL_CONDITION+1
#define BEFORE 0 #define BEFORE 0

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.c $NHDT-Date: 1433097925 2015/05/31 18:45:25 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.57 $ */ /* NetHack 3.6 botl.c $NHDT-Date: 1433099909 2015/05/31 19:18:29 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.58 $ */
/* 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. */
@@ -10,8 +10,7 @@ extern const char *hu_stat[]; /* defined in eat.c */
const char *const enc_stat[] = { "", "Burdened", "Stressed", const char *const enc_stat[] = { "", "Burdened", "Stressed",
"Strained", "Overtaxed", "Overloaded" }; "Strained", "Overtaxed", "Overloaded" };
STATIC_OVL NEARDATA int mrank_sz = STATIC_OVL NEARDATA int mrank_sz = 0; /* loaded by max_rank_sz (from u_init) */
0; /* loaded by max_rank_sz (from u_init) */
STATIC_DCL const char *NDECL(rank); STATIC_DCL const char *NDECL(rank);
#ifndef STATUS_VIA_WINDOWPORT #ifndef STATUS_VIA_WINDOWPORT
@@ -286,18 +285,30 @@ char *buf;
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
/* =======================================================================*/ /* =======================================================================*/
STATIC_DCL void NDECL(init_blstats);
STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int));
STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int));
STATIC_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *));
STATIC_OVL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *));
#ifdef STATUS_HILITES
STATIC_DCL boolean FDECL(assign_hilite, (char *, char *, char *, char *, BOOLEAN_P));
STATIC_DCL const char *FDECL(clridx_to_s, (char *, int));
#endif
/* structure that tracks the status details in the core */
struct istat_s { struct istat_s {
long time; long time;
unsigned anytype; unsigned anytype;
anything a; anything a;
char *val; char *val;
int valwidth; int valwidth;
int idxmax; enum statusfields idxmax;
enum statusfields fld; enum statusfields fld;
}; };
/* If entries are added to this, botl.h will require updating too */ /* If entries are added to this, botl.h will require updating too */
struct istat_s initblstats[MAXBLSTATS] = { STATIC_DCL struct istat_s initblstats[MAXBLSTATS] = {
{ 0L, ANY_STR, {(genericptr_t)0L}, (char *)0, 80, 0, BL_TITLE}, { 0L, ANY_STR, {(genericptr_t)0L}, (char *)0, 80, 0, BL_TITLE},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_STR}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_STR},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_DX}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_DX},
@@ -309,14 +320,14 @@ struct istat_s initblstats[MAXBLSTATS] = {
{ 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_SCORE}, { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_SCORE},
{ 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_CAP}, { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_CAP},
{ 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 30, 0, BL_GOLD}, { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 30, 0, BL_GOLD},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_ENE}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, BL_ENEMAX, BL_ENE},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_ENEMAX}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_ENEMAX},
{ 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 10, 0, BL_XP}, { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 10, 0, BL_XP},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_AC}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_AC},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_HD}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_HD},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 20, 0, BL_TIME}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 20, 0, BL_TIME},
{ 0L, ANY_UINT, {(genericptr_t)0L}, (char *)0, 40, 0, BL_HUNGER}, { 0L, ANY_UINT, {(genericptr_t)0L}, (char *)0, 40, 0, BL_HUNGER},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_HP}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, BL_HPMAX, BL_HP},
{ 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_HPMAX}, { 0L, ANY_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_HPMAX},
{ 0L, ANY_STR, {(genericptr_t)0L}, (char *)0, 80, 0, BL_LEVELDESC}, { 0L, ANY_STR, {(genericptr_t)0L}, (char *)0, 80, 0, BL_LEVELDESC},
{ 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_EXP}, { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_EXP},
@@ -352,22 +363,9 @@ static struct fieldid_t {
{"condition", BL_CONDITION}, {"condition", BL_CONDITION},
}; };
struct istat_s blstats[2][MAXBLSTATS]; struct istat_s blstats[2][MAXBLSTATS];
static boolean blinit = FALSE, update_all = FALSE; static boolean blinit = FALSE, update_all = FALSE;
STATIC_DCL void NDECL(init_blstats);
STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int));
STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int));
STATIC_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *));
STATIC_OVL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *));
#ifdef STATUS_HILITES
STATIC_DCL boolean FDECL(assign_hilite, (char *, char *, char *, char *, BOOLEAN_P));
STATIC_DCL const char *FDECL(clridx_to_s, (char *, int));
#endif
void void
bot() bot()
{ {
@@ -612,10 +610,10 @@ bot()
* text display obliterates the status line. * text display obliterates the status line.
* *
* To work around it, we call status_update() with ficticious * To work around it, we call status_update() with ficticious
* index of BL_BOGUS (-1). * index of BL_FLUSH (-1).
*/ */
if (context.botlx && !updated) if (context.botlx && !updated)
status_update(BL_BOGUS, (genericptr_t) 0, 0, 0); status_update(BL_FLUSH, (genericptr_t) 0, 0, 0);
context.botl = context.botlx = 0; context.botl = context.botlx = 0;
update_all = FALSE; update_all = FALSE;
@@ -762,7 +760,7 @@ boolean
fieldname = "condition"; fieldname = "condition";
status_enablefield(fld, fieldname, fieldfmt, TRUE); status_enablefield(fld, fieldname, fieldfmt, TRUE);
break; break;
case BL_BOGUS: case BL_FLUSH:
default: default:
break; break;
} }
@@ -1129,7 +1127,7 @@ boolean from_configfile;
boolean normal[2] = { 0, 0 }; boolean normal[2] = { 0, 0 };
boolean percent = FALSE, down_up = FALSE, changed = FALSE; boolean percent = FALSE, down_up = FALSE, changed = FALSE;
anything threshold; anything threshold;
enum statusfields fld = BL_BOGUS; enum statusfields fld = BL_FLUSH;
threshold.a_void = 0; threshold.a_void = 0;
/* Example: /* Example:

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 windows.c $NHDT-Date: 1433087641 2015/05/31 15:54:01 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.30 $ */ /* NetHack 3.6 windows.c $NHDT-Date: 1433099917 2015/05/31 19:18:37 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.31 $ */
/* Copyright (c) D. Cohrs, 1993. */ /* Copyright (c) D. Cohrs, 1993. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -863,13 +863,13 @@ genericptr_t ptr;
enum statusfields fieldorder[2][15] = { enum statusfields fieldorder[2][15] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN, { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_BOGUS, BL_BOGUS, BL_BOGUS, BL_BOGUS, BL_BOGUS, BL_BOGUS}, BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH},
{ BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX, { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX,
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER, BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_BOGUS} BL_CAP, BL_CONDITION, BL_FLUSH}
}; };
if (idx != BL_BOGUS) { if (idx != BL_FLUSH) {
if (!activefields[idx]) if (!activefields[idx])
return; return;
switch (idx) { switch (idx) {
@@ -899,13 +899,13 @@ genericptr_t ptr;
/* This genl version updates everything on the display, everytime */ /* This genl version updates everything on the display, everytime */
newbot1[0] = '\0'; newbot1[0] = '\0';
for (i = 0; fieldorder[0][i] != BL_BOGUS; ++i) { for (i = 0; fieldorder[0][i] != BL_FLUSH; ++i) {
int idx1 = fieldorder[0][i]; int idx1 = fieldorder[0][i];
if (activefields[idx1]) if (activefields[idx1])
Strcat(newbot1, vals[idx1]); Strcat(newbot1, vals[idx1]);
} }
newbot2[0] = '\0'; newbot2[0] = '\0';
for (i = 0; fieldorder[1][i] != BL_BOGUS; ++i) { for (i = 0; fieldorder[1][i] != BL_FLUSH; ++i) {
int idx2 = fieldorder[1][i]; int idx2 = fieldorder[1][i];
if (activefields[idx2]) if (activefields[idx2])
Strcat(newbot2, vals[idx2]); Strcat(newbot2, vals[idx2]);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.c $NHDT-Date: 1433082408 2015/05/31 14:26:48 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.95 $ */ /* NetHack 3.6 wintty.c $NHDT-Date: 1433099933 2015/05/31 19:18:53 $ $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.96 $ */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3052,13 +3052,13 @@ genericptr_t ptr;
enum statusfields fieldorder[2][15] = { enum statusfields fieldorder[2][15] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN, { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_BOGUS, BL_BOGUS, BL_BOGUS, BL_BOGUS, BL_BOGUS, BL_BOGUS}, BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH},
{ BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX, { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX,
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER, BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_BOGUS} BL_CAP, BL_CONDITION, BL_FLUSH}
}; };
if (idx != BL_BOGUS) { if (idx != BL_FLUSH) {
if (!activefields[idx]) if (!activefields[idx])
return; return;
switch (idx) { switch (idx) {
@@ -3088,13 +3088,13 @@ genericptr_t ptr;
/* This genl version updates everything on the display, everytime */ /* This genl version updates everything on the display, everytime */
newbot1[0] = '\0'; newbot1[0] = '\0';
for (i = 0; fieldorder[0][i] != BL_BOGUS; ++i) { for (i = 0; fieldorder[0][i] != BL_FLUSH; ++i) {
int idx1 = fieldorder[0][i]; int idx1 = fieldorder[0][i];
if (activefields[idx1]) if (activefields[idx1])
Strcat(newbot1, vals[idx1]); Strcat(newbot1, vals[idx1]);
} }
newbot2[0] = '\0'; newbot2[0] = '\0';
for (i = 0; fieldorder[1][i] != BL_BOGUS; ++i) { for (i = 0; fieldorder[1][i] != BL_FLUSH; ++i) {
int idx2 = fieldorder[1][i]; int idx2 = fieldorder[1][i];
if (activefields[idx2]) if (activefields[idx2])
Strcat(newbot2, vals[idx2]); Strcat(newbot2, vals[idx2]);