Skip to content

Commit

Permalink
Fixed single select scenarios where NamedNumpyArray was not used.
Browse files Browse the repository at this point in the history
PySC2: Import of refs/pull/176/head
PiperOrigin-RevId: 196813269
  • Loading branch information
skjb authored and tewalds committed May 16, 2018
1 parent 86c9cb0 commit d43b496
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pysc2/lib/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,16 @@ def unit_vec(u):
[unit_vec(u) for u in ui.multi.units], [None, UnitLayer])

if ui.cargo and ui.cargo.passengers:
out["single_select"] = np.array([unit_vec(ui.single.unit)])
out["single_select"] = named_array.NamedNumpyArray(
[unit_vec(ui.single.unit)], [None, UnitLayer])
out["cargo"] = named_array.NamedNumpyArray(
[unit_vec(u) for u in ui.cargo.passengers], [None, UnitLayer])
out["cargo_slots_available"] = np.array([ui.cargo.slots_available],
dtype=np.int32)

if ui.production and ui.production.build_queue:
out["single_select"] = np.array([unit_vec(ui.production.unit)])
out["single_select"] = named_array.NamedNumpyArray(
[unit_vec(ui.production.unit)], [None, UnitLayer])
out["build_queue"] = named_array.NamedNumpyArray(
[unit_vec(u) for u in ui.production.build_queue],
[None, UnitLayer])
Expand Down

0 comments on commit d43b496

Please sign in to comment.