relations: Encapsulate relates[] in relations_string()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
0b05f11d28
commit
129fe58c19
3 changed files with 15 additions and 10 deletions
|
@ -177,8 +177,6 @@ struct rejectstr {
|
||||||
unsigned char rej_rejects[MAXNOC];
|
unsigned char rej_rejects[MAXNOC];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char *relates[];
|
|
||||||
|
|
||||||
/* procedures relating to nation stuff */
|
/* procedures relating to nation stuff */
|
||||||
|
|
||||||
#define putnat(p) ef_write(EF_NATION, (p)->nat_cnum, (p))
|
#define putnat(p) ef_write(EF_NATION, (p)->nat_cnum, (p))
|
||||||
|
@ -205,6 +203,7 @@ extern char *relatename(struct natstr *np, natid other);
|
||||||
extern char *natstate(struct natstr *np);
|
extern char *natstate(struct natstr *np);
|
||||||
extern enum relations getrel(struct natstr *np, natid them);
|
extern enum relations getrel(struct natstr *np, natid them);
|
||||||
extern enum relations relations_with(natid, natid);
|
extern enum relations relations_with(natid, natid);
|
||||||
|
extern char *relations_string(enum relations);
|
||||||
extern int nat_accepts(natid, natid, enum rej_comm);
|
extern int nat_accepts(natid, natid, enum rej_comm);
|
||||||
extern int in_contact(natid, natid);
|
extern int in_contact(natid, natid);
|
||||||
extern void agecontact(struct natstr *np);
|
extern void agecontact(struct natstr *np);
|
||||||
|
|
|
@ -41,11 +41,6 @@
|
||||||
#include "sect.h"
|
#include "sect.h"
|
||||||
#include "tel.h"
|
#include "tel.h"
|
||||||
|
|
||||||
char *relates[] = {
|
|
||||||
/* must match enum relations */
|
|
||||||
"At War", "Hostile", "Neutral", "Friendly", "Allied"
|
|
||||||
};
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
cname(natid n)
|
cname(natid n)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +54,7 @@ cname(natid n)
|
||||||
char *
|
char *
|
||||||
relatename(struct natstr *np, natid other)
|
relatename(struct natstr *np, natid other)
|
||||||
{
|
{
|
||||||
return relates[getrel(np, other)];
|
return relations_string(getrel(np, other));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -89,6 +84,17 @@ relations_with(natid us, natid them)
|
||||||
return us == them ? ALLIED : getrel(getnatp(us), them);
|
return us == them ? ALLIED : getrel(getnatp(us), them);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
relations_string(enum relations rel)
|
||||||
|
{
|
||||||
|
static char *relates[] = {
|
||||||
|
/* must match enum relations */
|
||||||
|
"At War", "Hostile", "Neutral", "Friendly", "Allied"
|
||||||
|
};
|
||||||
|
|
||||||
|
return relates[rel];
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nat_accepts(natid us, natid them, enum rej_comm what)
|
nat_accepts(natid us, natid them, enum rej_comm what)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,11 +86,11 @@ setrel(natid us, natid them, enum relations rel)
|
||||||
if (addendum && us == player->cnum && !update_running)
|
if (addendum && us == player->cnum && !update_running)
|
||||||
pr("%s\n", addendum);
|
pr("%s\n", addendum);
|
||||||
mpr(us, "Diplomatic relations with %s %s to \"%s\".\n",
|
mpr(us, "Diplomatic relations with %s %s to \"%s\".\n",
|
||||||
cname(them), whichway, relates[rel]);
|
cname(them), whichway, relations_string(rel));
|
||||||
if (nat_accepts(them, us, REJ_TELE))
|
if (nat_accepts(them, us, REJ_TELE))
|
||||||
mpr(them,
|
mpr(them,
|
||||||
"Country %s has %s their relations with you to \"%s\"!\n",
|
"Country %s has %s their relations with you to \"%s\"!\n",
|
||||||
prnat(mynp), whichway, relates[rel]);
|
prnat(mynp), whichway, relations_string(rel));
|
||||||
|
|
||||||
mynp->nat_relate[them] = rel;
|
mynp->nat_relate[them] = rel;
|
||||||
putnat(mynp);
|
putnat(mynp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue