/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* pr.c: Output to players
- *
+ *
* Known contributors to this file:
- * Dave Pare, 1986, 1989
+ * Dave Pare, 1986, 1989
* Steve McClure, 1998-2000
* Ron Koenderink, 2005
- * Markus Armbruster, 2005-2008
+ * Markus Armbruster, 2005-2009
*/
/*
#include "com.h"
#include "empio.h"
#include "file.h"
+#include "journal.h"
#include "misc.h"
#include "nat.h"
#include "player.h"
if (p->curid >= 0) {
io_puts(p->iop, "\n");
+ journal_output(p, p->curid, "\n");
p->curid = -1;
}
va_start(ap, format);
if (!(pl->flags & PF_UTF8))
copy_utf8_to_ascii_no_funny(buf, buf);
pr_player(pl, C_FLASH, buf);
- io_output(pl->iop, IO_NOWAIT);
+ io_output(pl->iop, 0);
}
/*
(void)vsprintf(buf, format, ap);
va_end(ap);
pr_player(pl, C_INFORM, buf);
- io_output(pl->iop, IO_NOWAIT);
+ io_output(pl->iop, 0);
}
/*
va_start(ap, format);
(void)vsprintf(buf + n, format, ap);
va_end(ap);
- for (p = player_next(0); p; p = player_next(p)) {
+ for (p = player_next(NULL); p; p = player_next(p)) {
if (p->state != PS_PLAYING)
continue;
pr_player(p, C_FLASH, buf);
- io_output(p->iop, IO_NOWAIT);
+ io_output(p->iop, 0);
}
}
p = strchr(bp, '\n');
if (p != NULL) {
len = (p - bp) + 1;
- if ((pl->command && (pl->command->c_flags & C_MOD)) ||
- (player != pl))
- io_write(pl->iop, bp, len, IO_NOWAIT);
- else
- io_write(pl->iop, bp, len, IO_WAIT);
+ io_write(pl->iop, bp, len);
bp += len;
pl->curid = -1;
} else {
bp += len;
}
}
+
+ journal_output(pl, id, buf);
+
+ if (player == pl) {
+ while (io_output_if_queue_long(pl->iop,
+ pl->may_sleep == PLAYER_SLEEP_FREELY) > 0)
+ ;
+ }
}
/*
}
}
if (ch == '\n') {
- if ((pl->command && (pl->command->c_flags & C_MOD)) ||
- (player != pl))
- io_write(pl->iop, &ch, 1, IO_NOWAIT);
- else
- io_write(pl->iop, &ch, 1, IO_WAIT);
+ io_write(pl->iop, &ch, 1);
pl->curid = -1;
} else {
printbuf[0] = ch;
io_puts(pl->iop, printbuf);
}
}
+
+ journal_output(pl, id, buf);
+
+ if (player == pl) {
+ while (io_output_if_queue_long(pl->iop,
+ pl->may_sleep == PLAYER_SLEEP_FREELY) > 0)
+ ;
+ }
}
/*