diff options
author | dholland <dholland@NetBSD.org> | 2009-03-14 22:52:52 +0000 |
---|---|---|
committer | dholland <dholland@NetBSD.org> | 2009-03-14 22:52:52 +0000 |
commit | e98a44895c7ca5a00b080fce0b3cbb16bcdff859 (patch) | |
tree | a74a3e03e0056c3de3d2b751b6dea1f59baec1c7 /sail/dr_3.c | |
parent | 5e8d1f0902b592fc872212ecccaca23c8ce85231 (diff) | |
download | bsdgames-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_3.c')
-rw-r--r-- | sail/dr_3.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sail/dr_3.c b/sail/dr_3.c index 8d880c34..eb0280ea 100644 --- a/sail/dr_3.c +++ b/sail/dr_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_3.c,v 1.18 2009/03/14 20:04:43 dholland Exp $ */ +/* $NetBSD: dr_3.c,v 1.19 2009/03/14 22:52:52 dholland Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_3.c,v 1.18 2009/03/14 20:04:43 dholland Exp $"); +__RCSID("$NetBSD: dr_3.c,v 1.19 2009/03/14 22:52:52 dholland Exp $"); #endif #endif /* not lint */ @@ -143,8 +143,8 @@ moveall(void) if (dieroll() < 4) { makesignal(sp, "fouled with $$", sq); - Write(W_FOUL, sp, l, 0, 0, 0); - Write(W_FOUL, sq, n, 0, 0, 0); + send_foul(sp, l); + send_foul(sq, n); } snap++; } @@ -175,13 +175,13 @@ moveall(void) if (sp->file->dir != 0) { *sp->file->movebuf = 0; if (row[n] != sp->file->row) - Write(W_ROW, sp, sp->file->row, 0, 0, 0); + send_row(sp, sp->file->row); if (col[n] != sp->file->col) - Write(W_COL, sp, sp->file->col, 0, 0, 0); + send_col(sp, sp->file->col); if (dir[n] != sp->file->dir) - Write(W_DIR, sp, sp->file->dir, 0, 0, 0); + send_dir(sp, sp->file->dir); if (drift[n] != sp->file->drift) - Write(W_DRIFT, sp, sp->file->drift, 0, 0, 0); + send_drift(sp, sp->file->drift); } n++; } @@ -275,8 +275,11 @@ sendbp(struct ship *from, struct ship *to, int sections, int isdefense) for (n = 0; n < NBP && bp[n].turnsent; n++) ; if (n < NBP && sections) { - Write(isdefense ? W_DBP : W_OBP, from, - n, turn, to->file->index, sections); + if (isdefense) { + send_dbp(from, n, turn, to->file->index, sections); + } else { + send_obp(from, n, turn, to->file->index, sections); + } if (isdefense) makemsg(from, "repelling boarders"); else @@ -352,6 +355,6 @@ checksails(void) full = 0; } if ((sp->file->FS != 0) != full) - Write(W_FS, sp, full, 0, 0, 0); + send_fs(sp, full); } } |