/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2015, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* Known contributors to this file:
* Ken Stevens, 1995
* Steve McClure, 2000
- * Markus Armbruster, 2008-2010
+ * Markus Armbruster, 2008-2014
*/
#include <config.h>
#include "commands.h"
#include "empobj.h"
#include "land.h"
+#include "path.h"
#include "retreat.h"
#include "ship.h"
if (!snxtitem(&ni, type, player->argp[1], NULL))
return RET_SYN;
nunits = 0;
- if (player->argp[2] != NULL)
+ if (player->argp[2] != NULL) {
pq = getstarg(player->argp[2], "Retreat path? ", buf1);
- else
+ for (i = 0; i < RET_LEN - 1 && pq[i]; i++) {
+ if (chkdir(pq[i], DIR_STOP, DIR_LAST) < 0) {
+ pr("'%c' is not a valid direction...\n", pq[i]);
+ direrr(NULL, NULL, NULL);
+ return RET_SYN;
+ }
+ }
+ } else
pq = NULL;
rflags = 0;
}
rflags |= 1 << (p - rflagsc);
}
- if (*pq && !rflags) {
- pr("Must give retreat conditions!\n");
- return RET_FAIL;
- }
+ if (*pq && !rflags)
+ return RET_SYN;
if (ni.sel == NS_GROUP && ni.group)
rflags |= RET_GROUP;
if (!*pq)