John Zaitseff
1e2fc6ad5f
Add SPDX licence identifiers to all source code files
2024-05-26 06:05:27 +10:00
John Zaitseff
cc5ee96ceb
Update the copyright year to 2024
2024-01-02 12:33:37 +11:00
John Zaitseff
3f3f6157f0
Use -1 instead of EOF for an invalid file descriptor
...
The POSIX standards specify that the open() and openat() functions
technically return -1, not EOF, on failure -- even though most (perhaps
all) systems define EOF to be -1!
2022-08-02 21:06:18 +10:00
John Zaitseff
89fdb5a65e
Eliminate a TOCTOU bug between data_directory() and xmkdir()
...
Checking the presence of the traditional data directory using stat()
leads to a time-of-check / time-of-use bug by the time it is possibly
created using xmkdir(). Use file descriptors and openat() to work around
this problem.
2022-08-01 22:23:06 +10:00
John Zaitseff
1231c084b8
Update the copyright year to 2022
2022-08-01 04:46:15 +10:00
John Zaitseff
90a815afbb
Create parent directories if required during mkdir
2021-01-12 09:48:05 +11:00
John Zaitseff
0d2462ef41
Update the copyright year to 2021
2021-01-07 17:07:55 +11:00
John Zaitseff
814ce71842
Update the copyright year to 2020
2020-01-02 08:37:36 +11:00
John Zaitseff
fa0cb153ff
Update copyright year to 2019
2019-01-05 08:10:28 +11:00
John Zaitseff
0e656681bc
Correct spelling or grammatical mistakes in various comments
2018-08-06 22:09:20 +10:00
John Zaitseff
abc9b77bd6
Change all relevant http references to https (secure HTTP)
2018-03-30 12:46:37 +11:00
John Zaitseff
8c6d009611
Update the copyright date to 2018
2018-03-30 11:38:29 +11:00
John Zaitseff
e4d884afc9
Replace U+0060 GRAVE ACCENT with U+0027 APOSTROPHE
...
In the past, GNU tools used quotes `like this'. Modern practice is to
use quotes 'like this'. Update Star Traders to follow this newer
standard, including all PO files.
2017-05-20 09:55:20 +10:00
John Zaitseff
2f79514910
Update the copyright date to 2017
2017-05-14 06:29:44 +10:00
John Zaitseff
a486cd15aa
Update the copyright year to 2016
2016-01-05 09:25:51 +11:00
John Zaitseff
f16f78a509
Update the copyright date to 2015
2015-08-18 07:27:22 +10:00
John Zaitseff
9cb3a46693
Completely rewrite the scramble() and unscramble() functions
...
The file output is now completely in ASCII---and will be much harder to
break for casual cheating!
2014-05-23 18:56:24 +10:00
John Zaitseff
549b2d517d
Use separate input and output buffers for scramble() and unscramble()
2014-05-22 15:34:32 +10:00
John Zaitseff
9450fed943
Update the copyright year to 2014
2014-05-22 11:05:51 +10:00
John Zaitseff
c25ec91e99
Update the copyright year to 2013, and the version number to 7.5
2013-02-02 10:48:43 +11:00
John Zaitseff
2a5bbc456c
Fix an off-by-one error in load_game()
...
Obviously no one has tried to load a game with MAX_PLAYERS (8) before!
2012-03-29 20:05:51 +11:00
John Zaitseff
bc3e1a06a1
Update the copyright year to 2012
2012-03-15 02:36:23 +11: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
150bcf10c2
Try loading UTF-8 strings with transliteration, if at all possible
...
Also fix a bug in save_game(): the iconv_open() parameters were the wrong
way around!
2011-08-20 16:27:11 +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
6c1c272780
Place all output strings within gettext invocations
2011-08-16 21:03:41 +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
32ed55a0cd
Convert strings to UTF-8 if possible during file save and load
2011-08-08 11:15:44 +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
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
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
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
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
e56247b1b4
Bug fix: company share prices CAN be zero, if company does not exist
2011-07-19 23:31:20 +10:00
John Zaitseff
ee37b4d210
Add the --no-encrypt command-line option
2011-07-19 23:24:17 +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
ef83258e2b
Make file saving and loading locale-independent for numbers
2011-07-19 14:47:18 +10:00
John Zaitseff
e2dbe549b2
Implement the "Save game" player choice; start coding process_move()
2011-07-16 13:34:13 +10:00
John Zaitseff
dd40b94301
Move game_load() and game_save() functions to their own source file
2011-07-16 09:58:53 +10:00