Changeset 85 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder
- Timestamp:
- 08/27/2017 01:04:49 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
r83 r85 1465 1465 boolean found = false; 1466 1466 int indx = 0; 1467 for (ScriptIncident i : script.incidents) 1468 { 1469 if (i == null) 1467 // ALERT: Wacky logic follows 1468 // Examine all the incidents contained in this script 1469 for (ScriptIncident inci : script.incidents) 1470 { 1471 // If this spot in the list of incidents hasn't been assigned yet 1472 if (inci == null) 1470 1473 { 1471 1474 found = true; … … 1473 1476 } 1474 1477 ++indx; 1475 if (i.number == (Integer) addIncidentNumber.getValue()) 1478 // Does the new incident number match an existing one? 1479 if (inci.number == (Integer) addIncidentNumber.getValue()) 1476 1480 { 1477 1481 JOptionPane.showMessageDialog(this, "Incident number already in use.", … … 1481 1485 } 1482 1486 } 1487 // We examined all incidents and there wasn't an empty slot 1483 1488 if (!found) 1484 1489 { … … 1486 1491 "Unable to Create Incident", JOptionPane.ERROR_MESSAGE); 1487 1492 incidentFrame.setVisible(true); 1493 // ALERT: exit from middle of method 1488 1494 return; 1489 1495 } 1490 1496 1491 script.incidents.remove(indx); 1497 // We found a spot for the new incident 1498 script.incidents.remove(indx); // remove the null incident placeholder 1492 1499 SimulationScript.incidentColors[indx] = selectedColor; 1500 // Add the new incident to the list 1493 1501 script.incidents.add(indx, 1494 1502 new ScriptIncident(SimulationScript.incidentColors[indx],
Note: See TracChangeset
for help on using the changeset viewer.
