1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-12-04 14:46:45 -05:00
Commit Graph

70 Commits

Author SHA1 Message Date
John Zaitseff
10815a2803 Move some global variables to intf.c and intf.h
Move the keycode_company, printable_map_val, chtype_map_val,
keycode_game_move, printable_game_move and chtype_game_move global
variables to intf.c and intf.h.
2011-08-25 14:48:31 +10:00
John Zaitseff
485a867b99 Remove superfluous #include directives 2011-08-25 14:09:48 +10:00
John Zaitseff
20473ae409 Use wide-character functions for input routines and most strings
Convert all input routines, and most internal strings, to use
wide-character functions.  All extended characters are supported,
including those having column widths of zero (eg, combining characters),
one (eg, normal Western characters) and two (eg, many East Asian
characters).  This was quite a major undertaking!
2011-08-25 13:19:31 +10:00
John Zaitseff
b5b211313e Move chstrdup() to utils.c and rename it to xchstrdup()
The new name is for consistency with other XXXdup() functions used in
this program.
2011-08-20 15:17:09 +10:00
John Zaitseff
8a7dfcaf99 Handle multibyte characters correctly in mkchstr()
Internal processing is now done in terms of wide characters (type
wchar_t).
2011-08-19 16:52:27 +10:00
John Zaitseff
4d6f1478e6 Remove the superfluous argument to chstrdup()
This argument is not required: we KNOW that we have initialised chtype
arrays with an ending NUL!
2011-08-18 14:53:03 +10:00
John Zaitseff
c2a3c5ac8f Require Gettext 0.18.1; regularise usage of Ncurses; update version 2011-08-17 19:48:39 +10:00
John Zaitseff
de6a4e3e66 Remove obsolete old_attrpr, old_center, old_center2 and old_center3 2011-08-16 18:51:56 +10:00
John Zaitseff
cf30933614 Continue to rewrite the interface code to use the new interfaces 2011-08-16 18:48:56 +10:00
John Zaitseff
135842b87d Bug fix for non-colour mode
If the background has A_REVERSE, then A_NORMAL will have no effect.  For
that reason, specify A_NORMAL as the default background after creating a
new window.
2011-08-16 16:25:28 +10:00
John Zaitseff
82647cf691 Move to the new left/center/right functions; add maxlines parameter 2011-08-15 23:54:44 +10:00
John Zaitseff
22677c0d89 Handle floating-point numbers in mkchstr(), with optional precision 2011-08-15 23:12:10 +10:00
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