tBankInterest and DebtInterest variables added, to allow the configuration of i… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 2da60e8880eb0ab78a850d15d2293f5500bd1b0d | |
parent e025b5945b45674c8eb8aa93c185a9bc34bd3839 | |
Author: Ben Webb <[email protected]> | |
Date: Tue, 16 Jul 2002 17:09:31 +0000 | |
BankInterest and DebtInterest variables added, to allow the configuration | |
of interest rates. | |
Diffstat: | |
M doc/configfile.html | 8 ++++++++ | |
M src/dopewars.c | 7 +++++++ | |
M src/dopewars.h | 1 + | |
M src/serverside.c | 6 ++++-- | |
4 files changed, 20 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/doc/configfile.html b/doc/configfile.html | |
t@@ -464,6 +464,14 @@ against a player.</dd> | |
<h2><a id="advanced">Advanced configuration</a></h2> | |
<dl> | |
+<dt><b>DebtInterest=<i>10</i></b></dt> | |
+<dd>Increases your debt to the loan shark by <i>10%</i> every turn. Negative | |
+numbers can also be used here, to have the debt shrink every day.</dd> | |
+ | |
+<dt><b>BankInterest=<i>5</i></b></dt> | |
+<dd>Adds interest at a rate of <i>5%</i> per turn to your bank balance. | |
+</dd> | |
+ | |
<dt><b>Currrency.Symbol=<i>$</i></b></dt> | |
<dd>Uses the dollar (<i>$</i>) symbol to display all prices of drugs, guns, | |
etc.</dd> | |
diff --git a/src/dopewars.c b/src/dopewars.c | |
t@@ -95,6 +95,7 @@ gint ConfigErrors = 0; | |
ClientType WantedClient; | |
int NumLocation = 0, NumGun = 0, NumCop = 0, NumDrug = 0, NumSubway = 0; | |
int NumPlaying = 0, NumStoppedTo = 0; | |
+int DebtInterest = 10, BankInterest = 5; | |
Player Noone; | |
int LoanSharkLoc = DEFLOANSHARK, BankLoc = DEFBANK, GunShopLoc = | |
DEFGUNSHOP; | |
t@@ -372,6 +373,12 @@ struct GLOBALS Globals[] = { | |
{&RoughPubLoc, NULL, NULL, NULL, NULL, "RoughPub", | |
N_("Location of the pub"), | |
NULL, NULL, 0, "", NULL, NULL, FALSE, 0}, | |
+ {&DebtInterest, NULL, NULL, NULL, NULL, "DebtInterest", | |
+ N_("Daily interest rate on the loan shark debt"), | |
+ NULL, NULL, 0, "", NULL, NULL, FALSE, 0}, | |
+ {&BankInterest, NULL, NULL, NULL, NULL, "BankInterest", | |
+ N_("Daily interest rate on your bank balance"), | |
+ NULL, NULL, 0, "", NULL, NULL, FALSE, 0}, | |
{NULL, NULL, NULL, &Names.LoanSharkName, NULL, "LoanSharkName", | |
N_("Name of the loan shark"), NULL, NULL, 0, "", NULL, NULL, FALSE, 0}, | |
{NULL, NULL, NULL, &Names.BankName, NULL, "BankName", | |
diff --git a/src/dopewars.h b/src/dopewars.h | |
t@@ -167,6 +167,7 @@ extern unsigned Port; | |
extern gboolean Sanitized, ConfigVerbose, DrugValue; | |
extern int NumLocation, NumGun, NumCop, NumDrug, NumSubway, NumPlaying, | |
NumStoppedTo; | |
+extern int DebtInterest, BankInterest; | |
extern gchar *HiScoreFile, *ServerName, *ConvertFile, *ServerMOTD, | |
*WantedPlugin, *BindAddress; | |
extern gboolean WantHelp, WantVersion, WantAntique, WantColour, | |
diff --git a/src/serverside.c b/src/serverside.c | |
t@@ -524,8 +524,10 @@ void HandleServerMessage(gchar *buf, Player *Play) | |
GetPlayerName(Play), Location[i].Name); | |
Play->IsAt = i; | |
Play->Turn++; | |
- Play->Debt = (price_t)((float)Play->Debt * 1.1); | |
- Play->Bank = (price_t)((float)Play->Bank * 1.05); | |
+ Play->Debt = Play->Debt * (DebtInterest + 100) / 100; | |
+ Play->Debt = MAX(Play->Debt, 0); | |
+ Play->Bank = Play->Bank * (BankInterest + 100) / 100; | |
+ Play->Bank = MAX(Play->Bank, 0); | |
SendPlayerData(Play); | |
Play->EventNum = E_SUBWAY; | |
SendEvent(Play); |