2011-07-04 01:54:39 -04:00
|
|
|
/************************************************************************
|
|
|
|
* *
|
|
|
|
* Star Traders: A Game of Interstellar Trading *
|
2012-03-14 11:36:23 -04:00
|
|
|
* Copyright (C) 1990-2012, John Zaitseff *
|
2011-07-04 01:54:39 -04:00
|
|
|
* *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
Author: John Zaitseff <J.Zaitseff@zap.org.au>
|
|
|
|
$Id$
|
|
|
|
|
2011-07-15 19:58:53 -04:00
|
|
|
This file, game.h, contains declarations for the starting and ending
|
2011-07-21 20:49:26 -04:00
|
|
|
game functions used in Star Traders. It also contains prototypes of
|
|
|
|
functions for displaying the galaxy map and the player's status.
|
2011-07-04 01:54:39 -04:00
|
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef included_GAME_H
|
|
|
|
#define included_GAME_H 1
|
|
|
|
|
|
|
|
|
2011-07-11 02:14:07 -04:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
2011-07-19 06:32:00 -04:00
|
|
|
* Game function prototypes *
|
2011-07-11 02:14:07 -04:00
|
|
|
************************************************************************/
|
|
|
|
|
2011-07-21 20:49:26 -04:00
|
|
|
/*
|
|
|
|
Function: init_game - Initialise a new game or load an old one
|
|
|
|
Parameters: (none)
|
|
|
|
Returns: (nothing)
|
|
|
|
|
|
|
|
This function initialises all game variables and structures, either by
|
|
|
|
creating a new game or by loading an old one from disk. In particular,
|
|
|
|
if a new game is to be created, it asks how many people will play, and
|
|
|
|
what their names are. If needed, instructions on how to play the game
|
|
|
|
are also displayed.
|
|
|
|
|
|
|
|
On entry to this function, the global variable game_num determines
|
|
|
|
whether an old game is loaded (if possible). If option_max_turn
|
|
|
|
contains a non-zero value, it is used to initialise max_turn.
|
|
|
|
|
|
|
|
On exit, all global variables in globals.h are initialised, apart from
|
|
|
|
game_move[] (and the previously-set option_XXX variables). If the user
|
|
|
|
aborts entering the necessary information, abort_game is set to true.
|
|
|
|
*/
|
2011-07-14 07:44:18 -04:00
|
|
|
extern void init_game (void);
|
2011-07-21 20:49:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Function: end_game - Finish playing the current game
|
|
|
|
Parameters: (none)
|
|
|
|
Returns: (nothing)
|
|
|
|
|
|
|
|
This function displays every player's status before declaring the
|
|
|
|
winner of the game. Note that turn_number is used instead of max_turns
|
|
|
|
as select_moves() may terminate the game earlier.
|
|
|
|
*/
|
2011-07-14 07:44:18 -04:00
|
|
|
extern void end_game (void);
|
2011-07-11 02:14:07 -04:00
|
|
|
|
2011-07-21 20:49:26 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
Function: show_map - Display the galaxy map on the screen
|
|
|
|
Parameters: closewin - Wait for user, then close window if true
|
|
|
|
Returns: (nothing)
|
|
|
|
|
|
|
|
This function displays the galaxy map on the screen, using the global
|
|
|
|
variable galaxy_map[][] to do so. If closewin is true, a prompt is
|
|
|
|
shown for the user to press any key; the map window is then closed. If
|
|
|
|
closewin is false, no prompt is shown, wrefresh() is NOT called and the
|
|
|
|
text window must be closed by the caller.
|
|
|
|
*/
|
|
|
|
extern void show_map (bool closewin);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Function: show_status - Display the player's status
|
|
|
|
Parameters: num - Player number (0 to number_players - 1)
|
|
|
|
Returns: (nothing)
|
|
|
|
|
|
|
|
This function displays the financial status of the player num, using
|
|
|
|
the global variable player[num] to do so. The show status window is
|
|
|
|
closed before returning from this function.
|
|
|
|
*/
|
2011-07-15 03:46:57 -04:00
|
|
|
extern void show_status (int num);
|
2011-07-21 20:49:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Function: total_value - Calculate a player's total financial worth
|
|
|
|
Parameters: num - Player number (0 to number_players - 1)
|
|
|
|
Returns: double - Financial value of player
|
|
|
|
|
|
|
|
This function calculates the total financial value (worth) of the
|
|
|
|
player num, using the global variables player[num] and company[] to do
|
|
|
|
so.
|
|
|
|
*/
|
2011-07-15 03:46:57 -04:00
|
|
|
extern double total_value (int num);
|
2011-07-14 21:19:14 -04:00
|
|
|
|
2011-07-11 02:14:07 -04:00
|
|
|
|
2011-07-04 01:54:39 -04:00
|
|
|
#endif /* included_GAME_H */
|