Indented with src/scripts/indent-emp.
This commit is contained in:
parent
5f263a7753
commit
9b7adfbecc
437 changed files with 52211 additions and 51052 deletions
|
@ -48,103 +48,103 @@
|
|||
int
|
||||
rada(void)
|
||||
{
|
||||
s_char *cp;
|
||||
int type;
|
||||
double tf;
|
||||
double tech;
|
||||
struct nstr_item ni;
|
||||
struct nstr_sect ns;
|
||||
struct shpstr ship;
|
||||
struct lndstr land;
|
||||
struct sctstr sect;
|
||||
int from_unit;
|
||||
s_char buf[1024];
|
||||
s_char *cp;
|
||||
int type;
|
||||
double tf;
|
||||
double tech;
|
||||
struct nstr_item ni;
|
||||
struct nstr_sect ns;
|
||||
struct shpstr ship;
|
||||
struct lndstr land;
|
||||
struct sctstr sect;
|
||||
int from_unit;
|
||||
s_char buf[1024];
|
||||
|
||||
from_unit = (**player->argp == 'l');
|
||||
from_unit = (**player->argp == 'l');
|
||||
|
||||
if (!from_unit)
|
||||
cp = getstarg(player->argp[1], "Radar from (ship # or sector(s)) : ", buf);
|
||||
else
|
||||
cp = getstarg(player->argp[1], "Radar from (unit # or sector(s)) : ", buf);
|
||||
if (cp == 0)
|
||||
return RET_SYN;
|
||||
type = sarg_type(cp);
|
||||
if (type == NS_AREA) {
|
||||
if (!snxtsct(&ns, cp))
|
||||
return RET_SYN;
|
||||
tech = tfact(player->cnum, 8.0);
|
||||
if (tech > ((double)WORLD_Y/4.0))
|
||||
tech = ((double)WORLD_Y/4.0);
|
||||
if (tech > ((double)WORLD_X/8.0))
|
||||
tech = ((double)WORLD_X/8.0);
|
||||
while (nxtsct(&ns, §)) {
|
||||
if (sect.sct_type != SCT_RADAR)
|
||||
continue;
|
||||
if (!player->owner)
|
||||
continue;
|
||||
radmap(sect.sct_x, sect.sct_y, (int)sect.sct_effic,
|
||||
(int) (tech * 2.0), 0.0);
|
||||
}
|
||||
} else if (type == NS_LIST || type == NS_GROUP) {
|
||||
if (!from_unit){
|
||||
/* assumes a NS_LIST return is a shipno */
|
||||
if (!snxtitem(&ni, EF_SHIP, cp)) {
|
||||
pr("Specify at least one ship\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
if (mchr[(int)ship.shp_type].m_flags & M_SONAR)
|
||||
tf = techfact(ship.shp_tech, 1.0);
|
||||
else
|
||||
tf = 0.0;
|
||||
pr("%s at ", prship(&ship));
|
||||
tech = techfact(ship.shp_tech,
|
||||
(double) mchr[(int)ship.shp_type].m_vrnge);
|
||||
if (tech > ((double)WORLD_Y/2.0))
|
||||
tech = ((double)WORLD_Y/2.0);
|
||||
if (tech > ((double)WORLD_X/4.0))
|
||||
tech = ((double)WORLD_X/4.0);
|
||||
radmap(ship.shp_x, ship.shp_y, ship.shp_effic,
|
||||
(int) tech, tf);
|
||||
}
|
||||
}else{
|
||||
/* from a land unit */
|
||||
if (!snxtitem(&ni, EF_LAND, cp)) {
|
||||
pr("Specify at least one unit\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
if (!(lchr[(int)land.lnd_type].l_flags & L_RADAR)){
|
||||
pr("%s can't use radar!\n",
|
||||
prland(&land));
|
||||
continue;
|
||||
}
|
||||
if (land.lnd_ship >= 0){
|
||||
pr("Units on ships can't use radar!\n");
|
||||
continue;
|
||||
}
|
||||
tf = 0.0;
|
||||
pr("%s at ", prland(&land));
|
||||
tech = techfact(land.lnd_tech,
|
||||
(double) land.lnd_spy);
|
||||
if (tech > ((double)WORLD_Y/2.0))
|
||||
tech = ((double)WORLD_Y/2.0);
|
||||
if (tech > ((double)WORLD_X/4.0))
|
||||
tech = ((double)WORLD_X/4.0);
|
||||
radmap(land.lnd_x, land.lnd_y, land.lnd_effic,
|
||||
(int) tech, tf);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!from_unit)
|
||||
pr("Must use a ship or sector specifier\n");
|
||||
else
|
||||
pr("Must use a unit or sector specifier\n");
|
||||
return RET_SYN;
|
||||
if (!from_unit)
|
||||
cp = getstarg(player->argp[1],
|
||||
"Radar from (ship # or sector(s)) : ", buf);
|
||||
else
|
||||
cp = getstarg(player->argp[1],
|
||||
"Radar from (unit # or sector(s)) : ", buf);
|
||||
if (cp == 0)
|
||||
return RET_SYN;
|
||||
type = sarg_type(cp);
|
||||
if (type == NS_AREA) {
|
||||
if (!snxtsct(&ns, cp))
|
||||
return RET_SYN;
|
||||
tech = tfact(player->cnum, 8.0);
|
||||
if (tech > ((double)WORLD_Y / 4.0))
|
||||
tech = ((double)WORLD_Y / 4.0);
|
||||
if (tech > ((double)WORLD_X / 8.0))
|
||||
tech = ((double)WORLD_X / 8.0);
|
||||
while (nxtsct(&ns, §)) {
|
||||
if (sect.sct_type != SCT_RADAR)
|
||||
continue;
|
||||
if (!player->owner)
|
||||
continue;
|
||||
radmap(sect.sct_x, sect.sct_y, (int)sect.sct_effic,
|
||||
(int)(tech * 2.0), 0.0);
|
||||
}
|
||||
return RET_OK;
|
||||
} else if (type == NS_LIST || type == NS_GROUP) {
|
||||
if (!from_unit) {
|
||||
/* assumes a NS_LIST return is a shipno */
|
||||
if (!snxtitem(&ni, EF_SHIP, cp)) {
|
||||
pr("Specify at least one ship\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
if (mchr[(int)ship.shp_type].m_flags & M_SONAR)
|
||||
tf = techfact(ship.shp_tech, 1.0);
|
||||
else
|
||||
tf = 0.0;
|
||||
pr("%s at ", prship(&ship));
|
||||
tech = techfact(ship.shp_tech,
|
||||
(double)mchr[(int)ship.shp_type].m_vrnge);
|
||||
if (tech > ((double)WORLD_Y / 2.0))
|
||||
tech = ((double)WORLD_Y / 2.0);
|
||||
if (tech > ((double)WORLD_X / 4.0))
|
||||
tech = ((double)WORLD_X / 4.0);
|
||||
radmap(ship.shp_x, ship.shp_y, ship.shp_effic,
|
||||
(int)tech, tf);
|
||||
}
|
||||
} else {
|
||||
/* from a land unit */
|
||||
if (!snxtitem(&ni, EF_LAND, cp)) {
|
||||
pr("Specify at least one unit\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
if (!(lchr[(int)land.lnd_type].l_flags & L_RADAR)) {
|
||||
pr("%s can't use radar!\n", prland(&land));
|
||||
continue;
|
||||
}
|
||||
if (land.lnd_ship >= 0) {
|
||||
pr("Units on ships can't use radar!\n");
|
||||
continue;
|
||||
}
|
||||
tf = 0.0;
|
||||
pr("%s at ", prland(&land));
|
||||
tech = techfact(land.lnd_tech, (double)land.lnd_spy);
|
||||
if (tech > ((double)WORLD_Y / 2.0))
|
||||
tech = ((double)WORLD_Y / 2.0);
|
||||
if (tech > ((double)WORLD_X / 4.0))
|
||||
tech = ((double)WORLD_X / 4.0);
|
||||
radmap(land.lnd_x, land.lnd_y, land.lnd_effic,
|
||||
(int)tech, tf);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!from_unit)
|
||||
pr("Must use a ship or sector specifier\n");
|
||||
else
|
||||
pr("Must use a unit or sector specifier\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue