Skip to content

Commit cf6d051

Browse files
committed
clear individual lists instead of the whole map
1 parent 754223e commit cf6d051

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/bwapi/Game.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void onFrame(final int frame) {
328328
List<Unit> getConnected(final Unit unit) {
329329
final int frame = getFrameCount();
330330
if (lastConnectedUnitsUpdate < frame) {
331-
connectedUnits.clear();
331+
connectedUnits.values().forEach(List::clear);
332332
for (final Unit u : getAllUnits()) {
333333
Unit owner = u.getCarrier();
334334
if (owner == null) {
@@ -355,7 +355,7 @@ List<Unit> getConnected(final Unit unit) {
355355
List<Unit> getLoadedUnits(final Unit unit) {
356356
final int frame = getFrameCount();
357357
if (lastLoadedUnitsUpdate < frame) {
358-
loadedUnits.clear();
358+
loadedUnits.values().forEach(List::clear);
359359
for (final Unit u : getAllUnits()) {
360360
final Unit owner = u.getTransport();
361361
if (owner != null) {

0 commit comments

Comments
 (0)