blob: e4e63c05a25d49ed9a393d1ec74330ebb4191da5 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 | package ch.asynk.tankontank.game;
import java.util.Collection;
import java.util.LinkedHashSet;
import ch.asynk.tankontank.engine.Pawn;
public class UnitSet extends LinkedHashSet<Unit>
{
    private final Map map;
    public UnitSet(Map map, int n)
    {
        super(n);
        this.map = map;
    }
    @SuppressWarnings("unchecked")
    public Collection<Pawn> asPawns()
    {
        return (Collection) this;
    }
    public Unit first()
    {
        if (isEmpty()) return null;
        return iterator().next();
    }
    public void enable(int i, boolean enable)
    {
        for (Unit unit : this)
            unit.enableOverlay(i, enable);
    }
}
 |