| | 1 | #ifdef RCSID |
| | 2 | static char RCSid[] = |
| | 3 | "$Header: d:/cvsroot/tads/TADS2/RUNSTAT.C,v 1.2 1999/05/17 02:52:13 MJRoberts Exp $"; |
| | 4 | #endif |
| | 5 | |
| | 6 | /* |
| | 7 | * Copyright (c) 1992, 2002 Michael J. Roberts. All Rights Reserved. |
| | 8 | * |
| | 9 | * Please see the accompanying license file, LICENSE.TXT, for information |
| | 10 | * on using and copying this software. |
| | 11 | */ |
| | 12 | /* |
| | 13 | Name |
| | 14 | runstat.c - tads 1 compatible runstat() |
| | 15 | Function |
| | 16 | generates status line |
| | 17 | Notes |
| | 18 | none |
| | 19 | Modified |
| | 20 | 04/04/92 MJRoberts - creation |
| | 21 | */ |
| | 22 | |
| | 23 | #include "os.h" |
| | 24 | #include "std.h" |
| | 25 | #include "mcm.h" |
| | 26 | #include "obj.h" |
| | 27 | #include "run.h" |
| | 28 | #include "tio.h" |
| | 29 | #include "voc.h" |
| | 30 | #include "dat.h" |
| | 31 | |
| | 32 | static runcxdef *runctx; |
| | 33 | static voccxdef *vocctx; |
| | 34 | static tiocxdef *tioctx; |
| | 35 | |
| | 36 | void runstat(void) |
| | 37 | { |
| | 38 | objnum locobj; |
| | 39 | int savemoremode; |
| | 40 | |
| | 41 | /* get the location of the Me object */ |
| | 42 | runppr(runctx, vocctx->voccxme, PRP_LOCATION, 0); |
| | 43 | |
| | 44 | /* if that's no an object, there's nothing we can do */ |
| | 45 | if (runtostyp(runctx) != DAT_OBJECT) |
| | 46 | { |
| | 47 | rundisc(runctx); |
| | 48 | return; |
| | 49 | } |
| | 50 | |
| | 51 | /* get Me.location */ |
| | 52 | locobj = runpopobj(runctx); |
| | 53 | |
| | 54 | /* flush any pending output */ |
| | 55 | outflushn(0); |
| | 56 | |
| | 57 | /* switch to output display mode 1 (status line) */ |
| | 58 | os_status(1); |
| | 59 | |
| | 60 | /* turn off MORE mode */ |
| | 61 | savemoremode = setmore(0); |
| | 62 | |
| | 63 | /* call the statusLine method of the current room */ |
| | 64 | runppr(runctx, locobj, PRP_STATUSLINE, 0); |
| | 65 | |
| | 66 | /* if we're in the status line, make sure the line gets flushed */ |
| | 67 | if (os_get_status() != 0) |
| | 68 | tioputs(tioctx, "\\n"); |
| | 69 | outflushn(0); |
| | 70 | |
| | 71 | /* restore the previous MORE mode */ |
| | 72 | setmore(savemoremode); |
| | 73 | |
| | 74 | /* switch to output display mode 0 (main text area) */ |
| | 75 | os_status(0); |
| | 76 | } |
| | 77 | |
| | 78 | void runistat(voccxdef *vctx, runcxdef *rctx, tiocxdef *tctx) |
| | 79 | { |
| | 80 | runctx = rctx; |
| | 81 | vocctx = vctx; |
| | 82 | tioctx = tctx; |
| | 83 | } |
| | 84 | |