tIf NumStoppedTo, NumSubwaySaying, or NumPlaying are zero, the relevant features are now disabled (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 4577540421b0c3d0f7ea532262e342c43daf74d9
(DIR) parent 2aa302aa4c27973a0cfb782c1c1ff5c5b37f0f73
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Sat, 6 Apr 2002 19:52:06 +0000
If NumStoppedTo, NumSubwaySaying, or NumPlaying are zero, the relevant
features are now disabled (rather than crashing the program).
Diffstat:
M src/serverside.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/src/serverside.c b/src/serverside.c
t@@ -2183,8 +2183,15 @@ void SendEvent(Player *To)
}
break;
case E_SAYING:
- if (!Sanitized && (brandom(0, 100) < 15)) {
- if (brandom(0, 100) < 50) {
+ if (!Sanitized && brandom(0, 100) < 15
+ && (NumSubway > 0 || NumPlaying > 0)) {
+ int subwaychance = 50;
+
+ if (NumSubway == 0)
+ subwaychance = 0;
+ if (NumPlaying == 0)
+ subwaychance = 100;
+ if (brandom(0, 100) < subwaychance) {
text = g_strdup_printf(_("The lady next to you on the subway "
"said,^ \"%s\"%s"),
SubwaySaying[brandom(0, NumSubway)],
t@@ -2970,7 +2977,7 @@ int RandomOffer(Player *To)
SendQuestion(NULL, C_NONE, To, text->str);
g_string_free(text, TRUE);
return 1;
- } else {
+ } else if (NumStoppedTo > 0) {
g_string_sprintf(text, _("You stopped to %s."),
StoppedTo[brandom(0, NumStoppedTo)]);
amount = brandom(1, 10);