/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* rada.c: Do radar from a ship/unit/sector
- *
+ *
* Known contributors to this file:
* Ron Koenderink, 2006
*/
}
int
-radar(short type)
+radar(int type)
{
char *cp;
double tf;
- double tech;
+ double tlev;
+ int spy;
struct nstr_item ni;
struct nstr_sect ns;
union empobj_storage item;
sprintf(prompt, "Radar from (%s # or sector(s)) : ", ef_nameof(type));
cp = getstarg(player->argp[1], prompt, buf);
-
- if (cp == 0)
+
+ if (!cp)
return RET_SYN;
switch (sarg_type(cp)) {
case NS_AREA:
if (!snxtsct(&ns, cp))
return RET_SYN;
- tech = tfact(player->cnum, 8.0);
- if (tech > WORLD_Y / 4.0)
- tech = WORLD_Y / 4.0;
- if (tech > WORLD_X / 8.0)
- tech = WORLD_X / 8.0;
+ tlev = getnatp(player->cnum)->nat_level[NAT_TLEV];
while (nxtsct(&ns, &item.sect)) {
if (item.sect.sct_type != SCT_RADAR)
continue;
if (!player->owner)
continue;
radmap(item.sect.sct_x, item.sect.sct_y, item.sect.sct_effic,
- (int)(tech * 2.0), 0.0);
+ tlev, 16, 0.0);
}
break;
case NS_LIST:
if (type == EF_SHIP) {
if (mchr[(int)item.ship.shp_type].m_flags & M_SONAR)
tf = techfact(item.ship.shp_tech, 1.0);
- tech = techfact(item.ship.shp_tech,
- mchr[(int)item.ship.shp_type].m_vrnge);
+ spy = mchr[item.ship.shp_type].m_vrnge;
} else {
if (!(lchr[(int)item.land.lnd_type].l_flags & L_RADAR)) {
pr("%s can't use radar!\n", prland(&item.land));
pr("Units on ships can't use radar!\n");
continue;
}
- tech = techfact(item.land.lnd_tech,
- lchr[item.land.lnd_type].l_spy);
+ spy = lchr[item.land.lnd_type].l_spy;
}
pr("%s at ", obj_nameof(&item.gen));
- if (tech > WORLD_Y / 2.0)
- tech = WORLD_Y / 2.0;
- if (tech > WORLD_X / 4.0)
- tech = WORLD_X / 4.0;
radmap(item.gen.x, item.gen.y, item.gen.effic,
- (int)tech, tf);
+ item.gen.tech, spy, tf);
}
break;
default: