(do_unit_move): Combine the two length checks and type check for

printing the ship path into one if statement.  No functional changes.
This commit is contained in:
Ron Koenderink 2007-01-21 12:28:40 +00:00
parent aaaf5bdc82
commit 139086fd20

View file

@ -116,9 +116,8 @@ do_unit_move(struct emp_qelem *unit_list, int *together,
if (QEMPTY(unit_list)) { if (QEMPTY(unit_list)) {
pr("No %s left\n", pr("No %s left\n",
type == EF_SHIP ? "ships" : "lands"); type == EF_SHIP ? "ships" : "lands");
if (strlen(pathtaken) > 0) { if (type == EF_SHIP && strlen(pathtaken) > 1) {
pathtaken[strlen(pathtaken) - 1] = '\0'; pathtaken[strlen(pathtaken) - 1] = '\0';
if (type == EF_SHIP && strlen(pathtaken) > 0)
pr("Path taken: %s\n", pathtaken); pr("Path taken: %s\n", pathtaken);
} }
return RET_OK; return RET_OK;
@ -149,9 +148,8 @@ do_unit_move(struct emp_qelem *unit_list, int *together,
if (QEMPTY(unit_list)) { if (QEMPTY(unit_list)) {
pr("No %s left\n", pr("No %s left\n",
type == EF_SHIP ? "ships" : "lands"); type == EF_SHIP ? "ships" : "lands");
if (strlen(pathtaken) > 0) { if (type == EF_SHIP && strlen(pathtaken) > 1) {
pathtaken[strlen(pathtaken) - 1] = '\0'; pathtaken[strlen(pathtaken) - 1] = '\0';
if (type == EF_SHIP && strlen(pathtaken) > 0)
pr("Path taken: %s\n", pathtaken); pr("Path taken: %s\n", pathtaken);
} }
return RET_OK; return RET_OK;
@ -287,9 +285,8 @@ do_unit_move(struct emp_qelem *unit_list, int *together,
pr("`d' to drop mines, and `m' to minesweep\n"); pr("`d' to drop mines, and `m' to minesweep\n");
stopping = 1; stopping = 1;
} }
if (strlen(pathtaken) > 0) { if (type == EF_SHIP && strlen(pathtaken) > 1) {
pathtaken[strlen(pathtaken) - 1] = '\0'; pathtaken[strlen(pathtaken) - 1] = '\0';
if (type == EF_SHIP && strlen(pathtaken) > 0)
pr("Path taken: %s\n", pathtaken); pr("Path taken: %s\n", pathtaken);
} }
return RET_OK; return RET_OK;