src/lib/commands/sona.c rev. 1.6 changed first argument of

line_of_sight() to char *.  The changeset failed to change callers.
Fix.
This commit is contained in:
Markus Armbruster 2005-12-28 22:43:39 +00:00
parent 686eadad37
commit aff6cfcafe
4 changed files with 17 additions and 18 deletions

View file

@ -810,7 +810,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
range = mapdist(ship.shp_x, ship.shp_y, ax, ay); range = mapdist(ship.shp_x, ship.shp_y, ax, ay);
if (range > erange) if (range > erange)
continue; continue;
if (!line_of_sight((s_char **)0, ship.shp_x, ship.shp_y, ax, ay)) if (!line_of_sight(NULL, ship.shp_x, ship.shp_y, ax, ay))
continue; continue;
(*nfiring)++; (*nfiring)++;

View file

@ -51,7 +51,7 @@
#include "commands.h" #include "commands.h"
#include "optlist.h" #include "optlist.h"
static int blankrow(s_char *); static int blankrow(char *);
int int
sona(void) sona(void)
@ -74,37 +74,37 @@ sona(void)
int changed = 0; int changed = 0;
int row; int row;
/* Where these are used are non-re-entrant, so we keep 'em around */ /* Where these are used are non-re-entrant, so we keep 'em around */
static s_char **rad = (s_char **)0; static char **rad = NULL;
static s_char *radbuf = (s_char *)0; static char *radbuf = NULL;
static s_char **vis = (s_char **)0; static char **vis = NULL;
static s_char *visbuf = (s_char *)0; static char *visbuf = NULL;
if (!snxtitem(&ni, EF_SHIP, player->argp[1])) if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
return RET_SYN; return RET_SYN;
if (!radbuf) if (!radbuf)
radbuf = malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char)); radbuf = malloc((WORLD_Y * (WORLD_X + 1)));
if (!visbuf) if (!visbuf)
visbuf = malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char)); visbuf = malloc((WORLD_Y * (WORLD_X + 1)));
if (!rad) { if (!rad) {
rad = malloc(WORLD_Y * sizeof(s_char *)); rad = malloc(WORLD_Y);
if (rad && radbuf) { if (rad && radbuf) {
for (x = 0; x < WORLD_Y; x++) { for (x = 0; x < WORLD_Y; x++) {
rad[x] = &radbuf[(WORLD_X + 1) * x]; rad[x] = &radbuf[(WORLD_X + 1) * x];
} }
} else if (rad) { } else if (rad) {
free(rad); free(rad);
rad = (s_char **)0; rad = NULL;
} }
} }
if (!vis) { if (!vis) {
vis = malloc(WORLD_Y * sizeof(s_char *)); vis = malloc(WORLD_Y);
if (vis && visbuf) { if (vis && visbuf) {
for (x = 0; x < WORLD_Y; x++) { for (x = 0; x < WORLD_Y; x++) {
vis[x] = &visbuf[(WORLD_X + 1) * x]; vis[x] = &visbuf[(WORLD_X + 1) * x];
} }
} else if (vis) { } else if (vis) {
free(vis); free(vis);
vis = (s_char **)0; vis = NULL;
} }
} }
if (!radbuf || !visbuf || !rad || !vis) { if (!radbuf || !visbuf || !rad || !vis) {
@ -128,7 +128,7 @@ sona(void)
xyas(ship.shp_x, ship.shp_y, player->cnum), xyas(ship.shp_x, ship.shp_y, player->cnum),
ship.shp_effic, srange); ship.shp_effic, srange);
snxtsct_dist(&ns, ship.shp_x, ship.shp_y, srange); snxtsct_dist(&ns, ship.shp_x, ship.shp_y, srange);
blankfill((s_char *)radbuf, &ns.range, 1); blankfill(radbuf, &ns.range, 1);
while (nxtsct(&ns, &sect)) { while (nxtsct(&ns, &sect)) {
if (player->owner || sect.sct_type == SCT_WATER) if (player->owner || sect.sct_type == SCT_WATER)
rad[ns.dy][ns.dx] = dchr[sect.sct_type].d_mnem; rad[ns.dy][ns.dx] = dchr[sect.sct_type].d_mnem;
@ -385,7 +385,7 @@ line_of_sight(char **rad, int ax, int ay, int bx, int by)
} }
static int static int
blankrow(s_char *s) blankrow(char *s)
{ {
while (*s) { while (*s) {
if (*s != ' ') if (*s != ' ')

View file

@ -187,7 +187,7 @@ torp(void)
pr("Hitchance = %d%%\n", (int)(hitchance * 100)); pr("Hitchance = %d%%\n", (int)(hitchance * 100));
} }
/* Now, can the torpedo even get there? */ /* Now, can the torpedo even get there? */
if (!line_of_sight((s_char **)0, sub.shp_x, sub.shp_y, if (!line_of_sight(NULL, sub.shp_x, sub.shp_y,
vship.shp_x, vship.shp_y)) { vship.shp_x, vship.shp_y)) {
pr("BOOM!... Torpedo slams into land before reaching target.\n"); pr("BOOM!... Torpedo slams into land before reaching target.\n");
/* We only tell the victim if we were within range. */ /* We only tell the victim if we were within range. */
@ -272,8 +272,7 @@ anti_torp(int f, int ntorping, int vshipown)
if (range > erange) if (range > erange)
continue; continue;
if (!line_of_sight((s_char **)0, sub.shp_x, sub.shp_y, if (!line_of_sight(NULL, sub.shp_x, sub.shp_y, dd.shp_x, dd.shp_y))
dd.shp_x, dd.shp_y))
continue; continue;
if (cantorp(&dd, &sub)) { if (cantorp(&dd, &sub)) {

View file

@ -571,7 +571,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
if (md > range) if (md > range)
continue; continue;
if (!line_of_sight((s_char **)0, x, y, gp->x, gp->y)) if (!line_of_sight(NULL, x, y, gp->x, gp->y))
continue; continue;
sp->shp_item[I_SHELL] = shell - SHP_TORP_SHELLS; sp->shp_item[I_SHELL] = shell - SHP_TORP_SHELLS;
mobcost = sp->shp_effic * 0.01 * sp->shp_speed; mobcost = sp->shp_effic * 0.01 * sp->shp_speed;