Abstract from shutdown initiation mechanism:

(shutdown_initiate): New.
(shut): Use it.  Shutdown in zero minutes no longer cancels the
shutdown, it just works.  Use negative argument to cancel.  Logging is
less detailed.
(shutdown_sequence): Internal linkage.

(pr_wall): All callers prefix text it with the same header.  Move it
into the function.
This commit is contained in:
Markus Armbruster 2007-01-20 20:40:52 +00:00
parent 516f42e063
commit 84cfd670ce
5 changed files with 70 additions and 59 deletions

View file

@ -182,17 +182,26 @@ pr_inform(struct player *pl, char *format, ...)
* Send C_FLASH text to everyone.
* Format text to send using printf-style FORMAT and optional
* arguments. It is assumed to be plain ASCII.
* Prefix text it with a header suitable for broadcast from deity.
* Initiate an output queue flush, but do not wait for it to complete.
*/
void
pr_wall(char *format, ...)
{
time_t now;
struct tm *tm;
char buf[4096]; /* UTF-8 */
int n;
struct player *p;
va_list ap;
time(&now);
tm = localtime(&now);
n = sprintf(buf, "BROADCAST from %s @ %02d:%02d: ",
getnatp(0)->nat_cnam, tm->tm_hour, tm->tm_min);
va_start(ap, format);
(void)vsprintf(buf, format, ap);
(void)vsprintf(buf + n, format, ap);
va_end(ap);
for (p = player_next(0); p; p = player_next(p)) {
if (p->state != PS_PLAYING)