(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:
parent
aaaf5bdc82
commit
139086fd20
1 changed files with 6 additions and 9 deletions
|
@ -116,10 +116,9 @@ 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,10 +148,9 @@ 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,10 +285,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue