int id = unitData[index];
// bugfix - unit list was emptying itself every second frame
deadUnits.remove(id);
Unit unit = units.get(id);
if (unit == null) {
unit = new Unit(id);
units.put(id, unit);
}
unit.update(unitData, index);
if (self != null)
{
if (unit.getPlayerID() == self.getID()) {
playerList.add(unit);
}
else if (allyIDs.contains(unit.getPlayerID())) {
alliedList.add(unit);
}
else if (enemyIDs.contains(unit.getPlayerID())) {
enemyList.add(unit);
}
else {
neutralList.add(unit);
}
}
else if (allyIDs.contains(unit.getPlayerID())) {
alliedList.add(unit);
}
else if (enemyIDs.contains(unit.getPlayerID())) {
enemyList.add(unit);
}
else {
neutralList.add(unit);
}