From: nhmall Date: Sun, 31 May 2015 19:18:59 +0000 (-0400) Subject: more updates X-Git-Tag: NetHack-3.6.0_RC01~317 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40f1dc8bc373c09afae2e91ca291571326fec69f;p=nethack more updates Changes to be committed: modified: include/botl.h modified: src/botl.c modified: src/windows.c modified: win/tty/wintty.c --- diff --git a/include/botl.h b/include/botl.h index c1de2aa85..8a8645f54 100644 --- a/include/botl.h +++ b/include/botl.h @@ -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 */ /* NetHack may be freely redistributed. See license for details. */ @@ -22,7 +22,7 @@ #ifdef STATUS_VIA_WINDOWPORT #if 0 /* clang-format off */ -#define BL_BOGUS -1 +#define BL_FLUSH -1 #define BL_TITLE 0 #define BL_STR 1 #define BL_DX 2 @@ -47,12 +47,12 @@ #define BL_EXP 21 #define BL_CONDITION 22 /* clang-format on */ + #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_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_LEVELDESC, BL_EXP, BL_CONDITION }; -#define BL_FLUSH BL_BOGUS #define MAXBLSTATS BL_CONDITION+1 #define BEFORE 0 diff --git a/src/botl.c b/src/botl.c index 9938180e7..eacfbfece 100644 --- a/src/botl.c +++ b/src/botl.c @@ -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. */ /* 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", "Strained", "Overtaxed", "Overloaded" }; -STATIC_OVL NEARDATA int mrank_sz = - 0; /* loaded by max_rank_sz (from u_init) */ +STATIC_OVL NEARDATA int mrank_sz = 0; /* loaded by max_rank_sz (from u_init) */ STATIC_DCL const char *NDECL(rank); #ifndef STATUS_VIA_WINDOWPORT @@ -286,18 +285,30 @@ char *buf; #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 { long time; unsigned anytype; anything a; char *val; int valwidth; - int idxmax; + enum statusfields idxmax; enum statusfields fld; }; /* 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_INT, {(genericptr_t)0L}, (char *)0, 10, 0, BL_STR}, { 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_CAP}, { 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_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_HD}, { 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_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_STR, {(genericptr_t)0L}, (char *)0, 80, 0, BL_LEVELDESC}, { 0L, ANY_LONG, {(genericptr_t)0L}, (char *)0, 20, 0, BL_EXP}, @@ -352,22 +363,9 @@ static struct fieldid_t { {"condition", BL_CONDITION}, }; - struct istat_s blstats[2][MAXBLSTATS]; - 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 bot() { @@ -612,10 +610,10 @@ bot() * text display obliterates the status line. * * To work around it, we call status_update() with ficticious - * index of BL_BOGUS (-1). + * index of BL_FLUSH (-1). */ 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; update_all = FALSE; @@ -762,7 +760,7 @@ boolean fieldname = "condition"; status_enablefield(fld, fieldname, fieldfmt, TRUE); break; - case BL_BOGUS: + case BL_FLUSH: default: break; } @@ -1129,7 +1127,7 @@ boolean from_configfile; boolean normal[2] = { 0, 0 }; boolean percent = FALSE, down_up = FALSE, changed = FALSE; anything threshold; - enum statusfields fld = BL_BOGUS; + enum statusfields fld = BL_FLUSH; threshold.a_void = 0; /* Example: diff --git a/src/windows.c b/src/windows.c index d5c5dd95f..878aee673 100644 --- a/src/windows.c +++ b/src/windows.c @@ -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. */ /* NetHack may be freely redistributed. See license for details. */ @@ -863,13 +863,13 @@ genericptr_t ptr; enum statusfields fieldorder[2][15] = { { 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_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]) return; switch (idx) { @@ -899,13 +899,13 @@ genericptr_t ptr; /* This genl version updates everything on the display, everytime */ 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]; if (activefields[idx1]) Strcat(newbot1, vals[idx1]); } 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]; if (activefields[idx2]) Strcat(newbot2, vals[idx2]); diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 6cfb08a57..933545d5b 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -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 */ /* NetHack may be freely redistributed. See license for details. */ @@ -3052,13 +3052,13 @@ genericptr_t ptr; enum statusfields fieldorder[2][15] = { { 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_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]) return; switch (idx) { @@ -3088,13 +3088,13 @@ genericptr_t ptr; /* This genl version updates everything on the display, everytime */ 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]; if (activefields[idx1]) Strcat(newbot1, vals[idx1]); } 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]; if (activefields[idx2]) Strcat(newbot2, vals[idx2]);