John Zaitseff
4b8d2529a8
Replace '0' with L'0', just in case
2011-08-20 15:27:22 +10:00
John Zaitseff
0a8e05f4d4
Rearrange the order of the internal mkchstr_XXX functions
2011-08-20 15:24:27 +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
bc8dc76f00
Minor white-space formatting change: indent by 8 characters, not 7
2011-08-20 13:34:28 +10:00
John Zaitseff
c90265ec28
Replace "---" with "--": it looks better in text mode
2011-08-20 13:30:31 +10:00
John Zaitseff
4d145813ff
Make the show_help() function multibyte-aware
...
All text in the show_help() function is now processed as wide characters.
2011-08-20 13:27:26 +10:00
John Zaitseff
7b544bbd35
Add the functions xwcrtomb() and xmbstowcs()
...
The xwcrtomb() and xmbstowcs() functions replace illegal characters with
EILSEQ_REPL ('?'). Adjust other functions, particularly mkchstr() and
friends, to suit.
2011-08-20 13:03:40 +10:00
John Zaitseff
336611559b
Add the error-checking function xwcsdup()
2011-08-20 10:40:07 +10:00
John Zaitseff
02fd017807
Make the errno_exit() string a little more regular
...
This is to match all other such strings in the program.
2011-08-19 17:34:41 +10:00
John Zaitseff
a49c50b4fd
Allow mkchstr_conv error strings to be localised
2011-08-19 17:24:28 +10:00
John Zaitseff
6fb62460ca
Add some asserts to newtxwin(), just to be on the safe side
2011-08-19 17:20:41 +10:00
John Zaitseff
aeaf08a8a4
Possible bug fix: test for "C" locale when return string is opaque
...
On some systems the return string from setlocale() may be opaque, so we
need to explicitly set the locale to "C", then test the return value from
that.
2011-08-19 17:14:00 +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
3a6f33d2a1
Update some minor comments about character encodings
2011-08-18 15:05:55 +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
ef3e06ed36
Add the wchar and wctype-h modules from the GNU Portability Library
2011-08-18 12:53:23 +10:00
John Zaitseff
6ef7c7b6da
Allow localisation of company letters and map moves (choices)
2011-08-18 12:10:33 +10:00
John Zaitseff
a024ad83e7
Update help text company letter; clarify tilde escapes in general
2011-08-18 09:10:38 +10:00
John Zaitseff
e87c6ce9b3
Allow input keycodes in ask_number_players() to be localised
2011-08-17 22:27:51 +10:00
John Zaitseff
75503ab103
Parameterise answer_yesno() so that the input keycodes can be localised
2011-08-17 22:07:31 +10:00
John Zaitseff
1c4cac2ba1
Add a detailed explanation of the help text markup format
2011-08-17 21:41:38 +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
b674c05d56
Add many comments for translators; use pgettext() where appropriate
2011-08-17 19:13:05 +10:00
John Zaitseff
25d586f775
Add some translator comments regarding company names and ordinals
2011-08-17 13:26:55 +10:00
John Zaitseff
5f5c512e45
Highlight the word "one"
2011-08-17 13:26:11 +10:00
John Zaitseff
197de2804f
Add calls to ngettext() where appropriate
2011-08-17 13:18:41 +10:00
John Zaitseff
9b11599354
Add some translator comments with the correct pronunciation of my name
2011-08-17 12:21:18 +10:00
John Zaitseff
d953154e5d
Mark up strings with xgettext:c-format comments where appropriate
2011-08-17 10:04:57 +10:00
John Zaitseff
0aa74d1f46
Add a space to the "Player %d: " string for consistency
2011-08-16 21:14:56 +10:00
John Zaitseff
6c1c272780
Place all output strings within gettext invocations
2011-08-16 21:03:41 +10:00
John Zaitseff
bf76fa312c
Assume MOD_POSIX_CURRENCY_SYMBOL contains only ASCII characters
...
The GNU library now has "C.UTF-8" as a locale (which is NOT a single-byte
locale!), but we assume the currency symbol in MOD_POSIX_CURRENCY_SYMBOL
contains only ASCII characters.
2011-08-16 20:55:42 +10:00
John Zaitseff
d20cc2b5ec
Use chstr-style output functions in gettxline()
2011-08-16 20:45:47 +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
0c319738a8
Continue to move code to prepstr() and friends
2011-08-15 17:07:00 +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
5bb48fe35f
Add wrapper functions xmalloc() and xstrdup() to do error handling
2011-08-13 08:50:34 +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
b27af38537
Minimise flickering when resizing the console window
2011-08-12 16:09:38 +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
738ffcd69a
Block SIGINT, SIGTERM and SIGQUIT when in the signal handler
2011-08-10 00:30:38 +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
5f995f1d36
Move the initialisation of the game title into its own function
2011-08-09 13:11:22 +10:00
John Zaitseff
8a2bc51f28
Rearrange function prototypes to match the order in the source file
2011-08-09 13:06:21 +10:00
John Zaitseff
4d133cf662
Rework the definition of USE_UTF8_GAME_FILE a little
2011-08-09 12:27: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
32ed55a0cd
Convert strings to UTF-8 if possible during file save and load
2011-08-08 11:15:44 +10:00
John Zaitseff
1e7c6c098a
Add checks for the C.UTF-8 (C.utf8) locale for adding a currency symbol
2011-08-08 10:21:24 +10:00
John Zaitseff
601678313d
As much as I don't like it, change the help string to American spelling
2011-08-01 20:52:40 +10:00
John Zaitseff
c7e1f6096f
Replace PACKAGE_NAME with "Star Traders"
...
The gettext utilities don't like C macros in gettext() invocations, so
replace each occurrence of PACKAGE_NAME with "Star Traders".
2011-08-01 19:49:16 +10:00
John Zaitseff
1ee27fda20
Minor modifications to allow the first pass to compile!
2011-08-01 19:43:55 +10:00
John Zaitseff
9251ca0463
First pass at adding _() and N_() to allow string translation
2011-08-01 19:30:19 +10:00
John Zaitseff
686b3b0e0e
Rearrange order of linked libraries; move definition of LOCALEDIR
2011-08-01 18:59:11 +10:00
John Zaitseff
378b7e64b0
Add preliminary support for GNU gettext internationalisation
2011-08-01 18:17:02 +10:00
John Zaitseff
48e8bbba93
Complete rewrite of the M4 macro that checks for Curses
2011-07-28 21:19:33 +10:00
John Zaitseff
8240043880
Move <stdio.h> to appear before <stdlib.h>
...
This is required on some systems, such as Darwin (MacOS X).
2011-07-26 20:40:33 +10:00
John Zaitseff
e7fee29e5b
Final minor edits of various documentation files
2011-07-25 17:00:59 +10:00
John Zaitseff
fd55a09493
Add support for the Gnulib portability library
...
In particular, the gnulib-tool utility now maintains lib/Makefile.am, as
well as many files in the m4 and lib directories. The file
m4/gnulib-cache.m4 allows the Gnulib files to be refreshed. See
http://www.gnu.org/software/gnulib/ .
2011-07-23 17:19:07 +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
a5feeb2635
Add a call to turn the cursor on--just in case
2011-07-23 10:04:09 +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
6704c358ce
Make compiler quieter about signed and unsigned comparisons
2011-07-22 13:07:14 +10:00
John Zaitseff
27167f0e6f
Finish moving all comments from source files to headers
...
At this point, the source code of Star Traders is essentially ready for
its 7.0 release!
2011-07-22 13:05:06 +10:00
John Zaitseff
b3e58af2eb
Be consistent in naming all "long int" variables that way
2011-07-22 12:59:05 +10:00
John Zaitseff
e50ce0e12b
Add more comments to process_move()
2011-07-22 12:43:21 +10:00
John Zaitseff
df2608d2d4
Make module-specific internal functions static
2011-07-22 12:31:54 +10:00
John Zaitseff
65a9dacbfc
Change the "--no-encrypt" command line option to "--dont-encrypt"
...
Some versions of getopt_long() show ALL options if an ambiguous
abbreviation was supplied (such as "--no"), and we don't really want
players to discover this option by accident, do we? :-)
2011-07-22 12:20:58 +10:00
John Zaitseff
c18f913710
Document the --max-turn command line option
...
Do NOT document the --no-encrypt option: we don't want people to know
about it!
2011-07-22 12:16:09 +10:00
John Zaitseff
ac55800e90
Continue moving comments from source files to headers
...
Also refactor some code, primarily in process_move(), to reduce the level
of indentation.
2011-07-22 12:11:19 +10:00
John Zaitseff
37195a1c57
Refactor some code in init_game()
...
Move parts of the code out of init_game() to internal functions
ask_number_players(), ask_game_number() and ask_player_names(). Also
move comments out to game.h as appropriate.
2011-07-22 10:49:26 +10:00
John Zaitseff
4b4efd7851
Replace the global variable localeconv_info with lconvinfo
...
In general, verbosity is not really to be encouraged...
2011-07-22 10:23:58 +10:00
John Zaitseff
9ef1181c05
Revert a previous change: we know how large is the window we opened!
2011-07-22 10:08:43 +10:00
John Zaitseff
78cac96e4a
Change handling of setlocale(LC_NUMERIC) in load_game() and save_game()
...
Changing just the LC_NUMERIC part of the locale DOES work, if you read
the manual page carefully! In particular, TWO calls need to be made, the
first with parameter NULL to get the current locale. In addition, the
result MUST be copied to a new string, as it may be (and is!) overwritten
by the next call to setlocale().
2011-07-21 22:44:45 +10:00
John Zaitseff
71486357c1
Bug fix: restore locale settings correctly
...
For some reason, changing the locale to "C" for LC_NUMERIC, then
restoring just that part of the locale to the old user-supplied
one does not work. Simply reinstating the whole locale using
setlocale(LC_ALL, ""), however, DOES work, so do that.
2011-07-21 22:22:50 +10:00
John Zaitseff
c5500e1bb3
Document and clean up fileio.c: functions load_game() and save_game()
2011-07-21 22:18:14 +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
1a44ff6513
Replace "tv.tv_sec * tv.tv_usec" with "tv.tv_sec + tv.tv_usec"
...
This allows the lower bits of seed to hopefully contain something useful
instead of just zeros!
2011-07-20 23:19:12 +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
6a6c31035a
Correct a subtle off-by-one error in copying in l_strfmon()
...
The bug in l_strfmon() is that bufsize is NOT the length of the string,
hence do not include the usual "+ 1" for the NUL byte. Also correct some
comparisons between signed and unsigned integers.
2011-07-20 21:47:20 +10:00
John Zaitseff
b3f1820418
Add the restrict keyword where appropriate
2011-07-20 21:18:49 +10:00
John Zaitseff
6ee474e438
Minor code cleanups
2011-07-20 21:18:28 +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