-/* $NetBSD: pl_main.c,v 1.20 2009/03/14 18:32:47 dholland Exp $ */
+/* $NetBSD: pl_main.c,v 1.26 2009/03/15 03:33:56 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_main.c,v 1.20 2009/03/14 18:32:47 dholland Exp $");
+__RCSID("$NetBSD: pl_main.c,v 1.26 2009/03/15 03:33:56 dholland Exp $");
#endif
#endif /* not lint */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "display.h"
#include "extern.h"
#include "player.h"
#include "restart.h"
-static void initialize(void);
+static void initialize(void);
/*ARGSUSED*/
int
pl_main(void)
{
-
initialize();
Msg("Aye aye, Sir");
play();
nat[n] = 0;
foreachship(sp) {
if (sp->file == NULL &&
- (sp->file = (struct File *)calloc(1, sizeof (struct File))) == NULL) {
+ (sp->file = calloc(1, sizeof (struct File))) == NULL) {
err(1, "calloc");
}
sp->file->index = sp - SHIP(0);
if (sp >= ls) {
puts("All ships taken in that scenario.");
foreachship(sp)
- free((char *)sp->file);
+ free(sp->file);
sync_close(0);
people = 0;
goto reprint;
mf = ms->file;
mc = ms->specs;
- Write(W_BEGIN, ms, 0, 0, 0, 0);
+ send_begin(ms);
if (Sync() < 0)
leave(LEAVE_SYNC);
longjmp(restart, MODE_DRIVER);
/*NOTREACHED*/
case -1:
- perror("fork");
+ warn("fork");
leave(LEAVE_FORK);
break;
default:
printf("Your ship is the %s, a %d gun %s (%s crew).\n",
ms->shipname, mc->guns, classname[mc->class],
qualname[mc->qual]);
- if ((nameptr = (char *) getenv("SAILNAME")) && *nameptr)
+ if ((nameptr = getenv("SAILNAME")) && *nameptr)
strlcpy(captain, nameptr, sizeof captain);
else {
printf("Your name, Captain? ");
else
captain[strlen(captain) - 1] = '\0';
}
- Writestr(W_CAPTAIN, ms, captain);
+ send_captain(ms, captain);
for (n = 0; n < 2; n++) {
char buf[10];
printf("\n");
fflush(stdout);
initscreen();
- draw_board();
+ display_redraw();
snprintf(message, sizeof message, "Captain %s assuming command",
captain);
- Writestr(W_SIGNAL, ms, message);
+ send_signal(ms, message);
newturn(0);
}