Fix navigate and march to find paths longer than 7 sectors again
Broken in commit 8f008bf8
, v4.3.27. How embarrassing...
This commit is contained in:
parent
80a2fdc8ff
commit
0faf0034e5
Notes:
Markus Armbruster
2011-07-12 09:51:28 +02:00
Longer than sizeof(char *) - 1, actually. 7 on 64 bit machines, 3 on 32 bit machines.
3 changed files with 7 additions and 7 deletions
|
@ -57,7 +57,7 @@ extern void unit_onresize(int);
|
||||||
extern char *unit_nameof(struct empobj *);
|
extern char *unit_nameof(struct empobj *);
|
||||||
extern void unit_list(struct emp_qelem *);
|
extern void unit_list(struct emp_qelem *);
|
||||||
extern void unit_put(struct emp_qelem *list, natid actor);
|
extern void unit_put(struct emp_qelem *list, natid actor);
|
||||||
extern char *unit_path(int, struct empobj *, char *);
|
extern char *unit_path(int, struct empobj *, char *, size_t);
|
||||||
extern void unit_view(struct emp_qelem *);
|
extern void unit_view(struct emp_qelem *);
|
||||||
extern int unit_update_cargo(struct empobj *);
|
extern int unit_update_cargo(struct empobj *);
|
||||||
extern void unit_drop_cargo(struct empobj *, natid);
|
extern void unit_drop_cargo(struct empobj *, natid);
|
||||||
|
|
|
@ -91,7 +91,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
|
||||||
|
|
||||||
if (player->argp[2]) {
|
if (player->argp[2]) {
|
||||||
strcpy(buf, player->argp[2]);
|
strcpy(buf, player->argp[2]);
|
||||||
cp = unit_path(*together, leader, buf);
|
cp = unit_path(*together, leader, buf, sizeof(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
*pt = '\0';
|
*pt = '\0';
|
||||||
|
@ -151,7 +151,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cp)
|
if (cp)
|
||||||
cp = unit_path(*together, leader, cp);
|
cp = unit_path(*together, leader, buf, sizeof(buf));
|
||||||
}
|
}
|
||||||
if (type == EF_SHIP) {
|
if (type == EF_SHIP) {
|
||||||
rad_map_set(player->cnum, leader->x, leader->y, leader->effic,
|
rad_map_set(player->cnum, leader->x, leader->y, leader->effic,
|
||||||
|
|
|
@ -151,7 +151,7 @@ unit_put(struct emp_qelem *list, natid actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
unit_path(int together, struct empobj *unit, char *buf)
|
unit_path(int together, struct empobj *unit, char *buf, size_t bufsz)
|
||||||
{
|
{
|
||||||
coord destx;
|
coord destx;
|
||||||
coord desty;
|
coord desty;
|
||||||
|
@ -196,13 +196,13 @@ unit_path(int together, struct empobj *unit, char *buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
len = path_find_route(buf, sizeof(buf), unit->x, unit->y, destx, desty);
|
len = path_find_route(buf, bufsz, unit->x, unit->y, destx, desty);
|
||||||
if (len == 0 || unit->ef_type == EF_LAND) {
|
if (len == 0 || unit->ef_type == EF_LAND) {
|
||||||
if (len + 1 < sizeof(buf))
|
if (len + 1 < bufsz)
|
||||||
strcpy(buf + len, "h");
|
strcpy(buf + len, "h");
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
if (len >= sizeof(buf)) {
|
if (len >= bufsz) {
|
||||||
pr("Can't handle path to %s, it's too long, sorry\n",
|
pr("Can't handle path to %s, it's too long, sorry\n",
|
||||||
xyas(destx, desty, player->cnum));
|
xyas(destx, desty, player->cnum));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue