groundwork for an interface change

Add a new window-port interface function
     perminvent_info *
     update_invent_slot(winid window, int slot, perminvent_info *);

That should be nice and flexible and allow exchanges of useful
information between the core and the window port. Information
to be exchange can be easily modified in include/wintype.h as
things evolve.

Information useful to the core can be exchanged from the
window-port in struct to_core.

Information useful from the core to the window-port can be
passed in struct from_core.

I'm not going to update any docs until much later after things
are fully working and settled.

This also doesn't fix or have anything to do with existing
TTY_PERM_INVENT issues.
This commit is contained in:
nhmall
2022-06-23 14:01:35 -04:00
parent da3c5dfe87
commit 736e9f14f8
17 changed files with 196 additions and 24 deletions

View File

@@ -450,7 +450,6 @@ extern void X11_add_menu(winid, const glyph_info *, const ANY_P *, char,
char, int, const char *, unsigned int);
extern void X11_end_menu(winid, const char *);
extern int X11_select_menu(winid, int, MENU_ITEM_P **);
extern void X11_update_inventory(int);
extern void X11_mark_synch(void);
extern void X11_wait_synch(void);
#ifdef CLIPPING
@@ -487,5 +486,7 @@ extern void genl_outrip(winid, int, time_t);
#endif
extern void X11_preference_update(const char *);
extern void X11_update_inventory(int);
extern perminvent_info *X11_update_invent_slot(winid, int, perminvent_info *);
#endif /* WINX_H */

View File

@@ -89,7 +89,6 @@ extern void curses_add_menu(winid wid, const glyph_info *,
const char *str, unsigned int itemflags);
extern void curses_end_menu(winid wid, const char *prompt);
extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected);
extern void curses_update_inventory(int);
extern void curses_mark_synch(void);
extern void curses_wait_synch(void);
extern void curses_cliparound(int x, int y);
@@ -113,6 +112,8 @@ extern void curses_outrip(winid wid, int how, time_t when);
extern void genl_outrip(winid tmpwin, int how, time_t when);
extern void curses_preference_update(const char *pref);
extern void curs_reset_windows(boolean, boolean);
extern void curses_update_inventory(int);
extern perminvent_info *curses_update_invent_slot(winid, int, perminvent_info *);
/* curswins.c */

View File

@@ -37,7 +37,6 @@ struct window_procs {
void (*win_end_menu)(winid, const char *);
int (*win_select_menu)(winid, int, MENU_ITEM_P **);
char (*win_message_menu)(char, int, const char *);
void (*win_update_inventory)(int);
void (*win_mark_synch)(void);
void (*win_wait_synch)(void);
#ifdef CLIPPING
@@ -83,6 +82,8 @@ struct window_procs {
void (*win_status_update)(int, genericptr_t, int, int, int,
unsigned long *);
boolean (*win_can_suspend)(void);
void (*win_update_inventory)(int);
perminvent_info *(*win_update_invent_slot)(winid, int, perminvent_info *);
};
extern
@@ -164,6 +165,7 @@ extern
*/
#define status_enablefield (*windowprocs.win_status_enablefield)
#define status_update (*windowprocs.win_status_update)
#define update_invent_slot (*windowprocs.win_update_invent_slot)
/*
* WINCAP
@@ -421,7 +423,6 @@ extern void safe_add_menu(winid, const glyph_info *, const ANY_P *,
extern void safe_end_menu(winid, const char *);
extern int safe_select_menu(winid, int, MENU_ITEM_P **);
extern char safe_message_menu(char, int, const char *);
extern void safe_update_inventory(int);
extern void safe_mark_synch(void);
extern void safe_wait_synch(void);
#ifdef CLIPPING
@@ -468,6 +469,8 @@ extern void stdio_raw_print(const char *);
extern void stdio_nonl_raw_print(const char *);
extern void stdio_raw_print_bold(const char *);
extern void stdio_wait_synch(void);
extern void safe_update_inventory(int);
extern perminvent_info *safe_update_invent_slot(winid, int, perminvent_info *);
extern int stdio_nhgetch(void);
#endif /* SAFEPROCS */
#endif /* WINPROCS_H */

View File

@@ -242,7 +242,6 @@ E void tty_add_menu(winid, const glyph_info *, const ANY_P *, char, char,
E void tty_end_menu(winid, const char *);
E int tty_select_menu(winid, int, MENU_ITEM_P **);
E char tty_message_menu(char, int, const char *);
E void tty_update_inventory(int);
E void tty_mark_synch(void);
E void tty_wait_synch(void);
#ifdef CLIPPING
@@ -284,6 +283,8 @@ E void genl_outrip(winid, int, time_t);
E char *tty_getmsghistory(boolean);
E void tty_putmsghistory(const char *, boolean);
E void tty_update_inventory(int);
E perminvent_info *tty_update_invent_slot(winid, int, perminvent_info *);
#ifdef TTY_PERM_INVENT
E void tty_refresh_inventory(int start, int stop, int y);

View File

@@ -162,6 +162,28 @@ typedef struct gi {
#define MENU_BEHAVE_STANDARD 0x0000000U
struct to_core {
boolean active;
boolean use_update_inventory; /* disable the newer slot interface */
int slotcount;
int low_slot_num, high_slot_num;
int max_slot_text;
};
struct from_core {
long piflags;
int slot; /* which inventory slot; 0 means info exchange only */
int invlet;
const char *text; /* the text to display */
};
struct perminvent_info_t {
struct to_core tocore;
struct from_core fromcore;
};
typedef struct perminvent_info_t perminvent_info;
/* clang-format on */
#endif /* WINTYPE_H */