From 5f995f1d3631f7ac9f2bc011db94a2c70067491d Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Tue, 9 Aug 2011 13:11:22 +1000 Subject: [PATCH] Move the initialisation of the game title into its own function --- src/intf.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/intf.c b/src/intf.c index a1ccad7..a486ab5 100644 --- a/src/intf.c +++ b/src/intf.c @@ -96,6 +96,17 @@ txwin_t *firstwin = NULL; // First (bottom-most) txwin structure * Module-specific function prototypes * ************************************************************************/ +/* + Function: init_title - Draw the main window title + Parameters: (none) + Returns: (nothing) + + This function draws the main window game title, "Star Traders", and + clears the rest of the screen. +*/ +static void init_title (void); + + /* Function: sigterm_handler - Handle program termination signals Parameters: sig - Signal number @@ -254,18 +265,7 @@ void init_screen (void) attr_error_waitforkey = A_REVERSE; } - bkgd(attr_root_window); - clear(); - - move(0, 0); - for (int i = 0; i < COLS; i++) { - addch(attr_game_title | ' '); - } - - center(stdscr, 0, attr_game_title, "Star Traders"); - - attrset(attr_root_window); - refresh(); + init_title(); } @@ -287,6 +287,26 @@ void end_screen (void) } +/***********************************************************************/ +// init_title: Draw the main window title + +void init_title (void) +{ + bkgd(attr_root_window); + clear(); + + move(0, 0); + for (int i = 0; i < COLS; i++) { + addch(attr_game_title | ' '); + } + + center(stdscr, 0, attr_game_title, "Star Traders"); + + attrset(attr_root_window); + refresh(); +} + + /***********************************************************************/ // sigterm_handler: Handle program termination signals