1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-11-03 17:27:29 -05:00
Commit Graph

58 Commits

Author SHA1 Message Date
John Zaitseff
665605d144 Add convenience functions left(), center() and right() 2011-08-15 21:04:07 +10:00
John Zaitseff
a6c362d2e8 Rename pr_left, pr_center and pr_right to leftch, centerch and rightch 2011-08-15 19:46:26 +10:00
John Zaitseff
907a995b98 Refactor function names; "old_" functions will be removed
Rename prepstr, vprepstr, chbufdup, center, center2, center3 and attrpr
to mkchstr, vmkchstr, chstrdup, old_center, old_center2, old_center3 and
old_attrpr respectively.
2011-08-15 19:12:26 +10:00
John Zaitseff
3ad62688da Do parse of format string in prepstr_parse(); add the "%c" specifier 2011-08-15 15:53:56 +10:00
John Zaitseff
746155078b Continue to move text output to the new interfaces 2011-08-15 10:08:44 +10:00
John Zaitseff
c50b8a4649 Move error handling into vprepstr(), to save doing it over and over 2011-08-13 08:17:30 +10:00
John Zaitseff
06b66716cf Add the function chbufdup() to duplicate a chtype array 2011-08-13 07:59:20 +10:00
John Zaitseff
7d9bf097b9 Replace discrete calls to newtxwin() etc. with calls to txdlgbox() 2011-08-12 18:24:35 +10:00
John Zaitseff
184c07d19d Add a comment about multibyte character handling in prepstr() 2011-08-12 16:35:13 +10:00
John Zaitseff
15f06bdc79 Move some functions from center() to pr_center() 2011-08-12 16:32:32 +10:00
John Zaitseff
6594ff3daa Add the function txdlgbox() to display a dialog box 2011-08-12 16:02:01 +10:00
John Zaitseff
4e7699f192 Add vprepstr() with a va_list argument: for the future txdlgbox() 2011-08-12 15:10:05 +10:00
John Zaitseff
2612eddf3d Add functions prepstr(), pr_left(), pr_center() and pr_right()
These functions allow multiple lines to be printed left-aligned, centered
or right-aligned, with automatic line-wrapping where needed.
2011-08-12 14:28:15 +10:00
John Zaitseff
3984468894 Handle KEY_RESIZE events (where defined) in a simple manner
Unfortunately, the implementation of Curses (even Ncurses) requires that
to truely handle resizing, one must destroy and recreate every window
(and, of course, repaint it)--a lot of work that is not done at this
time.
2011-08-10 01:27:11 +10:00
John Zaitseff
040e1a5ad6 Rework the signal handler
Rework the signal handler to be somewhat more unsafe, but conceptually
cleaner, in operation.  It now ends the use of Curses, then reraises the
signal.  Remove almost all references to abort_game.
2011-08-09 23:20:56 +10:00
John Zaitseff
bbdae69de4 Add a signal handler for SIGINT and SIGTERM
Add a signal handler for SIGINT and SIGTERM, as well as sprinklings of
checks to abort_game.  Although Ncurses DOES define handlers for SIGINT
and SIGTERM, they do not always seem to work correctly under many
operating systems.
2011-08-08 20:47:52 +10:00
John Zaitseff
961e989bd7 Replace the WCENTER(x) macro with WCENTER; refactor newtxwin() to suit 2011-07-23 10:16:03 +10:00
John Zaitseff
fc60a9fef1 Rework the handling of character renditions
Rather than querying use_color each and every time a rendition is used,
do it once in init_screen(), assigning the renditions to global
variables.
2011-07-23 09:47:13 +10:00
John Zaitseff
1ac4d28c21 Document and clean up functions in intf.c
Document gettxline(), gettxstr() (formerly gettxstring()), gettxdouble()
and gettxlong().
2011-07-21 21:40:54 +10:00
John Zaitseff
1408a2ab3d Allow a second default key, ";" as well as "=", to help touch-typists! 2011-07-21 13:16:42 +10:00
John Zaitseff
ee992fa02a Move printing a prompt into answer_yesno(); document wait_for_key() 2011-07-21 13:10:51 +10:00
John Zaitseff
eac09fecb5 Move function descriptions to the intf.h header file
Also change the types of character rendition (attributes) variables from
int to chtype; add restrict where suitable and rewrite parts of the
functions to use getattrs().
2011-07-21 12:29:13 +10:00
John Zaitseff
a9f52e89be Move function comments from source to header files where they belong 2011-07-20 22:41:56 +10:00
John Zaitseff
9f02f8e77f Rename character renditions (attributes) to something more regular 2011-07-20 17:01:25 +10:00
John Zaitseff
6a9af29c31 Rearrange some lines in intf.h; add additional comments 2011-07-20 16:12:02 +10:00
John Zaitseff
46c7a55203 Remove LINE_OFFSET and COL_OFFSET; rename COL_CENTER to WCENTER 2011-07-20 15:53:53 +10:00
John Zaitseff
c6007be5aa Move background setting and box drawing into newtxwin()
Setting the background and drawing a box is almost always the first thing
done after window creation.
2011-07-20 11:41:46 +10:00
John Zaitseff
c19feab652 Clean up various comments, etc, in header files 2011-07-19 20:32:00 +10:00
John Zaitseff
dc14a0e633 Implement the gettxlong() function to input an integer 2011-07-19 14:15:33 +10:00
John Zaitseff
8b504b645d Implement the gettxdouble() function to input a floating point number 2011-07-19 00:37:10 +10:00
John Zaitseff
937fea4ccb Make company letters stand out more on the map in --no-color mode 2011-07-18 20:55:47 +10:00
John Zaitseff
a75ec7479d Add center3(): centre three strings 2011-07-16 15:47:05 +10:00
John Zaitseff
b39a1a7567 Redefine CURS_ON to be CURS_NORMAL as this works better with xterm
If "-bc" (flash cursor) is passed to xterm, CURS_VISIBLE will stop it
from flashing--not the intended effect.  CURS_NORMAL will continue to
make the cursor flash with the "-bc" option.
2011-07-15 21:35:51 +10:00
John Zaitseff
4cca36441a Implement the show_status() and total_value() functions 2011-07-15 17:46:57 +10:00
John Zaitseff
34c787cc30 Correct some bugs in center(); add the center2() function 2011-07-15 14:55:56 +10:00
John Zaitseff
ab9a9359e2 Implement the show_map() function that displays the galaxy map 2011-07-15 11:19:14 +10:00
John Zaitseff
09d4455c3e Add window attributes for the galaxy map 2011-07-14 15:16:04 +10:00
John Zaitseff
c5eda1eaab Add code to the load_game() function
The load_game() function now checks for errors while opening the game
file.
2011-07-11 18:07:51 +10:00
John Zaitseff
89c3512a1b Modify the wait_for_key() routine to take a window attribute parameter 2011-07-11 17:57:52 +10:00
John Zaitseff
2a3ed550ad Remove the clrline parameter from the center() function 2011-07-11 15:56:01 +10:00
John Zaitseff
4a555235c9 Add the attr parameter to the center() function 2011-07-11 15:45:38 +10:00
John Zaitseff
20f6f6e73a Add the wait_for_key() function 2011-07-11 14:43:16 +10:00
John Zaitseff
5055ea57ac Rename get_yn_answer() to answer_yesno() 2011-07-11 14:23:16 +10:00
John Zaitseff
019734c8aa Rename the function getanswer() to get_yn_answer() 2011-07-11 13:37:48 +10:00
John Zaitseff
36a3811cd1 Add the gettxstring() function 2011-07-11 13:18:26 +10:00
John Zaitseff
60ab28c711 Add the modified status variable to gettxline()
Also correct a bug in gettxline() that always returned OK!
2011-07-11 12:28:13 +10:00
John Zaitseff
42e05ee20b Replace individual colour/window attributes with ATTR_ macros 2011-07-11 11:40:52 +10:00
John Zaitseff
dd281f795b Add gettxline() to read a line of input from the keyboard 2011-07-11 10:31:19 +10:00
John Zaitseff
1995a6a7b0 Remove the superfluous argument attr_end from attrpr()
Instead of using attr_end, simply restore the old window attributes after
printing the string.
2011-07-11 08:01:18 +10:00
John Zaitseff
ad4ed4d744 Add input routines gettxchar() and getanswer(); add various macros
In particular, add macros for KEY_TAB, KEY_RETURN and KEY_ESC, and for
CURS_ON and CURS_OFF (instead of using CURS_INVISIBLE and CURS_VISIBLE
directly: this allows redefining CURS_ON to be CURS_NORMAL).  Add more
colour pairs.
2011-07-04 22:02:01 +10:00