/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
#include <config.h>
#include <ctype.h>
+#include "chance.h"
#include "damage.h"
#include "file.h"
#include "map.h"
int
move_ground(struct sctstr *start, struct sctstr *end,
double weight, char *path,
- int (*map)(coord, coord, char *), int exploring,
- int *dam)
+ int (*map)(coord, coord, char *, char *),
+ int exploring, int *dam)
{
struct sctstr sect;
struct sctstr next;
size_t len;
double mobility = start->sct_mobil;
int dir;
+ char scanspace[1024];
+ char *argp[128];
int intcost;
int takedam = *dam;
int out = 0;
oldy = cury;
if (!movstr || *movstr == 0) {
if (exploring) {
- map(curx, cury, NULL);
+ map(curx, cury, NULL, NULL);
} else {
move_map(curx, cury, NULL);
}
*movstr = 0;
continue;
}
- movstr++;
if (dir == DIR_MAP) {
+ parse(movstr, scanspace, argp, NULL, NULL, NULL);
+ if (argp[0][1]) {
+ pr("Use of '%c' without a space before its argument is deprecated.\n"
+ "Support for it will go away in a future release\n",
+ *movstr);
+ argp[2] = argp[1];
+ argp[1] = argp[0] + 1;
+ }
if (!exploring)
- map(curx, cury, movstr + 1);
+ map(curx, cury, argp[1], argp[2]);
*movstr = 0;
continue;
- } else if (dir == DIR_STOP)
+ }
+ movstr++;
+ if (dir == DIR_STOP)
break;
- else if (dir == DIR_VIEW) {
+ if (dir == DIR_VIEW) {
pr("%d%% %s with %d civilians.\n", sect.sct_effic,
dchr[sect.sct_type].d_name, sect.sct_item[I_CIVIL]);
continue;