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
dc14a0e633
Implement the gettxlong() function to input an integer
2011-07-19 14:15:33 +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
8b504b645d
Implement the gettxdouble() function to input a floating point number
2011-07-19 00:37:10 +10:00
John Zaitseff
c3097e7f6f
Fix a long-standing bug: don't impound more cash than the debt amount!
2011-07-19 00:03:34 +10:00
John Zaitseff
937fea4ccb
Make company letters stand out more on the map in --no-color mode
2011-07-18 20:55:47 +10:00
John Zaitseff
ccd451cf5c
Implement the main part of exchange_stock()
2011-07-18 20:16:55 +10:00
John Zaitseff
c686d2f548
Rename sel_val_t to selection_t; add values useful for exchange_stock()
2011-07-18 20:16:24 +10:00
John Zaitseff
84b4972f93
Remove a superfluous call to wrefresh() in show_map()
2011-07-18 17:21:54 +10:00
John Zaitseff
1beb2003ef
Remove the global variables selection, credit_limit and bid_used
2011-07-18 16:22:24 +10:00
John Zaitseff
c123a87cc3
Move common bankruptcy code to a separate function, bankrupt_player()
2011-07-18 15:34:57 +10:00
John Zaitseff
2ec1c7faa9
Check if a player's debt is too large
2011-07-18 15:03:07 +10:00
John Zaitseff
5fca151b60
Add the function adjust_values()
2011-07-18 14:05:22 +10:00
John Zaitseff
4ecb40fe27
Complete the implementation of the process_move() function
...
This includes the functions try_start_new_company(), merge_companies(),
include_outpost() and inc_share_price().
2011-07-16 19:23:12 +10:00
John Zaitseff
c182f9df6f
Increase the size of Game Winner window at the end of the game
2011-07-16 19:20:50 +10:00
John Zaitseff
a75ec7479d
Add center3(): centre three strings
2011-07-16 15:47:05 +10:00
John Zaitseff
885b49f19d
Allow a player to declare themselves bankrupt
2011-07-16 14:37:29 +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
6c708d6f83
Add more control keys handled by various input routines for consistency
2011-07-16 13:32:02 +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
John Zaitseff
ddb214c5fb
Move the selection and processing of game moves to move.c
2011-07-16 10:30:58 +10:00
John Zaitseff
eb2fe45beb
Reorganise the information in src/README
2011-07-16 10:10:36 +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
John Zaitseff
36c9a57db0
Implement the end_game() function: display the winner of the game
2011-07-15 23:37:56 +10:00
John Zaitseff
f24eead880
Make window titles to be consistently title-cased
2011-07-15 21:57:23 +10:00
John Zaitseff
dec1a44caf
Add key presses to show_help() and get_move() to be more consistent
2011-07-15 21:45:23 +10:00
John Zaitseff
b39a1a7567
Redefine CURS_ON to be CURS_NORMAL as this works better with xterm
...
If "-bc" (flash cursor) is passed to xterm, CURS_VISIBLE will stop it
from flashing--not the intended effect. CURS_NORMAL will continue to
make the cursor flash with the "-bc" option.
2011-07-15 21:35:51 +10:00
John Zaitseff
97a9c6a35b
Shorten the enumeration names for the selection global variable
2011-07-15 21:32:37 +10:00
John Zaitseff
e06f48070f
Move the closing of two windows to process_move()
2011-07-15 21:15:44 +10:00
John Zaitseff
0a63e1ca1e
Implement the next_player() function
2011-07-15 21:13:32 +10:00
John Zaitseff
0d4f7cc226
Implement the get_move() function
2011-07-15 20:54:40 +10:00
John Zaitseff
6a55745d5d
Bug fix: total worth CAN be negative!
2011-07-15 19:08:43 +10:00
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