(effadv_list, effadv, rejects, rejectname, telnames, rea, numnames,

tennames, numstr): Replace by static local variables in their only
user.
(relates): Move from global/misc.c to common/nat.c.
(att_mode): Move from global/misc.c to subs/attsub.c.
This commit is contained in:
Markus Armbruster 2004-02-19 19:14:29 +00:00
parent 22a356b1e1
commit c8bb4d9b87
8 changed files with 56 additions and 134 deletions

View file

@ -159,6 +159,8 @@ struct fixnat {
int offset; int offset;
}; };
extern s_char *relates[];
/* procedures relating to nation stuff */ /* procedures relating to nation stuff */
#define putnat(n) \ #define putnat(n) \

View file

@ -55,7 +55,10 @@
int int
rea(void) rea(void)
{ {
extern s_char *telnames[]; static s_char *telnames[] = {
/* must follow TEL_ defines in tel.h */
"Telegram", "Announcement", "BULLETIN", "Production Report"
};
register s_char *p; register s_char *p;
register s_char *mbox; register s_char *mbox;
s_char mbox_buf[256]; /* Maximum path length */ s_char mbox_buf[256]; /* Maximum path length */

View file

@ -36,6 +36,12 @@
#include "file.h" #include "file.h"
#include "optlist.h" #include "optlist.h"
s_char *relates[] = {
/* must follow nation relation defines in nat.h */
"At War", "Sitzkrieg", "Mobilizing", "Hostile", "Neutral", "Friendly",
"Allied"
};
s_char * s_char *
cname(natid n) cname(natid n)
{ {
@ -49,15 +55,31 @@ cname(natid n)
s_char * s_char *
relatename(struct natstr *np, natid other) relatename(struct natstr *np, natid other)
{ {
extern s_char *relates[];
return relates[getrel(np, other)]; return relates[getrel(np, other)];
} }
s_char * s_char *
rejectname(struct natstr *np, natid other) rejectname(struct natstr *np, natid other)
{ {
extern s_char *rejects[]; s_char *rejects[] = {
/* must follow reject flags defined in nat.h */
" YES YES YES YES",
" NO YES YES YES",
" YES NO YES YES",
" NO NO YES YES",
" YES YES NO YES",
" NO YES NO YES",
" YES NO NO YES",
" NO NO NO YES",
" YES YES YES NO ",
" NO YES YES NO ",
" YES NO YES NO ",
" NO NO YES NO ",
" YES YES NO NO ",
" NO YES NO NO ",
" YES NO NO NO ",
" NO NO NO NO "
};
return rejects[getrejects(other, np)]; return rejects[getrejects(other, np)];
} }

View file

@ -38,8 +38,18 @@
s_char * s_char *
numstr(s_char *buf, int n) numstr(s_char *buf, int n)
{ {
extern s_char *numnames[]; static s_char *numnames[] = {
extern s_char *tennames[]; "zero", "one", "two", "three", "four", "five", "six",
"seven", "eight", "nine", "ten", "eleven", "twelve",
"thirteen", "fourteen", "fifteen", "sixteen",
"seventeen", "eighteen", "nineteen",
};
static s_char *tennames[] = {
"", "", "twenty", "thirty", "forty", "fifty",
"sixty", "seventy", "eighty", "ninety",
"hundred", "hundred ten", "hundred twenty",
"hundred thirty", 0,
};
if (n > 100) { if (n > 100) {
(void)strcpy(buf, "several"); (void)strcpy(buf, "several");
@ -62,7 +72,9 @@ numstr(s_char *buf, int n)
s_char * s_char *
effadv(int n) effadv(int n)
{ {
extern s_char *effadv_list[]; static s_char *effadv_list[] = {
"minimally", "partially", "moderately", "completely",
};
if (n < 0) if (n < 0)
n = 0; n = 0;

View file

@ -35,12 +35,12 @@ include ../../make.defs
LIB = $(SRCDIR)/lib/libglobal.a LIB = $(SRCDIR)/lib/libglobal.a
NTLIB = $(SRCDIR)\lib\libglobal.lib NTLIB = $(SRCDIR)\lib\libglobal.lib
OBJS = constants.o dir.o file.o init.o item.o land.o misc.o news.o nsc.o \ OBJS = constants.o dir.o file.o init.o item.o land.o news.o nsc.o \
nuke.o numnames.o options.o path.o plane.o product.o sect.o ship.o\ nuke.o options.o path.o plane.o product.o sect.o ship.o\
treaty.o treaty.o
NTOBJS = constants.obj dir.obj file.obj init.obj item.obj land.obj misc.obj \ NTOBJS = constants.obj dir.obj file.obj init.obj item.obj land.obj \
news.obj nsc.obj nuke.obj numnames.obj options.obj path.obj plane.obj \ news.obj nsc.obj nuke.obj options.obj path.obj plane.obj \
product.obj sect.obj ship.obj treaty.obj product.obj sect.obj ship.obj treaty.obj
all: $(LIB) all: $(LIB)

View file

@ -1,73 +0,0 @@
/*
* Empire - A multi-player, client/server Internet based war game.
* Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ---
*
* See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
* related information and legal notices. It is expected that any future
* projects/authors will amend these files as needed.
*
* ---
*
* misc.c: Misc type description lists
*
* Known contributors to this file:
*
*/
#include "misc.h"
s_char *effadv_list[] = {
"minimally", "partially", "moderately", "completely", 0,
};
/* must follow nation relation defines in nat.h */
s_char *relates[] = {
"At War", "Sitzkrieg", "Mobilizing", "Hostile", "Neutral", "Friendly",
"Allied"
};
/* must follow reject flags defined in nat.h */
s_char *rejects[] = {
" YES YES YES YES",
" NO YES YES YES",
" YES NO YES YES",
" NO NO YES YES",
" YES YES NO YES",
" NO YES NO YES",
" YES NO NO YES",
" NO NO NO YES",
" YES YES YES NO ",
" NO YES YES NO ",
" YES NO YES NO ",
" NO NO YES NO ",
" YES YES NO NO ",
" NO YES NO NO ",
" YES NO NO NO ",
" NO NO NO NO "
};
/* must follow TEL_ defines in tel.h */
s_char *telnames[] = {
"Telegram", "Announcement", "BULLETIN", "Production Report"
};
s_char *att_mode[] = {
"defend", "attack", "assault", "paradrop", "board", "lboard"
};

View file

@ -1,48 +0,0 @@
/*
* Empire - A multi-player, client/server Internet based war game.
* Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ---
*
* See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
* related information and legal notices. It is expected that any future
* projects/authors will amend these files as needed.
*
* ---
*
* numnames.c: Strings used to convert numbers to strings
*
* Known contributors to this file:
*
*/
#include "misc.h"
s_char *numnames[] = {
"zero", "one", "two", "three", "four", "five", "six",
"seven", "eight", "nine", "ten", "eleven", "twelve",
"thirteen", "fourteen", "fifteen", "sixteen",
"seventeen", "eighteen", "nineteen",
};
s_char *tennames[] = {
"", "", "twenty", "thirty", "forty", "fifty",
"sixty", "seventy", "eighty", "ninety",
"hundred", "hundred ten", "hundred twenty",
"hundred thirty", 0,
};

View file

@ -83,11 +83,15 @@ static void send_reacting_units_home(struct combat *def,
static int take_def(int combat_mode, struct emp_qelem *list, static int take_def(int combat_mode, struct emp_qelem *list,
struct combat *off, struct combat *def); struct combat *off, struct combat *def);
void att_move_in_off(int combat_mode, struct combat *off,
struct emp_qelem *olist, struct combat *def);
static int get_land(int combat_mode, struct combat *def, int uid, static int get_land(int combat_mode, struct combat *def, int uid,
struct llist *llp, int victim_land); struct llist *llp, int victim_land);
s_char *att_mode[] = {
/* must match combat types in combat.h */
"defend", "attack", "assault", "paradrop", "board", "lboard"
};
/* /*
* The principal object in this code is the "combat" object. A combat object * The principal object in this code is the "combat" object. A combat object
* is either a sector or ship. There are * is either a sector or ship. There are