Skip to content

Commit

Permalink
Improve message box text when not able to place sea units.
Browse files Browse the repository at this point in the history
  • Loading branch information
asvitkine committed Jul 25, 2023
1 parent 603b889 commit 61b0fd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,18 +612,14 @@ protected String canProduce(
if (errorP != null) {
failingProducers.add(producer);
// do not include the error for same territory, if water, because users do not want to see
// this error report for
// 99.9% of games
// this error report for 99.9% of games
if (!(producer.equals(to) && producer.isWater())) {
error.append(", ").append(errorP);
error.append(errorP).append(".\n");
}
}
}
if (producers.size() == failingProducers.size()) {
return "Adjacent territories to "
+ to.getName()
+ " cannot produce, due to: \n "
+ error.toString().replaceFirst(", ", "");
return String.format("Adjacent territories to %s cannot produce because:\n\n%s", to.getName(), error);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ private PlaceableUnits getUnitsToPlace(final Territory territory) {
if (production.isError()) {
JOptionPane.showMessageDialog(
getTopLevelAncestor(),
production.getErrorMessage(),
"No units",
production.getErrorMessage() + "\n\n",
"Cannot produce units",
JOptionPane.INFORMATION_MESSAGE);
}
return production;
Expand Down

0 comments on commit 61b0fd2

Please sign in to comment.