summaryrefslogtreecommitdiffstats
path: root/sail/dr_2.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-03-14 22:52:52 +0000
committerdholland <dholland@NetBSD.org>2009-03-14 22:52:52 +0000
commite98a44895c7ca5a00b080fce0b3cbb16bcdff859 (patch)
treea74a3e03e0056c3de3d2b751b6dea1f59baec1c7 /sail/dr_2.c
parent5e8d1f0902b592fc872212ecccaca23c8ce85231 (diff)
downloadbsdgames-darwin-e98a44895c7ca5a00b080fce0b3cbb16bcdff859.tar.gz
bsdgames-darwin-e98a44895c7ca5a00b080fce0b3cbb16bcdff859.tar.zst
bsdgames-darwin-e98a44895c7ca5a00b080fce0b3cbb16bcdff859.zip
Create some abstraction for sending messages.
Make a send and receive function for each possible message. Make these have useful argument signatures. Hide the list of message codes inside sync.c.
Diffstat (limited to 'sail/dr_2.c')
-rw-r--r--sail/dr_2.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sail/dr_2.c b/sail/dr_2.c
index 460f24ff..a761fb1d 100644
--- a/sail/dr_2.c
+++ b/sail/dr_2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_2.c,v 1.24 2009/03/14 20:04:43 dholland Exp $ */
+/* $NetBSD: dr_2.c,v 1.25 2009/03/14 22:52:52 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_2.c,v 1.24 2009/03/14 20:04:43 dholland Exp $");
+__RCSID("$NetBSD: dr_2.c,v 1.25 2009/03/14 22:52:52 dholland Exp $");
#endif
#endif /* not lint */
@@ -105,8 +105,12 @@ checkup(void)
continue;
if (dieroll() < 5)
continue;
- Write(sink == 1 ? W_SINK : W_EXPLODE, sp, 2, 0, 0, 0);
- Write(W_DIR, sp, 0, 0, 0, 0);
+ if (sink == 1) {
+ send_sink(sp, 2);
+ } else {
+ send_explode(sp, 2);
+ }
+ send_dir(sp, 0);
if (snagged(sp))
foreachship(sq)
cleansnag(sp, sq, 1);
@@ -136,12 +140,11 @@ prizecheck(void)
continue;
if (sp->specs->crew1 + sp->specs->crew2 + sp->specs->crew3 >
sp->file->pcrew * 6) {
- Writestr(W_SIGNAL, sp, "prize crew overthrown");
- Write(W_POINTS, sp->file->captured,
+ send_signal(sp, "prize crew overthrown");
+ send_points(sp->file->captured,
sp->file->captured->file->points
- - 2 * sp->specs->pts,
- 0, 0, 0);
- Write(W_CAPTURED, sp, -1, 0, 0, 0);
+ - 2 * sp->specs->pts);
+ send_captured(sp, -1);
}
}
}