(move_ground): Drop first parameter of map callback, it's not used.

Callers changed.  s_char purge.
This commit is contained in:
Markus Armbruster 2006-03-28 19:46:40 +00:00
parent 06b669924a
commit a1ce7db238
5 changed files with 41 additions and 42 deletions

View file

@ -524,9 +524,9 @@ extern int air_defense(coord, coord, natid, struct emp_qelem *,
struct emp_qelem *); struct emp_qelem *);
/* move.c */ /* move.c */
extern int check_lmines(coord, coord, double); extern int check_lmines(coord, coord, double);
extern int move_ground(s_char *, struct sctstr *, struct sctstr *, extern int move_ground(struct sctstr *, struct sctstr *,
double, s_char *, double, s_char *,
int (*)(s_char *, coord, coord, s_char *), int (*)(coord, coord, char *),
int, int *); int, int *);
extern int fly_map(coord, coord); extern int fly_map(coord, coord);
/* mslsub.c */ /* mslsub.c */

View file

@ -45,7 +45,7 @@
#include "optlist.h" #include "optlist.h"
#include "commands.h" #include "commands.h"
static int explore_map(s_char *what, coord curx, coord cury, s_char *arg); static int explore_map(coord curx, coord cury, char *arg);
int int
explore(void) explore(void)
@ -67,11 +67,11 @@ explore(void)
int own, mob; int own, mob;
int justtook; int justtook;
coord x, y; coord x, y;
s_char *p; char *p;
int n; int n;
int left; int left;
s_char buf[1024]; char buf[1024];
s_char prompt[128]; char prompt[128];
if (!(ip = whatitem(player->argp[1], "explore with what? (civ/mil) "))) if (!(ip = whatitem(player->argp[1], "explore with what? (civ/mil) ")))
return RET_SYN; return RET_SYN;
@ -149,15 +149,17 @@ explore(void)
* Now parse the path and return ending sector. * Now parse the path and return ending sector.
*/ */
dam = 1; dam = 1;
mcost = move_ground((s_char *)ip, &sect, &endsect, mcost = move_ground(&sect, &endsect, weight, player->argp[4],
weight, player->argp[4],
explore_map, 1, &dam); explore_map, 1, &dam);
if (dam) { if (dam) {
left = effdamage(amount, dam); left = effdamage(amount, dam);
if (left < amount) { if (left < amount) {
if (left) { if (left) {
pr("%d of the %s you were exploring with were destroyed!\nOnly %d %s made it to %s\n", amount - left, ip->i_name, left, ip->i_name, xyas(endsect.sct_x, endsect.sct_y, player->cnum)); pr("%d of the %s you were exploring with were destroyed!\n"
"Only %d %s made it to %s\n",
amount - left, ip->i_name, left, ip->i_name,
xyas(endsect.sct_x, endsect.sct_y, player->cnum));
} else { } else {
pr("All of the %s you were exploring with were destroyed!\n", ip->i_name); pr("All of the %s you were exploring with were destroyed!\n", ip->i_name);
} }
@ -277,7 +279,7 @@ explore(void)
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
explore_map(s_char *what, coord curx, coord cury, s_char *arg) explore_map(coord curx, coord cury, char *arg)
{ {
struct nstr_sect ns; struct nstr_sect ns;
struct sctstr sect; struct sctstr sect;

View file

@ -47,7 +47,7 @@
#include "commands.h" #include "commands.h"
static int cmd_move_map(s_char *what, coord curx, coord cury, s_char *arg); static int cmd_move_map(coord curx, coord cury, char *arg);
int int
move(void) move(void)
@ -72,9 +72,9 @@ move(void)
int istest = 0; int istest = 0;
int n; int n;
coord x, y; coord x, y;
s_char *p; char *p;
s_char prompt[1024]; char prompt[1024];
s_char buf[1024]; char buf[1024];
istest = *player->argp[0] == 't'; istest = *player->argp[0] == 't';
@ -188,8 +188,7 @@ move(void)
dam = (istest ? 0 : 1); dam = (istest ? 0 : 1);
if (dam && !chance(weight / 200.0)) if (dam && !chance(weight / 200.0))
dam = 0; dam = 0;
mcost = move_ground((s_char *)ip, &sect, &endsect, mcost = move_ground(&sect, &endsect, weight, player->argp[4],
weight, player->argp[4],
cmd_move_map, 0, &dam); cmd_move_map, 0, &dam);
if (dam) { if (dam) {
@ -347,7 +346,7 @@ move(void)
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
cmd_move_map(s_char *what, coord curx, coord cury, s_char *arg) cmd_move_map(coord curx, coord cury, char *arg)
{ {
player->argp[0] = "map"; player->argp[0] = "map";
player->argp[1] = arg; player->argp[1] = arg;

View file

@ -48,18 +48,18 @@
#include "land.h" #include "land.h"
#include "commands.h" #include "commands.h"
static int tran_map(s_char *what, coord curx, coord cury, s_char *arg); static int tran_map(coord curx, coord cury, char *arg);
static int tran_nuke(void); static int tran_nuke(void);
static int tran_plane(void); static int tran_plane(void);
int int
tran(void) tran(void)
{ {
s_char *what; char *what;
s_char buf[1024]; char buf[1024];
what = what = getstarg(player->argp[1], "transport what (nuke or plane): ",
getstarg(player->argp[1], "transport what (nuke or plane): ", buf); buf);
if (what == 0) if (what == 0)
return RET_SYN; return RET_SYN;
if (*what == 'n') if (*what == 'n')
@ -80,7 +80,7 @@ tran_nuke(void)
coord x, y; coord x, y;
coord dstx, dsty; coord dstx, dsty;
int found; int found;
s_char *p; char *p;
int nuketype; int nuketype;
int moving; int moving;
struct nukstr nuke; struct nukstr nuke;
@ -88,7 +88,7 @@ tran_nuke(void)
struct sctstr endsect; struct sctstr endsect;
int mcost, dam; int mcost, dam;
struct nstr_item nstr; struct nstr_item nstr;
s_char buf[1024]; char buf[1024];
if (!(p = getstarg(player->argp[2], "from sector : ", buf))) if (!(p = getstarg(player->argp[2], "from sector : ", buf)))
return RET_SYN; return RET_SYN;
@ -143,8 +143,7 @@ tran_nuke(void)
return RET_FAIL; return RET_FAIL;
} }
dam = 0; dam = 0;
mcost = move_ground((s_char *)&nuke, &sect, &endsect, mcost = move_ground(&sect, &endsect, (double)ncp->n_weight * moving,
(double)ncp->n_weight * moving,
player->argp[5], tran_map, 0, &dam); player->argp[5], tran_map, 0, &dam);
if (mcost < 0) if (mcost < 0)
@ -246,8 +245,7 @@ tran_plane(void)
return RET_FAIL; return RET_FAIL;
} }
dam = 1; dam = 1;
mcost = move_ground((s_char *)&plane, &sect, &endsect, mcost = move_ground(&sect, &endsect, (double)weight,
(double)weight,
player->argp[3], tran_map, 0, &dam); player->argp[3], tran_map, 0, &dam);
dam /= count; dam /= count;
if (mcost < 0) if (mcost < 0)
@ -285,7 +283,7 @@ tran_plane(void)
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
tran_map(s_char *what, coord curx, coord cury, s_char *arg) tran_map(coord curx, coord cury, char *arg)
{ {
player->argp[0] = "map"; player->argp[0] = "map";
player->argp[1] = arg; player->argp[1] = arg;

View file

@ -46,12 +46,12 @@
#include "damage.h" #include "damage.h"
#include "prototypes.h" #include "prototypes.h"
static int move_map(s_char *what, coord curx, coord cury, s_char *arg); static int move_map(coord curx, coord cury, char *arg);
int int
move_ground(s_char *what, struct sctstr *start, struct sctstr *end, move_ground(struct sctstr *start, struct sctstr *end,
double weight, s_char *path, double weight, char *path,
int (*map)(s_char *, coord, coord, s_char *), int exploring, int (*map)(coord, coord, char *), int exploring,
int *dam) int *dam)
{ {
struct sctstr sect, ending_sect; struct sctstr sect, ending_sect;
@ -59,7 +59,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
coord curx, cury, oldx, oldy; coord curx, cury, oldx, oldy;
coord tmpx, tmpy; coord tmpx, tmpy;
coord dx, dy; coord dx, dy;
s_char *movstr; char *movstr;
double sect_mcost; double sect_mcost;
double total_mcost; double total_mcost;
double mv_cost; double mv_cost;
@ -68,10 +68,10 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
int intcost; int intcost;
int takedam = *dam; int takedam = *dam;
int out = 0; int out = 0;
s_char bpath[512]; char bpath[512];
s_char buf2[512]; char buf2[512];
s_char prompt[128]; char prompt[128];
s_char buf[1024]; char buf[1024];
*end = *start; *end = *start;
if (mobility <= 0.0) if (mobility <= 0.0)
@ -114,9 +114,9 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
oldy = cury; oldy = cury;
if (!movstr || *movstr == 0) { if (!movstr || *movstr == 0) {
if (exploring) { if (exploring) {
map(what, curx, cury, NULL); map(curx, cury, NULL);
} else { } else {
move_map(what, curx, cury, NULL); move_map(curx, cury, NULL);
} }
sprintf(prompt, "<%.1f: %c %s> ", mobility, sprintf(prompt, "<%.1f: %c %s> ", mobility,
dchr[sect.sct_type].d_mnem, dchr[sect.sct_type].d_mnem,
@ -161,7 +161,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
movstr++; movstr++;
if (dir == DIR_MAP) { if (dir == DIR_MAP) {
if (!exploring) if (!exploring)
map(what, curx, cury, movstr + 1); map(curx, cury, movstr + 1);
*movstr = 0; *movstr = 0;
continue; continue;
} else if (dir == DIR_STOP) } else if (dir == DIR_STOP)
@ -250,7 +250,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
move_map(s_char *what, coord curx, coord cury, s_char *arg) move_map(coord curx, coord cury, char *arg)
{ {
struct nstr_sect ns; struct nstr_sect ns;
struct sctstr sect; struct sctstr sect;