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

34 Commits

Author SHA1 Message Date
John Zaitseff
bc3e1a06a1 Update the copyright year to 2012 2012-03-15 02:36:23 +11:00
John Zaitseff
74aa3e84df Fix a couple of display bugs
Firstly, Ncurses addchstr() and family do not work, it seems, with
multibyte strings, so use addch() instead.  Secondly, PRINTABLE_MAP_VAL
returns a wchar_t wide character, not a byte-sized char.
2011-08-30 09:15:15 +10:00
John Zaitseff
1c2518a78b Minor clean-up: replace character constants with wide-char versions
Wide-char character constants is not strictly needed for most (all?)
modern C compilers, as ASCII maps to wchar_t directly (as long as
__STDC_ISO_10646__ is defined).  However, it doesn't hurt to be pedantic!
2011-08-25 21:34:41 +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
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
6ef7c7b6da Allow localisation of company letters and map moves (choices) 2011-08-18 12:10:33 +10:00
John Zaitseff
b674c05d56 Add many comments for translators; use pgettext() where appropriate 2011-08-17 19:13:05 +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
6c1c272780 Place all output strings within gettext invocations 2011-08-16 21:03:41 +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
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
5bb48fe35f Add wrapper functions xmalloc() and xstrdup() to do error handling 2011-08-13 08:50:34 +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
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
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
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
9f02f8e77f Rename character renditions (attributes) to something more regular 2011-07-20 17:01:25 +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
da7477dc28 Compensate for the POSIX locale not having a currency symbol
The function l_strfmon() will insert MOD_POSIX_CURRENCY_SYMBOL in the
appropriate place when used with the POSIX ("C") locale.
2011-07-20 10:44:44 +10:00
John Zaitseff
fcffaa5860 Add checks for KEY_EXIT: same functionality as pressing CTRL-C 2011-07-19 19:22:20 +10:00
John Zaitseff
ccbe7405f8 Replace "out of memory" errors with calls to err_exit_nomem() 2011-07-19 19:16:34 +10:00
John Zaitseff
8165785fc0 Handle rounding of input amounts a little better 2011-07-19 15:04:39 +10:00
John Zaitseff
7eafa205e7 Minor bug fix: the done variable must be initialised before use 2011-07-19 14:36:00 +10:00
John Zaitseff
625f265108 Allow the player to buy and sell shares
This function, trade_shares(), is the last function needed for Star
Traders: the game is now complete.

The current line count is 6667 lines of C code (src/*.[ch]), as compared
with 1657 lines in the CP/M-80 version, 1674 lines in CP/M-86, 4266 lines
in DOS (2225 in the main program) and 4580 lines in Windows 16-bit.
2011-07-19 14:21:32 +10:00
John Zaitseff
26436c08dd Rearrange the Stock Exchange display
The Stock Exchange display now mimics the Stock Portfolio page a little
more.  Also allow more keys to exit parts of the Stock Exchange.
2011-07-19 11:10:09 +10:00
John Zaitseff
e38c151752 Implement the visit_bank() function 2011-07-19 00:38:06 +10:00
John Zaitseff
ccd451cf5c Implement the main part of exchange_stock() 2011-07-18 20:16:55 +10:00
John Zaitseff
2c65c5be4a Move the stock exchange and bank functions (to be written) to exch.c 2011-07-16 10:43:19 +10:00