Blizzard / s2client-api

StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
MIT License
1.66k stars 282 forks source link

Data for BattleCruiser weapon's are empty #314

Open mboedigh opened 5 years ago

mboedigh commented 5 years ago

Code something like this (not actual tested code), fails assertion because weapons is empty.

const UnitTypes& data = client->getObservation()->GetUnitTypeData();
assert(!data[UnitTypeID(UNIT_TYPEID::TERRAN_BATTLECRUISER)].weapons.empty());

This was called in OnGameStart(). Many other units have their weapons data set properly. Here I've used game version Base74741.

mboedigh commented 5 years ago

Can anyone please confirm whether they see the same problem. I'm suspecting something is wrong in the protocol. To test just add these lines to your client any time after OnGameStart() is called. The first assert works for me and the second fails.

const UnitTypes& data = Observation()->GetUnitTypeData(); auto& marine = data[UnitTypeID(UNIT_TYPEID::TERRAN_MARINE)]; assert(!marine.weapons.empty()); auto& battle_cruiser = data[UnitTypeID(UNIT_TYPEID::TERRAN_BATTLECRUISER)]; assert(!battle_cruiser.weapons.empty());

If it works (or not) please let me know your setup.