From: Eric S. Raymond Date: Tue, 25 Jul 2006 16:58:26 +0000 (+0000) Subject: More display-code isolation. X-Git-Tag: 1.8~11 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=cde8c40d5e77ac07002c9caea7f377ecc5f09c9d;p=vms-empire.git More display-code isolation. --- diff --git a/compmove.c b/compmove.c index 5ee71bf..cdd8490 100644 --- a/compmove.c +++ b/compmove.c @@ -1153,28 +1153,28 @@ check_endgame () { /* see if game is over */ error ("you wish to smash the rest of the enemy? ",0,0,0,0,0,0,0,0); if (get_chx() != 'Y') empend (); - (void) addstr ("\nThe enemy inadvertantly revealed its code used for"); - (void) addstr ("\nreceiving battle information. You can display what"); - (void) addstr ("\nthey've learned with the ''E'' command."); + announce ("\nThe enemy inadvertantly revealed its code used for"); + announce ("\nreceiving battle information. You can display what"); + announce ("\nthey've learned with the ''E'' command."); resigned = TRUE; win = 2; automove = FALSE; } else if (ncomp_city == 0 && ncomp_army == 0) { clear_screen (); - (void) addstr ("The enemy is incapable of defeating you.\n"); - (void) addstr ("You are free to rape the empire as you wish.\n"); - (void) addstr ("There may be, however, remnants of the enemy fleet\n"); - (void) addstr ("to be routed out and destroyed.\n"); + announce ("The enemy is incapable of defeating you.\n"); + announce ("You are free to rape the empire as you wish.\n"); + announce ("There may be, however, remnants of the enemy fleet\n"); + announce ("to be routed out and destroyed.\n"); win = 1; automove = FALSE; } else if (nuser_city == 0 && nuser_army == 0) { clear_screen (); - (void) addstr ("You have been rendered incapable of\n"); - (void) addstr ("defeating the rampaging enemy fascists! The\n"); - (void) addstr ("empire is lost. If you have any ships left, you\n"); - (void) addstr ("may attempt to harass enemy shipping."); + announce ("You have been rendered incapable of\n"); + announce ("defeating the rampaging enemy fascists! The\n"); + announce ("empire is lost. If you have any ships left, you\n"); + announce ("may attempt to harass enemy shipping."); win = 1; automove = FALSE; } diff --git a/display.c b/display.c index 57674c1..81ac92b 100644 --- a/display.c +++ b/display.c @@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.10 2006/07/25 16:43:14 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ +/* $Id: display.c,v 1.11 2006/07/25 16:51:22 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ /* * Copyright (C) 1987, 1988 Chuck Simmons @@ -50,6 +50,13 @@ void init_colors() } #endif /* A_COLOR */ +/* +Used for win announcements + */ +void announce (char *msg) { + (void) addstr (msg); +} + /* This routine is called when the current display has been trashed and no sector is shown on the screen. diff --git a/extern.h b/extern.h index ae71ec0..9b7c8b6 100644 --- a/extern.h +++ b/extern.h @@ -1,4 +1,4 @@ -/* $Id: extern.h,v 1.8 2006/07/25 15:59:54 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ +/* $Id: extern.h,v 1.9 2006/07/25 16:43:14 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ /* * Copyright (C) 1987, 1988 Chuck Simmons @@ -140,6 +140,7 @@ int vmap_at_sea (view_map_t *vmap, long loc); int rmap_at_sea (long loc); /* display routines */ +void announce (char *); void redisplay(); void kill_display (); void sector_change (); diff --git a/term.c b/term.c index 67a823d..576adab 100644 --- a/term.c +++ b/term.c @@ -468,13 +468,5 @@ loc_disp (int loc) for (i = COL_DIGITS; i > 0; i--) { nrow *= 10; } move (LINES - 1, 0); - /* - { - char junkbuf[STRSIZE]; - (void) snprintf (junkbuf, STRSIZE, "loc: %d, row: %d, col: %d, nrow: %d, nrow+col: %d", loc, row, col, nrow, nrow + col); - (void) addstr (junkbuf); - napms(500); - } - */ return nrow + col; } diff --git a/usermove.c b/usermove.c index d858885..20ab45c 100644 --- a/usermove.c +++ b/usermove.c @@ -13,6 +13,7 @@ usermove.c -- Let the user move her troops. #include #include +#include #include "empire.h" #include "extern.h"