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