mirror of
https://git.zap.org.au/git/trader.git
synced 2024-09-01 17:14:15 -04:00
Merge branch master into with-autogenerated
This commit is contained in:
commit
efb345403b
8
INSTALL
8
INSTALL
@ -102,12 +102,12 @@ You can also run configure in a separate build-only directory tree. This
|
|||||||
feature requires GNU Make and allows you to keep the source code tree from
|
feature requires GNU Make and allows you to keep the source code tree from
|
||||||
being modified by the compilation process. To use this option, create a
|
being modified by the compilation process. To use this option, create a
|
||||||
separate build directory, then run configure. For example, if you placed
|
separate build directory, then run configure. For example, if you placed
|
||||||
the Star Traders source code tree in $HOME/src/trader-7.3, you could run
|
the Star Traders source code tree in $HOME/src/trader-7.4, you could run
|
||||||
something like:
|
something like:
|
||||||
|
|
||||||
mkdir $HOME/build/trader-build-7.3
|
mkdir $HOME/build/trader-build-7.4
|
||||||
cd $HOME/build/trader-build-7.3
|
cd $HOME/build/trader-build-7.4
|
||||||
$HOME/src/trader-7.3/configure
|
$HOME/src/trader-7.4/configure
|
||||||
|
|
||||||
Once again, the Autoconf manual describes these options (and many others):
|
Once again, the Autoconf manual describes these options (and many others):
|
||||||
|
|
||||||
|
26
NEWS
26
NEWS
@ -15,6 +15,32 @@ consult the Subversion repository for "trader" on The ZAP Group web server
|
|||||||
at http://www.zap.org.au/services/svn/.
|
at http://www.zap.org.au/services/svn/.
|
||||||
|
|
||||||
|
|
||||||
|
Version 7.4 (not yet released)
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
For the first time since the CP/M-80 version of Star Traders, the game
|
||||||
|
algorithms have been carefully reviewed and revised. In particular,
|
||||||
|
companies may now have negative returns, making players lose money on such
|
||||||
|
shares. This may encourage players to use the "Sell shares" option at
|
||||||
|
appropriate times... In addition, changes in share prices, returns and
|
||||||
|
bank interest rates have been made much "smoother", less prone to wild
|
||||||
|
variations. These new algorithms were first modelled using Gnuplot and
|
||||||
|
Perl before being implemented in C.
|
||||||
|
|
||||||
|
The "configure" script now prints a prominent warning if a wide-character
|
||||||
|
version of Curses, such as NcursesW, is not available when compiling the
|
||||||
|
game. It is a warning and not an error as single-byte locales (such as
|
||||||
|
US-ASCII and ISO8859-1) do not require NcursesW, even if the compilation
|
||||||
|
environment itself is a multibyte one (such as UTF-8).
|
||||||
|
|
||||||
|
The Russian translation has been updated, with thanks to Vladimir Tsarkov
|
||||||
|
and Pavel Maryanov. Translations for French, German, Finnish and Croatian
|
||||||
|
have been added (in that order), with thanks to Frédéric Marchal, Philipp
|
||||||
|
Thomas, Jorma Karvonen and Tomislav Krznar. Special thanks also to the
|
||||||
|
Translation Project, which brings free (open-source) software developers
|
||||||
|
and translators together.
|
||||||
|
|
||||||
|
|
||||||
Version 7.3 (16th March, 2012)
|
Version 7.3 (16th March, 2012)
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
10
configure.ac
10
configure.ac
@ -26,7 +26,7 @@ dnl You should have received a copy of the GNU General Public License
|
|||||||
dnl along with this program. If not, see http://www.gnu.org/licenses/.
|
dnl along with this program. If not, see http://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
|
||||||
AC_INIT([Star Traders], [7.3], [J.Zaitseff@zap.org.au], [trader], [http://www.zap.org.au/software/trader/])
|
AC_INIT([Star Traders], [7.4-pre2], [J.Zaitseff@zap.org.au], [trader], [http://www.zap.org.au/software/trader/])
|
||||||
AC_DEFINE([PACKAGE_AUTHOR], ["John Zaitseff"], [Package author])
|
AC_DEFINE([PACKAGE_AUTHOR], ["John Zaitseff"], [Package author])
|
||||||
|
|
||||||
AC_PREREQ([2.67])
|
AC_PREREQ([2.67])
|
||||||
@ -59,6 +59,14 @@ AX_WITH_CURSES
|
|||||||
AS_IF([test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes], [
|
AS_IF([test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes], [
|
||||||
AC_MSG_ERROR([requires an X/Open-compatible Curses library with colour])
|
AC_MSG_ERROR([requires an X/Open-compatible Curses library with colour])
|
||||||
])
|
])
|
||||||
|
AS_IF([test "x$ax_cv_curses_enhanced" != xyes], [
|
||||||
|
AC_MSG_WARN([no X/Open-compatible Enhanced Curses library found
|
||||||
|
|
||||||
|
***************** Locales with multibyte character sequences (such as
|
||||||
|
*** WARNING *** UTF-8) require a wide-character version of Curses,
|
||||||
|
***************** such as NcursesW, to work correctly.
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
|
@ -31,4 +31,9 @@ en_AU
|
|||||||
en_CA
|
en_CA
|
||||||
en_GB
|
en_GB
|
||||||
en_US
|
en_US
|
||||||
|
|
||||||
|
de
|
||||||
|
fi
|
||||||
|
fr
|
||||||
|
hr
|
||||||
ru
|
ru
|
||||||
|
@ -34,7 +34,13 @@ subdir = po
|
|||||||
top_builddir = ..
|
top_builddir = ..
|
||||||
|
|
||||||
# These options get passed to xgettext
|
# These options get passed to xgettext
|
||||||
XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --width=132
|
XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --width=132 \
|
||||||
|
--flag='err_exit:1:c-format' --flag='errno_exit:1:c-format' \
|
||||||
|
--flag='txdlgbox:11:c-format' --flag='txdlgbox:12:c-format' \
|
||||||
|
--flag='mkchstr:10:c-format' --flag='vmkchstr:10:c-format' \
|
||||||
|
--flag='left:8:c-format' \
|
||||||
|
--flag='center:8:c-format' \
|
||||||
|
--flag='right:8:c-format'
|
||||||
|
|
||||||
# These options get passed to msgmerge
|
# These options get passed to msgmerge
|
||||||
MSGMERGE_OPTIONS = --width=132
|
MSGMERGE_OPTIONS = --width=132
|
||||||
|
390
po/en_AU.po
390
po/en_AU.po
File diff suppressed because it is too large
Load Diff
390
po/en_CA.po
390
po/en_CA.po
File diff suppressed because it is too large
Load Diff
390
po/en_GB.po
390
po/en_GB.po
File diff suppressed because it is too large
Load Diff
390
po/en_US.po
390
po/en_US.po
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,7 @@ void exchange_stock (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newtxwin(17, WIN_COLS, 1, WCENTER, false, 0);
|
newtxwin(16, WIN_COLS, 1, WCENTER, false, 0);
|
||||||
w = getmaxx(curwin);
|
w = getmaxx(curwin);
|
||||||
|
|
||||||
while (selection != SEL_EXIT) {
|
while (selection != SEL_EXIT) {
|
||||||
@ -176,11 +176,13 @@ void exchange_stock (void)
|
|||||||
wrefresh(curwin);
|
wrefresh(curwin);
|
||||||
|
|
||||||
// Show menu of choices for the player
|
// Show menu of choices for the player
|
||||||
newtxwin(6, WIN_COLS, 18, WCENTER, true, attr_normal_window);
|
newtxwin(7, WIN_COLS, 17, WCENTER, true, attr_normal_window);
|
||||||
|
|
||||||
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
|
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
|
||||||
_("^{<1>^} Display stock portfolio"));
|
_("^{<1>^} Display stock portfolio"));
|
||||||
left(curwin, 4, 2, attr_normal, attr_keycode, 0, 1,
|
left(curwin, 4, 2, attr_normal, attr_keycode, 0, 1,
|
||||||
|
/* TRANSLATORS: Each label may be up to 37 characters wide
|
||||||
|
(for <1> and <2>) or 38 characters wide (for <3> and <4>). */
|
||||||
_("^{<2>^} Display galaxy map"));
|
_("^{<2>^} Display galaxy map"));
|
||||||
left(curwin, 3, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
|
left(curwin, 3, getmaxx(curwin) / 2, attr_normal, attr_keycode, 0, 1,
|
||||||
_("^{<3>^} Visit the Trading Bank"));
|
_("^{<3>^} Visit the Trading Bank"));
|
||||||
@ -644,6 +646,8 @@ void trade_shares (int num, bool *bid_used)
|
|||||||
newtxwin(7, WIN_COLS - 4, 14, WCENTER, true, attr_normal_window);
|
newtxwin(7, WIN_COLS - 4, 14, WCENTER, true, attr_normal_window);
|
||||||
|
|
||||||
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
|
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
|
||||||
|
/* TRANSLATORS: Each label may be up to 35 characters wide
|
||||||
|
(for <1> and <2>) or 36 characters wide (for <3> and <4>). */
|
||||||
_("^{<1>^} Buy stock from company"));
|
_("^{<1>^} Buy stock from company"));
|
||||||
left(curwin, 4, 2, attr_normal, attr_keycode, 0, 1,
|
left(curwin, 4, 2, attr_normal, attr_keycode, 0, 1,
|
||||||
_("^{<2>^} Sell stock back to company"));
|
_("^{<2>^} Sell stock back to company"));
|
||||||
|
@ -346,7 +346,7 @@ bool load_game (int num)
|
|||||||
load_game_read_int(n, n == MAX_Y);
|
load_game_read_int(n, n == MAX_Y);
|
||||||
load_game_read_int(max_turn, max_turn >= 1);
|
load_game_read_int(max_turn, max_turn >= 1);
|
||||||
load_game_read_int(turn_number, turn_number >= 1 && turn_number <= max_turn);
|
load_game_read_int(turn_number, turn_number >= 1 && turn_number <= max_turn);
|
||||||
load_game_read_int(number_players, number_players >= 1 && number_players < MAX_PLAYERS);
|
load_game_read_int(number_players, number_players >= 1 && number_players <= MAX_PLAYERS);
|
||||||
load_game_read_int(current_player, current_player >= 0 && current_player < number_players);
|
load_game_read_int(current_player, current_player >= 0 && current_player < number_players);
|
||||||
load_game_read_int(first_player, first_player >= 0 && first_player < number_players);
|
load_game_read_int(first_player, first_player >= 0 && first_player < number_players);
|
||||||
load_game_read_int(n, n == MAX_COMPANIES);
|
load_game_read_int(n, n == MAX_COMPANIES);
|
||||||
|
@ -41,8 +41,9 @@ const char *company_name[MAX_COMPANIES] = {
|
|||||||
/* TRANSLATORS: The eight company names do NOT have to be literal
|
/* TRANSLATORS: The eight company names do NOT have to be literal
|
||||||
translations of the English names. In fact, if possible, the
|
translations of the English names. In fact, if possible, the
|
||||||
names should start with successive letters of your alphabet (in
|
names should start with successive letters of your alphabet (in
|
||||||
English, for example, "A" to "H"). No company name should be more
|
English, for example, "A" to "H"), and, ideally, be related to
|
||||||
than 24 characters (column positions, to be precise) long. */
|
constellations or stars in our galaxy. No company name should be
|
||||||
|
more than 24 characters (column positions, to be precise) long. */
|
||||||
N_("Altair Starways"),
|
N_("Altair Starways"),
|
||||||
N_("Betelgeuse, Ltd"),
|
N_("Betelgeuse, Ltd"),
|
||||||
N_("Capella Freight Co"),
|
N_("Capella Freight Co"),
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#define MAX_PLAYERS 8 // Maximum number of players
|
#define MAX_PLAYERS 8 // Maximum number of players
|
||||||
#define INITIAL_CASH 6000.00 // Initial cash per player
|
#define INITIAL_CASH 6000.00 // Initial cash per player
|
||||||
#define MAX_OVERDRAFT 1000.00 // Max. value player can go negative
|
#define MAX_OVERDRAFT 1000.00 // Max. value player can go negative
|
||||||
#define PROB_BANKRUPTCY 0.07 // If overdraft, 7% chance of bankruptcy
|
#define MAKE_BANKRUPT 0.07 // If overdraft, 7% chance of bankruptcy
|
||||||
|
|
||||||
#define MAX_COMPANIES 8 // Max. number of companies (do not change!)
|
#define MAX_COMPANIES 8 // Max. number of companies (do not change!)
|
||||||
#define INITIAL_STOCK_ISSUED 5 // Initial number of shares issued out
|
#define INITIAL_STOCK_ISSUED 5 // Initial number of shares issued out
|
||||||
@ -55,34 +55,44 @@
|
|||||||
#define INITIAL_SHARE_PRICE 60.00 // Initial share price
|
#define INITIAL_SHARE_PRICE 60.00 // Initial share price
|
||||||
|
|
||||||
#define SHARE_PRICE_INC 60.00 // Share price incr. for increase in shipping
|
#define SHARE_PRICE_INC 60.00 // Share price incr. for increase in shipping
|
||||||
#define SHARE_PRICE_INC_OUTPOST 70.00 // Incr. for adding an outpost
|
#define SHARE_PRICE_INC_OUTPOST 75.00 // Incr. for adding an outpost
|
||||||
#define SHARE_PRICE_INC_OUTSTAR 70.00 // Extra incr. for adding outpost next to star
|
#define SHARE_PRICE_INC_OUTSTAR 150.00 // Extra incr. for adding outpost next to star
|
||||||
#define SHARE_PRICE_INC_STAR 300.00 // Incr. for adding next to star
|
#define SHARE_PRICE_INC_STAR 300.00 // Incr. for adding next to star
|
||||||
#define SHARE_PRICE_INC_EXTRA 0.50 // Extra factor when incr. share price
|
#define PRICE_INC_ADJUST_MIN 0.75 // Actual incr. may be as low as 75% of nominal
|
||||||
|
#define PRICE_INC_ADJUST_MAX 1.25 // Actual incr. may be as high as 125%
|
||||||
|
#define MAX_STOCK_RATIO_MIN 0.10 // Min. multiplier to increment available shares
|
||||||
|
#define MAX_STOCK_RATIO_MAX 0.25 // Max. multiplier, using share price incr.
|
||||||
|
|
||||||
#define MERGE_STOCK_RATIO 0.50 // 50% of old shares are credited to new company
|
#define MERGE_STOCK_RATIO 0.50 // 50% of old shares are credited to new company
|
||||||
#define COMPANY_BANKRUPTCY 0.01 // 1% chance of company bankruptcy
|
#define MERGE_BONUS_RATE 10.0 // Multiplier for merger cash bonus
|
||||||
|
#define MERGE_PRICE_ADJUST_MIN 0.40 // Minimum of old share price used as increment
|
||||||
|
#define MERGE_PRICE_ADJUST_MAX 0.60 // Maximum of old share price used as increment
|
||||||
|
#define COMPANY_BANKRUPTCY 0.03 // 3% chance of company bankruptcy (if return < 0)
|
||||||
#define ALL_ASSETS_TAKEN 0.20 // 20% chance of assets taken of same
|
#define ALL_ASSETS_TAKEN 0.20 // 20% chance of assets taken of same
|
||||||
|
|
||||||
#define INC_SHARE_PRICE 0.30 // 30% chance for increasing share price
|
#define CHANGE_SHARE_PRICE 0.35 // 35% chance for changing share price
|
||||||
#define DEC_SHARE_PRICE 0.65 // 65% x 30% chance of decrementing same
|
#define DEC_SHARE_PRICE 0.65 // 65% x 35% chance of decrementing same
|
||||||
#define PRICE_CHANGE_RATE 0.25 // Up to 25% of share price is used to incr./decr.
|
#define PRICE_CHANGE_RATE 0.25 // Up to 25% of share price is used to incr./decr.
|
||||||
#define INITIAL_RETURN 0.05 // Initial return per share: 5%
|
#define INITIAL_RETURN 0.05 // Initial return per share: 5%
|
||||||
#define GROWING_RETURN_CHANGE 0.25 // Chance of changing return when company grows
|
#define MIN_COMPANY_RETURN -0.10 // Minimum return per share (yes, negative!)
|
||||||
#define GROWING_RETURN_INC 0.60 // 60% chance such change will increase return
|
#define MAX_COMPANY_RETURN 0.20 // Maximum return per share
|
||||||
#define CHANGE_COMPANY_RETURN 0.40 // Chance of randomly changing return
|
#define CHANGE_COMPANY_RETURN 0.50 // Chance of randomly changing return
|
||||||
#define COMPANY_RETURN_INC 0.75 // 75% chance such change will increase return
|
#define DEC_COMPANY_RETURN 0.50 // Chance such change will decrease return
|
||||||
#define MAX_COMPANY_RETURN 0.40 // Maximum return per share
|
#define RETURN_MAX_CHANGE 0.03 // Maximum that company return will change
|
||||||
#define RETURN_DIVIDER 1.50 // Min. amount by which to divide if return too large
|
#define CHANGE_RETURN_GROWING 0.25 // Chance of changing return when company grows
|
||||||
|
#define DEC_RETURN_GROWING 0.35 // 35% chance such change will decrement return
|
||||||
|
#define GROWING_MAX_CHANGE 0.02 // Maximum that that return can change
|
||||||
|
|
||||||
#define OWNERSHIP_BONUS 2.00 // Bonus amount based on percentage ownership
|
#define OWNERSHIP_BONUS 2.00 // Bonus amount based on percentage ownership
|
||||||
#define BID_CHANCE 0.75 // 75% chance of successful bidding
|
#define BID_CHANCE 0.75 // 75% chance of successful bidding
|
||||||
#define MAX_SHARES_BIDDED 200 // Max. number of shares issued
|
#define MAX_SHARES_BIDDED 200 // Max. number of shares issued
|
||||||
|
|
||||||
#define INITIAL_INTEREST_RATE 0.10 // Initial bank interest rate: 10%
|
#define INITIAL_INTEREST_RATE 0.10 // Initial bank interest rate: 10%
|
||||||
#define CHANGE_INTEREST_RATE 0.30 // 30% chance of changing interest rate
|
#define MIN_INTEREST_RATE 0.02 // Minimum interest rate
|
||||||
#define INTEREST_RATE_INC 0.65 // 65% chance of above being an increment
|
#define MAX_INTEREST_RATE 0.20 // Maximum interest rate
|
||||||
#define MAX_INTEREST_RATE 0.30 // Maximum interest rate
|
#define CHANGE_INTEREST_RATE 0.40 // 40% chance of changing interest rate
|
||||||
#define INTEREST_RATE_DIVIDER 1.50 // Min. amount by which to divide if interest is too high
|
#define DEC_INTEREST_RATE 0.45 // 40% x 45% chance of decrease the same
|
||||||
|
#define INTEREST_MAX_CHANGE 0.03 // Maximum that interest rate will change
|
||||||
#define CREDIT_LIMIT_RATE 2.00 // Multiplier for credit limit
|
#define CREDIT_LIMIT_RATE 2.00 // Multiplier for credit limit
|
||||||
|
|
||||||
#define ROUNDING_AMOUNT 0.01 // Round off smaller amounts to zero
|
#define ROUNDING_AMOUNT 0.01 // Round off smaller amounts to zero
|
||||||
@ -96,7 +106,7 @@
|
|||||||
typedef struct company_info {
|
typedef struct company_info {
|
||||||
wchar_t *name; // Company name
|
wchar_t *name; // Company name
|
||||||
double share_price; // Share price
|
double share_price; // Share price
|
||||||
double share_return; // Return per share
|
double share_return; // Return per share (may be negative)
|
||||||
long int stock_issued; // Total stock sold to players
|
long int stock_issued; // Total stock sold to players
|
||||||
long int max_stock; // Max. stock that company has
|
long int max_stock; // Max. stock that company has
|
||||||
bool on_map; // True if company on map
|
bool on_map; // True if company on map
|
||||||
|
22
src/help.c
22
src/help.c
@ -99,6 +99,16 @@ static const char *help_text[HELP_TEXT_PAGES] = {
|
|||||||
the galaxy map, use something like "^k~1^N" (a six-character sequence
|
the galaxy map, use something like "^k~1^N" (a six-character sequence
|
||||||
that would translate to just one character (or maybe two) in the
|
that would translate to just one character (or maybe two) in the
|
||||||
output text).
|
output text).
|
||||||
|
|
||||||
|
Formatting the help text is probably the most complicated and tedious
|
||||||
|
part of translating Star Traders. The author and maintainer of this
|
||||||
|
game is more than happy to help you with this task: if you are able
|
||||||
|
to provide a translation, even if it is not formatted correctly, the
|
||||||
|
maintainer will perform the necessary adjustments for word-wrapping
|
||||||
|
and justification. In addition, remember that you have up to 10
|
||||||
|
pages in which to display your help text: the translation does not
|
||||||
|
need to correspond exactly to the original text. This text will not
|
||||||
|
be changing any time soon!
|
||||||
*/
|
*/
|
||||||
N_( ""
|
N_( ""
|
||||||
"^BStar Traders^N is a simple game of interstellar trading. The object of the\n"
|
"^BStar Traders^N is a simple game of interstellar trading. The object of the\n"
|
||||||
@ -212,10 +222,10 @@ static const char *help_text[HELP_TEXT_PAGES] = {
|
|||||||
"")
|
"")
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
, N_("@ Help text, page 7")
|
, N_("@ Help text, page 7\n")
|
||||||
, N_("@ Help text, page 8")
|
, N_("@ Help text, page 8\n")
|
||||||
, N_("@ Help text, page 9")
|
, N_("@ Help text, page 9\n")
|
||||||
, N_("@ Help text, page 10")
|
, N_("@ Help text, page 10\n")
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -269,6 +279,10 @@ void show_help (void)
|
|||||||
|
|
||||||
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" How to Play "));
|
center(curwin, 1, 0, attr_title, 0, 0, 1, _(" How to Play "));
|
||||||
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1,
|
center(curwin, 2, 0, attr_normal, attr_highlight, 0, 1,
|
||||||
|
/* TRANSLATORS: The first %d is the current page number,
|
||||||
|
the second is the number of pages your help text takes
|
||||||
|
(6, in English). You can replace the second %d with a
|
||||||
|
fixed word, if you like. */
|
||||||
_("Page %d of %d"), curpage + 1, numpages);
|
_("Page %d of %d"), curpage + 1, numpages);
|
||||||
wmove(curwin, 4, 2);
|
wmove(curwin, 4, 2);
|
||||||
|
|
||||||
|
108
src/move.c
108
src/move.c
@ -236,6 +236,10 @@ selection_t get_move (void)
|
|||||||
box(curwin, 0, 0);
|
box(curwin, 0, 0);
|
||||||
|
|
||||||
left(curwin, 2, 2, attr_normal, attr_keycode, 0, 1,
|
left(curwin, 2, 2, attr_normal, attr_keycode, 0, 1,
|
||||||
|
/* TRANSLATORS: Each label may be up to 37 characters wide
|
||||||
|
(for <1> and <2>) or 38 characters wide (for <3> and
|
||||||
|
<CTRL><C>). The sequences "^{" and "^}" change the
|
||||||
|
character rendition (attributes) and take up no space. */
|
||||||
_("^{<1>^} Display stock portfolio"));
|
_("^{<1>^} Display stock portfolio"));
|
||||||
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
|
left(curwin, 3, 2, attr_normal, attr_keycode, 0, 1,
|
||||||
_("^{<2>^} Declare bankruptcy"));
|
_("^{<2>^} Declare bankruptcy"));
|
||||||
@ -246,6 +250,11 @@ selection_t get_move (void)
|
|||||||
|
|
||||||
right(curwin, 1, getmaxx(curwin) / 2, attr_normal, attr_keycode,
|
right(curwin, 1, getmaxx(curwin) / 2, attr_normal, attr_keycode,
|
||||||
attr_choice, 1,
|
attr_choice, 1,
|
||||||
|
/* TRANSLATORS: The maximum column width is 38 characters,
|
||||||
|
including the trailing space. The sequences "^{", "^}",
|
||||||
|
"^[" and "^]" do not take up any room. "%lc" takes up
|
||||||
|
either one or two columns, depending on the appropriate
|
||||||
|
"output|GameMoves" string in the current PO file. */
|
||||||
_("Select move [^[%lc^]-^[%lc^]/^{1^}-^{3^}/^{<CTRL><C>^}]: "),
|
_("Select move [^[%lc^]-^[%lc^]/^{1^}-^{3^}/^{<CTRL><C>^}]: "),
|
||||||
(wint_t) PRINTABLE_GAME_MOVE(0),
|
(wint_t) PRINTABLE_GAME_MOVE(0),
|
||||||
(wint_t) PRINTABLE_GAME_MOVE(NUMBER_MOVES - 1));
|
(wint_t) PRINTABLE_GAME_MOVE(NUMBER_MOVES - 1));
|
||||||
@ -276,9 +285,13 @@ selection_t get_move (void)
|
|||||||
curs_set(CURS_OFF);
|
curs_set(CURS_OFF);
|
||||||
left(curwin, 1, getmaxx(curwin) / 2, attr_normal,
|
left(curwin, 1, getmaxx(curwin) / 2, attr_normal,
|
||||||
attr_choice, 0, 1,
|
attr_choice, 0, 1,
|
||||||
/* TRANSLATORS: "Move" refers to the choice of
|
/* TRANSLATORS: A game usually consists of
|
||||||
moves made by the current player (out of a
|
DEFAULT_MAX_TURN (50) turns. On each
|
||||||
selection of 20 moves). */
|
turn, the computer randomly selects
|
||||||
|
NUMBER_MOVES (20) moves (positions on the
|
||||||
|
map); each player selects just one move
|
||||||
|
per turn. "Move" refers to the player's
|
||||||
|
choice. */
|
||||||
_("Move ^{%lc^}"),
|
_("Move ^{%lc^}"),
|
||||||
(wint_t) PRINTABLE_GAME_MOVE(i));
|
(wint_t) PRINTABLE_GAME_MOVE(i));
|
||||||
|
|
||||||
@ -782,9 +795,9 @@ void merge_companies (map_val_t a, map_val_t b)
|
|||||||
assert(bb >= 0 && bb < MAX_COMPANIES);
|
assert(bb >= 0 && bb < MAX_COMPANIES);
|
||||||
|
|
||||||
double val_aa = company[aa].share_price * company[aa].stock_issued *
|
double val_aa = company[aa].share_price * company[aa].stock_issued *
|
||||||
company[aa].share_return;
|
(1.0 + company[aa].share_return);
|
||||||
double val_bb = company[bb].share_price * company[bb].stock_issued *
|
double val_bb = company[bb].share_price * company[bb].stock_issued *
|
||||||
company[bb].share_return;
|
(1.0 + company[bb].share_return);
|
||||||
|
|
||||||
double bonus;
|
double bonus;
|
||||||
long int old_stock, new_stock, total_new;
|
long int old_stock, new_stock, total_new;
|
||||||
@ -887,9 +900,9 @@ void merge_companies (map_val_t a, map_val_t b)
|
|||||||
new_stock = (double) old_stock * MERGE_STOCK_RATIO;
|
new_stock = (double) old_stock * MERGE_STOCK_RATIO;
|
||||||
total_new += new_stock;
|
total_new += new_stock;
|
||||||
|
|
||||||
bonus = (company[bb].stock_issued == 0) ? 0.0 :
|
bonus = (company[bb].stock_issued == 0) ? 0.0 : MERGE_BONUS_RATE
|
||||||
10.0 * ((double) player[i].stock_owned[bb]
|
* ((double) player[i].stock_owned[bb]
|
||||||
/ company[bb].stock_issued) * company[bb].share_price;
|
/ company[bb].stock_issued) * company[bb].share_price;
|
||||||
|
|
||||||
player[i].stock_owned[aa] += new_stock;
|
player[i].stock_owned[aa] += new_stock;
|
||||||
player[i].stock_owned[bb] = 0;
|
player[i].stock_owned[bb] = 0;
|
||||||
@ -917,7 +930,9 @@ void merge_companies (map_val_t a, map_val_t b)
|
|||||||
// Adjust the company records appropriately
|
// Adjust the company records appropriately
|
||||||
company[aa].stock_issued += total_new;
|
company[aa].stock_issued += total_new;
|
||||||
company[aa].max_stock += total_new;
|
company[aa].max_stock += total_new;
|
||||||
company[aa].share_price += company[bb].share_price / (randf() + 1.5);
|
company[aa].share_price += company[bb].share_price
|
||||||
|
* (randf() * (MERGE_PRICE_ADJUST_MAX - MERGE_PRICE_ADJUST_MIN)
|
||||||
|
+ MERGE_PRICE_ADJUST_MIN);
|
||||||
|
|
||||||
company[bb].stock_issued = 0;
|
company[bb].stock_issued = 0;
|
||||||
company[bb].max_stock = 0;
|
company[bb].max_stock = 0;
|
||||||
@ -997,11 +1012,22 @@ void inc_share_price (int num, double inc)
|
|||||||
{
|
{
|
||||||
assert(num >= 0 && num < MAX_COMPANIES);
|
assert(num >= 0 && num < MAX_COMPANIES);
|
||||||
|
|
||||||
company[num].share_price += inc * (1.0 + randf() * SHARE_PRICE_INC_EXTRA);
|
company[num].share_price += inc * (randf()
|
||||||
company[num].max_stock += inc / (randf() * 10.0 + 5.0);
|
* (PRICE_INC_ADJUST_MAX - PRICE_INC_ADJUST_MIN) + PRICE_INC_ADJUST_MIN);
|
||||||
|
company[num].max_stock += inc * (randf()
|
||||||
|
* (MAX_STOCK_RATIO_MAX - MAX_STOCK_RATIO_MIN) + MAX_STOCK_RATIO_MIN);
|
||||||
|
|
||||||
if (randf() < GROWING_RETURN_CHANGE) {
|
if (randf() < CHANGE_RETURN_GROWING) {
|
||||||
company[num].share_return *= randf() + GROWING_RETURN_INC;
|
double change = randf() * GROWING_MAX_CHANGE;
|
||||||
|
if (randf() < DEC_RETURN_GROWING) {
|
||||||
|
change = -change;
|
||||||
|
}
|
||||||
|
|
||||||
|
company[num].share_return += change;
|
||||||
|
if ( company[num].share_return > MAX_COMPANY_RETURN
|
||||||
|
|| company[num].share_return < MIN_COMPANY_RETURN) {
|
||||||
|
company[num].share_return -= 2.0 * change;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,7 +1044,7 @@ void adjust_values (void)
|
|||||||
if (randf() > (1.0 - COMPANY_BANKRUPTCY)) {
|
if (randf() > (1.0 - COMPANY_BANKRUPTCY)) {
|
||||||
which = randi(MAX_COMPANIES);
|
which = randi(MAX_COMPANIES);
|
||||||
|
|
||||||
if (company[which].on_map) {
|
if (company[which].on_map && company[which].share_return <= 0.0) {
|
||||||
if (randf() < ALL_ASSETS_TAKEN) {
|
if (randf() < ALL_ASSETS_TAKEN) {
|
||||||
txdlgbox(MAX_DLG_LINES, 60, 6, WCENTER, attr_error_window,
|
txdlgbox(MAX_DLG_LINES, 60, 6, WCENTER, attr_error_window,
|
||||||
attr_error_title, attr_error_highlight,
|
attr_error_title, attr_error_highlight,
|
||||||
@ -1041,7 +1067,8 @@ void adjust_values (void)
|
|||||||
|
|
||||||
for (int i = 0; i < number_players; i++) {
|
for (int i = 0; i < number_players; i++) {
|
||||||
if (player[i].in_game) {
|
if (player[i].in_game) {
|
||||||
player[i].cash += player[i].stock_owned[which] * rate;
|
player[i].cash += player[i].stock_owned[which]
|
||||||
|
* company[which].share_price * rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,19 +1150,21 @@ void adjust_values (void)
|
|||||||
if (randf() < CHANGE_COMPANY_RETURN) {
|
if (randf() < CHANGE_COMPANY_RETURN) {
|
||||||
which = randi(MAX_COMPANIES);
|
which = randi(MAX_COMPANIES);
|
||||||
if (company[which].on_map) {
|
if (company[which].on_map) {
|
||||||
company[which].share_return *= randf() + COMPANY_RETURN_INC;
|
double change = randf() * RETURN_MAX_CHANGE;
|
||||||
}
|
if (randf() < DEC_COMPANY_RETURN) {
|
||||||
}
|
change = -change;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure that a company's return is not too large
|
company[which].share_return += change;
|
||||||
for (int i = 0; i < MAX_COMPANIES; i++) {
|
if ( company[which].share_return > MAX_COMPANY_RETURN
|
||||||
if (company[i].on_map && company[i].share_return > MAX_COMPANY_RETURN) {
|
|| company[which].share_return < MIN_COMPANY_RETURN) {
|
||||||
company[i].share_return /= randf() + RETURN_DIVIDER;
|
company[which].share_return -= 2.0 * change;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase or decrease share price
|
// Increase or decrease share price
|
||||||
if (randf() < INC_SHARE_PRICE) {
|
if (randf() < CHANGE_SHARE_PRICE) {
|
||||||
which = randi(MAX_COMPANIES);
|
which = randi(MAX_COMPANIES);
|
||||||
if (company[which].on_map) {
|
if (company[which].on_map) {
|
||||||
double change = randf() * company[which].share_price
|
double change = randf() * company[which].share_price
|
||||||
@ -1159,12 +1188,35 @@ void adjust_values (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Has the player lost money due to negative share returns?
|
||||||
|
if (player[current_player].cash < 0.0) {
|
||||||
|
double borrowed = -player[current_player].cash;
|
||||||
|
|
||||||
|
txdlgbox(MAX_DLG_LINES, 60, 7, WCENTER, attr_error_window,
|
||||||
|
attr_error_title, attr_error_highlight, 0, 0,
|
||||||
|
attr_error_waitforkey, _(" Interstellar Trading Bank "),
|
||||||
|
/* xgettext:c-format */
|
||||||
|
_("You were forced to borrow %N\n"
|
||||||
|
"to cover losses from company shares."),
|
||||||
|
borrowed);
|
||||||
|
txrefresh();
|
||||||
|
|
||||||
|
player[current_player].cash = 0.0;
|
||||||
|
player[current_player].debt += borrowed;
|
||||||
|
}
|
||||||
|
|
||||||
// Change the interest rate
|
// Change the interest rate
|
||||||
if (randf() < CHANGE_INTEREST_RATE) {
|
if (randf() < CHANGE_INTEREST_RATE) {
|
||||||
interest_rate *= randf() + INTEREST_RATE_INC;
|
double change = randf() * INTEREST_MAX_CHANGE;
|
||||||
}
|
if (randf() < DEC_INTEREST_RATE) {
|
||||||
if (interest_rate > MAX_INTEREST_RATE) {
|
change = -change;
|
||||||
interest_rate /= randf() + INTEREST_RATE_DIVIDER;
|
}
|
||||||
|
|
||||||
|
interest_rate += change;
|
||||||
|
if ( interest_rate > MAX_INTEREST_RATE
|
||||||
|
|| interest_rate < MIN_INTEREST_RATE) {
|
||||||
|
interest_rate -= 2.0 * change;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate current player's debt
|
// Calculate current player's debt
|
||||||
@ -1194,7 +1246,7 @@ void adjust_values (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Shall we declare them bankrupt?
|
// Shall we declare them bankrupt?
|
||||||
if (total_value(current_player) <= 0.0 && randf() < PROB_BANKRUPTCY) {
|
if (total_value(current_player) <= 0.0 && randf() < MAKE_BANKRUPT) {
|
||||||
bankrupt_player(true);
|
bankrupt_player(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user