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

736 Commits

Author SHA1 Message Date
John Zaitseff
04513c9d30 Make the load_game and save_game macros more reliable
These macros now follow recommended practices as used by the Linux
kernel: in particular, by using the "do { ... } while (0)" construct.
2011-07-15 18:56:33 +10:00
John Zaitseff
5c28cea858 Move the BUFSIZE macro to trader.h; remove the similar GAME_BUFSIZE 2011-07-15 18:52:31 +10:00
John Zaitseff
4cca36441a Implement the show_status() and total_value() functions 2011-07-15 17:46:57 +10:00
John Zaitseff
717fc28339 Generate the map title line in a string-independent fashion 2011-07-15 14:58:32 +10:00
John Zaitseff
34c787cc30 Correct some bugs in center(); add the center2() function 2011-07-15 14:55:56 +10:00
John Zaitseff
d9d703f48e Conditionally wait for the user and close the window before returning 2011-07-15 12:21:59 +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
e46c45d52e Implement the select_moves() function
This function select random moves for the current player.
2011-07-14 21:44:18 +10:00
John Zaitseff
546c80053f Add the --no-color (and --no-colour) command-line options 2011-07-14 20:19:04 +10:00
John Zaitseff
3093e2cfd3 Add the help text, including all appropriate formatting 2011-07-14 19:27:57 +10:00
John Zaitseff
92a95b253f Implement the show_help() function with sample text 2011-07-14 16:29:29 +10:00
John Zaitseff
09d4455c3e Add window attributes for the galaxy map 2011-07-14 15:16:04 +10:00
John Zaitseff
39d6bc5b37 Add the abort_game global variable
The abort_game variable allows the program to abort the game without
showing the final winner.
2011-07-14 15:11:53 +10:00
John Zaitseff
200f7cdf97 Revise the scramble() and unscramble() functions
The scramble() and unscramble() functions now use a moving (incrementing)
key for the XOR encryption/decryption.  Also include a table of XOR keys
to use at random for encryption.
Revised the scramble() and unscramble() functions to use a moving
(incrementing) key for the XOR encryption/decryption.  Also generated a
table of XOR keys to use at random for encryption.
2011-07-14 12:30:23 +10:00
John Zaitseff
91d77f002c Bug fix: resolve memory leakage for the filename variable 2011-07-13 18:18:02 +10:00
John Zaitseff
593cda9a97 Add to the save_game() function to save the current game to disk 2011-07-13 12:52:38 +10:00
John Zaitseff
0b9b60780d Bug fix: actually copy the string read in to the destination buffer 2011-07-13 12:51:25 +10:00
John Zaitseff
3f96e587aa Rearrange the order of some global variables
Rearrange some global variables for consistency with initialisation in
init_game() and load_game().
2011-07-11 23:25:13 +10:00
John Zaitseff
1c502d671c Load a game file; support (trivial) game file encryption 2011-07-11 23:23:21 +10:00
John Zaitseff
16c421574f Add the scramble() and unscramble() functions
These functions provide simple encryption and decryption to thwart casual
cheating!
2011-07-11 23:21:10 +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
John Zaitseff
89c3512a1b Modify the wait_for_key() routine to take a window attribute parameter 2011-07-11 17:57:52 +10:00
John Zaitseff
86b88e8929 Allow a player to quit at the first prompt ("Enter number of players") 2011-07-11 17:48:16 +10:00
John Zaitseff
cdaeb2e869 Add the init_game() function that initialises the actual game 2011-07-11 16:14:07 +10:00
John Zaitseff
2a3ed550ad Remove the clrline parameter from the center() function 2011-07-11 15:56:01 +10:00
John Zaitseff
4a555235c9 Add the attr parameter to the center() function 2011-07-11 15:45:38 +10:00
John Zaitseff
20f6f6e73a Add the wait_for_key() function 2011-07-11 14:43:16 +10:00
John Zaitseff
5055ea57ac Rename get_yn_answer() to answer_yesno() 2011-07-11 14:23:16 +10:00
John Zaitseff
6436a68f8b Add the prototype and an empty definition for show_help() 2011-07-11 13:57:14 +10:00
John Zaitseff
3ff949efc0 Print the result of the get_yn_answer() function in bold 2011-07-11 13:52:22 +10:00
John Zaitseff
019734c8aa Rename the function getanswer() to get_yn_answer() 2011-07-11 13:37:48 +10:00
John Zaitseff
36a3811cd1 Add the gettxstring() function 2011-07-11 13:18:26 +10:00
John Zaitseff
60ab28c711 Add the modified status variable to gettxline()
Also correct a bug in gettxline() that always returned OK!
2011-07-11 12:28:13 +10:00
John Zaitseff
42e05ee20b Replace individual colour/window attributes with ATTR_ macros 2011-07-11 11:40:52 +10:00
John Zaitseff
dd281f795b Add gettxline() to read a line of input from the keyboard 2011-07-11 10:31:19 +10:00
John Zaitseff
85e09ab4f2 Replace calls to wprintw() with waddstr() where appropriate 2011-07-11 08:05:36 +10:00
John Zaitseff
1995a6a7b0 Remove the superfluous argument attr_end from attrpr()
Instead of using attr_end, simply restore the old window attributes after
printing the string.
2011-07-11 08:01:18 +10:00
John Zaitseff
5e912e6e14 Plan ahead to reduce the title window to a single line
By reducing the title window to a single line, we can fit an extra two
lines of the galaxy map in an 80x24 terminal window.
2011-07-05 10:11:50 +10:00
John Zaitseff
ad4ed4d744 Add input routines gettxchar() and getanswer(); add various macros
In particular, add macros for KEY_TAB, KEY_RETURN and KEY_ESC, and for
CURS_ON and CURS_OFF (instead of using CURS_INVISIBLE and CURS_VISIBLE
directly: this allows redefining CURS_ON to be CURS_NORMAL).  Add more
colour pairs.
2011-07-04 22:02:01 +10:00
John Zaitseff
568c3738b2 Add the attrpr() function; add a missing va_end() call in center()
The attrpr() function prints a string with a particular set of Curses
attributes.
2011-07-04 19:41:55 +10:00
John Zaitseff
ca64093a07 Move definition of "enum curs_type"; rename CURS_VERYVISIBLE
Rename CURS_VERYVISIBLE to CURS_VISIBLE to match the system documentation
for Curses.
2011-07-04 19:15:38 +10:00
John Zaitseff
4279467e14 Define the global variable quit_selected 2011-07-04 18:24:10 +10:00
John Zaitseff
ad10fd4af6 Rename company_names[] to company_name[] for consistency 2016-12-09 08:55:09 +11:00
John Zaitseff
9f6c2af671 Define ATTR: select between attributes for colour and mono screens 2016-12-09 08:54:59 +11:00
John Zaitseff
10c4cb2a22 Add a "y" parameter to center(); add the COL_CENTER macro 2011-07-04 17:54:30 +10:00
John Zaitseff
c0943b9f7d Move (and abstract) the random number functions to utils.c 2011-07-04 17:13:29 +10:00
John Zaitseff
9a39c84bf4 Add source files game.c and game.h
These files will eventually contain many of the game functions.
2011-07-04 15:54:39 +10:00
John Zaitseff
4d5c5b70ca Add the functions init_program() and end_program() 2011-07-04 15:45:03 +10:00
John Zaitseff
4f62ef1b58 Add simple functions to manage a stack of Curses windows 2011-07-04 12:41:30 +10:00
John Zaitseff
2a3e18460e Rename intto_game_filename() to game_filename() 2011-07-04 10:28:50 +10:00