Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve message box text when not able to place sea units. #11813

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -612,18 +612,15 @@ 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