Rename obj_nameof() to unit_nameof() and move to unitsub.c

This commit is contained in:
Markus Armbruster 2011-05-21 15:42:38 +02:00
parent 766788480f
commit 1c93c5fbc8
10 changed files with 41 additions and 47 deletions

View file

@ -37,7 +37,6 @@
#include <ctype.h>
#include "commands.h"
#include "empobj.h"
#include "item.h"
#include "land.h"
#include "optlist.h"
@ -363,7 +362,7 @@ void
gift(natid givee, natid giver, void *ptr, char *mesg)
{
if (giver != givee)
wu(0, givee, "%s %s %s\n", cname(giver), obj_nameof(ptr), mesg);
wu(0, givee, "%s %s %s\n", cname(giver), unit_nameof(ptr), mesg);
unit_give_away(ptr, givee, 0);
}

View file

@ -35,10 +35,10 @@
#include <config.h>
#include "commands.h"
#include "empobj.h"
#include "mission.h"
#include "optlist.h"
#include "path.h"
#include "unit.h"
static int clear_mission(struct nstr_item *);
static int show_mission(struct nstr_item *);
@ -175,24 +175,24 @@ mission(void)
if (mission == MI_RESERVE) {
if (!lnd_can_attack((struct lndstr *)gp)) {
pr("%s is not designed to fight ground troops\n",
obj_nameof(gp));
unit_nameof(gp));
continue;
}
if (!lchr[gp->type].l_rad) {
pr("%s cannot react anywhere!\n", obj_nameof(gp));
pr("%s cannot react anywhere!\n", unit_nameof(gp));
continue;
}
}
if ((mission == MI_INTERDICT) && (type == EF_SHIP))
if (mchr[(int)gp->type].m_glim == 0) {
pr("%s: cannot fire at range!\n", obj_nameof(gp));
pr("%s: cannot fire at range!\n", unit_nameof(gp));
continue;
}
if ((mission == MI_INTERDICT) && (type == EF_LAND))
if (lchr[(int)gp->type].l_dam == 0) {
pr("%s: cannot fire at range!\n", obj_nameof(gp));
pr("%s: cannot fire at range!\n", unit_nameof(gp));
continue;
}
@ -247,7 +247,7 @@ mission(void)
if (type == EF_PLANE && nuk_on_plane((struct plnstr *)gp) >= 0) {
pr("%s can't perform a mission while it carries a nuclear weapon",
obj_nameof(gp));
unit_nameof(gp));
continue;
}
@ -260,7 +260,7 @@ mission(void)
range = oprange(gp);
if (range < mapdist(gp->x, gp->y, x, y)) {
pr("%s: out of range! (range %d)\n",
obj_nameof(gp), range);
unit_nameof(gp), range);
continue;
}
gp->opx = x;
@ -270,7 +270,7 @@ mission(void)
num++;
pr("%s on %s mission, centered on %s, radius %d\n",
obj_nameof(gp), mission_name(mission),
unit_nameof(gp), mission_name(mission),
xyas(x, y, player->cnum), gp->radius);
}
if (num == 0) {
@ -310,7 +310,7 @@ show_mission(struct nstr_item *np)
pr("Thing x,y op-sect rad mission\n");
first = 0;
}
pr("%-25s", obj_nameof(gp));
pr("%-25s", unit_nameof(gp));
prxy(" %3d,%-3d", gp->x, gp->y);
switch (gp->mission) {
case MI_INTERDICT:

View file

@ -38,7 +38,6 @@
#include "map.h"
#include "optlist.h"
#include "path.h"
#include "empobj.h"
#include "unit.h"
static void pr_leader_change(struct empobj *leader);
@ -89,7 +88,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
type = leader->ef_type;
pr("%s is %s\n",
type == EF_SHIP ? "Flagship" : "Leader",
obj_nameof(leader));
unit_nameof(leader));
if (player->argp[2]) {
strcpy(buf, player->argp[2]);
@ -335,7 +334,7 @@ pr_leader_change(struct empobj *leader)
{
pr("Changing %s to %s\n",
leader->ef_type == EF_SHIP ? "flagship" : "leader",
obj_nameof(leader));
unit_nameof(leader));
}
static struct empobj *

View file

@ -34,7 +34,7 @@
#include "commands.h"
#include "optlist.h"
#include "empobj.h"
#include "unit.h"
int
rada(void)
@ -108,7 +108,7 @@ radar(int type)
spy = lchr[item.land.lnd_type].l_spy;
}
pr("%s at ", obj_nameof(&item.gen));
pr("%s at ", unit_nameof(&item.gen));
radmap(item.gen.x, item.gen.y, item.gen.effic,
item.gen.tech, spy, tf);
}

View file

@ -35,7 +35,6 @@
#include <ctype.h>
#include "commands.h"
#include "empobj.h"
#include "optlist.h"
#include "unit.h"
@ -159,7 +158,7 @@ scra(void)
if (!player->owner
&& relations_with(sect.sct_own, player->cnum) != ALLIED) {
pr("%s is not in an allied sector!\n",
obj_nameof(&item.gen));
unit_nameof(&item.gen));
continue;
}
if (type == EF_PLANE
@ -171,7 +170,7 @@ scra(void)
}
pr("%s scrapped in %s\n",
obj_nameof(&item.gen),
unit_nameof(&item.gen),
xyas(item.gen.x, item.gen.y, player->cnum));
unit_drop_cargo(&item.gen, sect.sct_own);
if (type == EF_SHIP) {

View file

@ -34,7 +34,6 @@
#include <ctype.h>
#include "commands.h"
#include "empobj.h"
#include "news.h"
#include "optlist.h"
#include "unit.h"
@ -138,7 +137,7 @@ scut(void)
}
}
pr("%s scuttled in %s\n",
obj_nameof(&item.gen),
unit_nameof(&item.gen),
xyas(item.gen.x, item.gen.y, player->cnum));
getsect(item.gen.x, item.gen.y, &sect);
if (sect.sct_own == item.gen.own)