/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2006, 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
* ---
*
* satmap.c: Do a satellite map given an x,y location, effic and other
- *
+ *
* Known contributors to this file:
* Steve McClure, 2000
*/
void
satmap(int x, int y, int eff, int range, int flags, int type)
{
- int acc;
struct sctstr sect;
struct shpstr ship;
struct lndstr land;
return;
if (!radbuf)
- radbuf = malloc(WORLD_Y * (WORLD_X + 1));
+ radbuf = malloc(WORLD_Y * MAPWIDTH(1));
if (!rad) {
rad = malloc(WORLD_Y * sizeof(char *));
if (rad && radbuf) {
pr("Satellite sector report\n");
prdate();
sathead();
- acc = (flags & P_I) ? 5 : 50;
}
crackle = count = 0;
while (nxtsct(&ns, §)) {
continue;
if (flags & P_S) {
if (sect.sct_own && sect.sct_own != player->cnum) {
- satdisp_sect(§, acc);
+ satdisp_sect(§, (flags & P_I) ? 5 : 50);
++count;
if (opt_HIDDEN)
setcont(player->cnum, sect.sct_own, FOUND_FLY);
if ((type == EF_BAD || type == EF_SHIP) &&
(flags & P_S || flags & P_I)) {
if (type == EF_SHIP)
- snxtitem(&ni, EF_SHIP, selection);
+ snxtitem(&ni, EF_SHIP, selection, NULL);
else
snxtitem_dist(&ni, EF_SHIP, x, y, range);
}
/* If we are imaging *and* drawing the map */
if ((flags & P_I) && (type == EF_BAD)) {
- /* Figure out where to put the ship */
- /* First, figure out the distance from the two */
- rx = diffx((int)ship.shp_x, x);
- ry = diffy((int)ship.shp_y, y);
- /* Next, determine which direction to add it to the center */
- /* We can only do this if imaging and we have gotten the center
- up above by imaging the sectors. */
- rx = deltax(x, ns.range.lx) + rx;
- ry = deltay(y, ns.range.ly) + ry;
+ rx = deltx(&ns.range, ship.shp_x);
+ ry = delty(&ns.range, ship.shp_y);
/* &~0x20 makes it a cap letter */
rad[ry][rx] = (*mchr[(int)ship.shp_type].m_name) & ~0x20;
}
if ((type == EF_BAD || type == EF_LAND) &&
(flags & P_S || flags & P_I)) {
if (type == EF_LAND)
- snxtitem(&ni, EF_LAND, selection);
+ snxtitem(&ni, EF_LAND, selection, NULL);
else
snxtitem_dist(&ni, EF_LAND, x, y, range);
}
/* If we are imaging *and* drawing the map */
if ((flags & P_I) && (type == EF_BAD)) {
- /* Figure out where to put the unit */
- /* First, figure out the distance from the two */
- rx = diffx((int)land.lnd_x, x);
- ry = diffy((int)land.lnd_y, y);
- /* Next, determine which direction to add it to the center */
- /* We can only do this if imaging and we have gotten the center
- up above by imaging the sectors. */
- rx = deltax(x, ns.range.lx) + rx;
- ry = deltay(y, ns.range.ly) + ry;
+ rx = deltx(&ns.range, land.lnd_x);
+ ry = delty(&ns.range, land.lnd_y);
/* &~0x20 makes it a cap letter */
rad[ry][rx] = (*lchr[(int)land.lnd_type].l_name) & ~0x20;
}
* We have to make the center a '0' for ve
* ve needs a garbage line to terminate the map
*/
- rad[deltay(y, ns.range.ly)][deltax(x, ns.range.lx)] = '0';
+ rad[delty(&ns.range, y)][deltx(&ns.range, y)] = '0';
pr("Satellite radar report\n");
-#ifdef HAY
- /* This is wrong for small, hitech worlds. */
- n = deltay(ns.range.hy, ns.range.ly);
-#else
- /* This is already available, so why not use it. */
n = ns.range.height;
-#endif
for (row = 0; row < n; row++)
pr("%s\n", rad[row]);
pr("\n(c) 1989 Imaginative Images Inc.\n");
dchr[sp->sct_type].d_mnem,
sp->sct_own, roundintby((int)sp->sct_effic, acc / 2),
roundintby((int)sp->sct_road, acc / 2),
- roundintby((int)sp->sct_rail, acc / 2),
+ opt_RAILWAYS ? !!sct_rail_track(sp) : roundintby(sp->sct_rail, acc / 2),
roundintby((int)sp->sct_defense, acc / 2),
roundintby(sp->sct_item[I_CIVIL], acc),
roundintby(sp->sct_item[I_MILIT], acc),