tSetting NumCop to zero now just disables attacks by the cops, rather than crashing the program. - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 8489be5297890ee645af9829744b84dc55b9223d
(DIR) parent 4577540421b0c3d0f7ea532262e342c43daf74d9
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Sat, 6 Apr 2002 19:52:23 +0000
Setting NumCop to zero now just disables attacks by the cops, rather than
crashing the program.
Diffstat:
M doc/configfile.html | 3 ++-
M src/serverside.c | 24 ++++++++++++++++--------
2 files changed, 18 insertions(+), 9 deletions(-)
---
(DIR) diff --git a/doc/configfile.html b/doc/configfile.html
t@@ -400,7 +400,8 @@ when you have no bitches.</dd>
<dt><b>NumCop=<i>3</i></b></dt>
<dd>Configures the game to have <i>3</i> cops. If you kill the first one, you
will later be attacked by the second one, and so on. (The last cop is 'undead'
-and will return even if you kill him.)</dd>
+and will return even if you kill him.) If you set this to zero, then you
+will never be attacked by the cops.</dd>
<dt><b>Cop[<i>1</i>].Name=<i>Officer Hardass</i></b></dt>
<dd>Names the first cop to attack you <i>"Officer Hardass"</i>.</dd>
(DIR) diff --git a/src/serverside.c b/src/serverside.c
t@@ -2311,7 +2311,7 @@ int SendCopOffer(Player *To, OfferForce Force)
return (OfferObject(To, Force == FORCEBITCH));
} else if (i < 50) {
return (RandomOffer(To));
- } else if (Sanitized) {
+ } else if (Sanitized || NumCop == 0) {
return 0;
} else {
CopsAttackPlayer(To);
t@@ -2328,6 +2328,11 @@ void CopsAttackPlayer(Player *Play)
Player *Cops;
gint CopIndex, NumDeputy, GunIndex;
+ if (NumCop == 0) {
+ g_warning(_("No cops!"));
+ return;
+ }
+
CopIndex = 1 - Play->CopIndex;
if (CopIndex < 0) {
g_warning(_("Cops cannot attack other cops!"));
t@@ -2613,7 +2618,7 @@ static void CheckCopsIntervene(Player *Play)
guint ArrayInd;
Player *Defend;
- if (!Play || !Play->FightArray)
+ if (!Play || !Play->FightArray || NumCop == 0)
return; /* Sanity check */
if (!Play->Attacking)
t@@ -3330,12 +3335,15 @@ void BuyObject(Player *From, char *data)
From->Cash -= amount * From->Drugs[index].Price;
SendPlayerData(From);
- if (!Sanitized && (From->Drugs[index].Price == 0 &&
- brandom(0,
- 100) <
- Location[From->IsAt].PolicePresence)) {
- SendPrintMessage(NULL, C_NONE, From,
- _("The cops spot you dropping drugs!"));
+ if (!Sanitized && NumCop > 0
+ && (From->Drugs[index].Price == 0 &&
+ brandom(0, 100) < Location[From->IsAt].PolicePresence)) {
+ gchar *text;
+
+ text = dpg_strdup_printf(_("The cops spot you dropping %tde!"),
+ Names.Drugs);
+ SendPrintMessage(NULL, C_NONE, From, text);
+ g_free(text);
CopsAttackPlayer(From);
}
}