Broken in commit
8f008bf8, v4.3.27. How embarrassing...
extern char *unit_nameof(struct empobj *);
extern void unit_list(struct emp_qelem *);
extern void unit_put(struct emp_qelem *list, natid actor);
extern char *unit_nameof(struct empobj *);
extern void unit_list(struct emp_qelem *);
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 int unit_update_cargo(struct empobj *);
extern void unit_drop_cargo(struct empobj *, natid);
extern void unit_view(struct emp_qelem *);
extern int unit_update_cargo(struct empobj *);
extern void unit_drop_cargo(struct empobj *, natid);
if (player->argp[2]) {
strcpy(buf, player->argp[2]);
if (player->argp[2]) {
strcpy(buf, player->argp[2]);
- cp = unit_path(*together, leader, buf);
+ cp = unit_path(*together, leader, buf, sizeof(buf));
- cp = unit_path(*together, leader, cp);
+ cp = unit_path(*together, leader, buf, sizeof(buf));
}
if (type == EF_SHIP) {
rad_map_set(player->cnum, leader->x, leader->y, leader->effic,
}
if (type == EF_SHIP) {
rad_map_set(player->cnum, leader->x, leader->y, leader->effic,
-unit_path(int together, struct empobj *unit, char *buf)
+unit_path(int together, struct empobj *unit, char *buf, size_t bufsz)
{
coord destx;
coord desty;
{
coord destx;
coord desty;
- 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))
strcpy(buf + len, "h");
len++;
}
strcpy(buf + len, "h");
len++;
}
- if (len >= sizeof(buf)) {
pr("Can't handle path to %s, it's too long, sorry\n",
xyas(destx, desty, player->cnum));
return NULL;
pr("Can't handle path to %s, it's too long, sorry\n",
xyas(destx, desty, player->cnum));
return NULL;