rework TTY_PERM_INVENT; update window port interface

Change the inner workings of the experimental TTY_PERM_INVENT.

Switch to delivering the content to tty for the experimental perm_invent
via the existing window port interface (start_menu(), add_menu(), end_menu).

This also adds a new window port interface call ctrl_nhwindow() for
delivering information to the window port, and/or obtaining specific
information from the window port. The information and requests can
be extended as required. To be documented later once the changes settle
down.

Due to the intrusive nature of these changes and the possibility of
some bugs in the new code, I'm going to leave TTY_PERM_INVENT commented
out in the repository for a day or two.  Anyone wishing to test it out
can do so by uncommenting TTY_PERM_INVENT in config.h.
This commit is contained in:
nhmall
2022-07-03 00:34:08 -04:00
parent 67e80cc329
commit c84e0ba6e1
28 changed files with 602 additions and 616 deletions

View File

@@ -75,7 +75,7 @@ void chainin_status_update(int, genericptr_t, int, int, int,
boolean chainin_can_suspend(void);
void chainin_update_inventory(int);
perminvent_info *chainin_update_invent_slot(winid, int, perminvent_info *);
win_request_info *chainin_ctrl_nhwindow(winid, int, win_request_info *);
void *chainin_procs_chain(int cmd, int n, void *me, void *nextprocs, void *nextdata);
void chainin_procs_init(int dir);
@@ -578,18 +578,16 @@ chainin_can_suspend(void)
return rv;
}
perminvent_info *
chainin_update_invent_slot(
winid window, /* window to use, must be of type NHW_MENU */
int inventory_slot, /* slot id: 0 - info return to core */
/* 1 - gold slot */
/* 2 - 29 obj slots */
perminvent_info *pi)
win_request_info *
chainin_ctrl_nhwindow(
winid window,
int request,
win_request_info *wri)
{
boolean rv;
rv = (*cibase->nprocs->win_update_invent_slot)(cibase->ndata, window,
inventory_slot, pi);
rv = (*cibase->nprocs->win_ctrl_nhwindow)(cibase->ndata, window,
request, wri);
return rv;
}
@@ -639,5 +637,5 @@ struct window_procs chainin_procs = {
chainin_status_update,
chainin_can_suspend,
chainin_update_inventory,
chainin_update_invent_slot,
chainin_ctrl_nhwindow,
};

View File

@@ -75,7 +75,7 @@ void chainout_status_update(void *,int, genericptr_t, int, int, int,
boolean chainout_can_suspend(void *);
void chainout_update_inventory(void *, int);
perminvent_info *chainout_update_invent_slot(void *, winid, int, perminvent_info *);
win_request_info *chainout_ctrl_nhwindow(void *, winid, int, win_request_info *);
void chainout_procs_init(int dir);
void *chainout_procs_chain(int cmd, int n, void *me, void *nextprocs, void *nextdata);
@@ -700,19 +700,17 @@ chainout_can_suspend(void *vp)
return rv;
}
perminvent_info *
chainout_update_invent_slot(
winid window, /* window to use, must be of type NHW_MENU */
int inventory_slot, /* slot id: 0 - info return to core */
/* 1 - gold slot */
/* 2 - 29 obj slots */
perminvent_info *pi)
win_request_info *
chainout_ctrl_nhwindow(
winid window,
int request,
win_request_info *wri)
{
struct chainout_data *tdp = vp;
boolean rv;
rv = (*tdp->nprocs->win_update_invent_slot)(window,
inventory_slot, pi);
rv = (*tdp->nprocs->win_ctrl_nhwindow)(window,
request, wri);
return rv;
}
@@ -763,5 +761,5 @@ struct chain_procs chainout_procs = {
chainout_status_update,
chainout_can_suspend,
chainout_update_inventory,
chainout_update_invent_slot,
chainout_ctrl_nhwindow,
};