8000 Fix: Restored Access to Units Involved in Prior Scenarios by IllianiBird · Pull Request #6942 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: Restored Access to Units Involved in Prior Scenarios #6942

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

Merged
Merged
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
46 changes: 22 additions & 24 deletions MekHQ/src/mekhq/gui/view/AtBScenarioViewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
package mekhq.gui.view;

import static megamek.common.Entity.getEntityMajorTypeName;
import static megamek.common.options.OptionsConstants.BASE_BLIND_DROP;
import static megamek.common.options.OptionsConstants.BASE_REAL_BLIND_DROP;

import java.awt.Component;
import java.awt.GridBagConstraints;
Expand Down Expand Up @@ -276,28 +278,24 @@ private void fillStats() {
panStats.add(tree, gridBagConstraints);
}

boolean isBlindDrop = campaign.getGameOptions().getOption("blind_drop").booleanValue();
boolean isTrueBlindDrop = campaign.getGameOptions().getOption("real_blind_drop").booleanValue();

boolean isBlindDrop = campaign.getGameOptions().getOption(BASE_BLIND_DROP).booleanValue();
boolean isTrueBlindDrop = campaign.getGameOptions().getOption(BASE_REAL_BLIND_DROP).booleanValue();
boolean isCurrent = scenario.getStatus().isCurrent();
for (int i = 0; i < botStubs.size(); i++) {
BotForceStub botStub = botStubs.get(i);
if (botStub == null) {
continue;
}

int team = botStub.getTeam();
DefaultMutableTreeNode top = new DefaultMutableTreeNode(botStub.getName());
List<String> allEntries = botStub.getEntityList();
DefaultMutableTreeNode top = new DefaultMutableTreeNode(botStubs.get(i).getName());

// Process entries only for current scenarios to avoid exceptions or irrelevant processing
if (scenario.getStatus().isCurrent()) {
for (String entry : allEntries) {
if ((team != 1) && isTrueBlindDrop) {
continue;
}

if ((team != 1) && isBlindDrop) {
int unitIndex = allEntries.indexOf(entry);
if (!(isTrueBlindDrop && (team != 1))) {
boolean hideInformation = isCurrent && isBlindDrop && (team != 1);
for (String entityString : allEntries) {
if (hideInformation) {
int unitIndex = allEntries.indexOf(entityString);
Entity entity = scenario.getBotForce(i).getFullEntityList(campaign).get(unitIndex);

if (entity == null) {
Expand All @@ -313,12 +311,12 @@ private void fillStats() {
String label = weight 10000 Class + ' ' + unitType;
top.add(new DefaultMutableTreeNode(label));
continue;
} else {
top.add(new DefaultMutableTreeNode(entityString));
}

top.add(new DefaultMutableTreeNode(entry));

}
}

JTree tree = new JTree(top);
tree.collapsePath(new TreePath(top));
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
Expand Down Expand Up @@ -536,8 +534,8 @@ private void fillStats() {
* Worker function that generates UI elements appropriate for planet-side scenarios
*
* @param gridBagConstraints Current grid bag constraints in use
* @param resourceMap Text resource
* @param y current row in the parent UI element
* @param resourceMap Text resource
* @param y current row in the parent UI element
*
* @return the row at which we wind up after doing all this
*/
Expand Down Expand Up @@ -765,8 +763,8 @@ private int fillPlanetSideStats(GridBagConstraints gridBagConstraints, ResourceB
* Worker function that generates UI elements appropriate for space scenarios
*
* @param gridBagConstraints Current grid bag constraints in use
* @param resourceMap Text resource
* @param y current row in the parent UI element
* @param resourceMap Text resource
* @param y current row in the parent UI element
*
* @return the row at which we wind up after doing all this
*/
Expand Down Expand Up @@ -810,8 +808,8 @@ private int fillSpaceStats(GridBagConstraints gridBagConstraints, ResourceBundle
* Worker function that generates UI elements appropriate for low atmosphere scenarios
*
* @param gridBagConstraints Current grid bag constraints in use
* @param resourceMap Text resource
* @param y current row in the parent UI element
* @param resourceMap Text resource
* @param y current row in the parent UI element
*
* @return the row at which we wind up after doing all this
*/
Expand Down Expand Up @@ -985,7 +983,7 @@ public ForceStubRenderer() {

@Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean selected,
final boolean expanded, final boolean leaf, final int row,
final boolean expanded, final boolean leaf, final int row,
final boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
setIcon(getIcon(value));
Expand Down Expand Up @@ -1048,7 +1046,7 @@ public void mouseReleased(MouseEvent e) {
}

private void maybeShowPopup(MouseEvent e) {
final boolean isBlindDrop = campaign.getGameOptions().getOption("blind_drop").booleanValue();
final boolean isBlindDrop = campaign.getGameOptions().getOption(BASE_BLIND_DROP).booleanValue();
final JPopupMenu popup = new JPopupMenu();
if (e.isPopupTrigger()) {
final TreePath path = tree.getPathForLocation(e.getX(), e.getY());
Expand Down
Loading
0