From 9e4e4b6d1184a098238f2394f6230e9aecc73b37 Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Sat, 2 Jul 2011 14:53:45 +1000 Subject: [PATCH] Add intf.h and intf.c: basic text input/output interface routines --- src/README | 2 ++ src/globals.h | 5 ++--- src/intf.c | 32 ++++++++++++++++++++++++++++++++ src/intf.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/intf.c create mode 100644 src/intf.h diff --git a/src/README b/src/README index f9521f3..bdacd14 100644 --- a/src/README +++ b/src/README @@ -13,5 +13,7 @@ source code is split up among the following files: system.h - All system header files are included here globals.h - Global game constants and variables globals.c - Global game variables + intf.h - Basic text input/output header file + intf.c - Basic text input/output routines utils.h - Utility functions header file utils.c - Utility functions needed by Star Traders diff --git a/src/globals.h b/src/globals.h index a97b785..b54cbb0 100644 --- a/src/globals.h +++ b/src/globals.h @@ -39,9 +39,6 @@ * Constants and type declarations * ************************************************************************/ -#define MIN_COLUMNS (80) /* Minimum number of columns in terminal */ -#define MIN_LINES (24) /* Minimum number of lines in terminal */ - #define MAX_X (38) /* Map dimensions MAP_X x MAP_Y */ #define MAX_Y (12) #define STAR_RATIO (0.10) /* 10% of map should be stars */ @@ -107,6 +104,8 @@ typedef enum map_val { MAP_LAST = MAP_A + MAX_COMPANIES - 1 } map_val_t; +#define MAP_COMPANY(x) (MAP_A + x) + // Information about a move typedef struct move_rec { diff --git a/src/intf.c b/src/intf.c new file mode 100644 index 0000000..3fc955c --- /dev/null +++ b/src/intf.c @@ -0,0 +1,32 @@ +/************************************************************************ +* * +* Star Traders: A Game of Interstellar Trading * +* Copyright (C) 1990-2011, John Zaitseff * +* * +************************************************************************/ + +/* + Author: John Zaitseff + $Id$ + + This file, intf.c, contains the actual implementation of basic text + input/output routines as used in Star Traders. + + + 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/. +*/ + + +#include "system.h" +#include "intf.h" diff --git a/src/intf.h b/src/intf.h new file mode 100644 index 0000000..af1d82f --- /dev/null +++ b/src/intf.h @@ -0,0 +1,43 @@ +/************************************************************************ +* * +* Star Traders: A Game of Interstellar Trading * +* Copyright (C) 1990-2011, John Zaitseff * +* * +************************************************************************/ + +/* + Author: John Zaitseff + $Id$ + + This file, intf.h, contains function declarations for basic text input/ + output routines for Star Traders. + + + 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_INTF_H +#define included_INTF_H 1 + + +/************************************************************************ +* Constants and type declarations * +************************************************************************/ + +#define MIN_COLUMNS (80) /* Minimum number of columns in terminal */ +#define MIN_LINES (24) /* Minimum number of lines in terminal */ + + +#endif /* included_INTF_H */