{"action":"created","issue":{"url":"https://api.github.com/repos/chrsmith/bwapi/issues/255","labels_url":"https://api.github.com/repos/chrsmith/bwapi/issues/255/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/bwapi/issues/255/comments","events_url":"https://api.github.com/repos/chrsmith/bwapi/issues/255/events","html_url":"https://github.com/chrsmith/bwapi/issues/255","id":58521309,"number":255,"title":"getBuildUnit() doesn't work correctly for training buildings","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chrsmith/bwapi/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/bwapi/labels/Priority-Low","name":"Priority-Low","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/bwapi/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-22T21:44:24Z","updated_at":"2015-02-22T21:44:25Z","closed_at":null,"body":"```\nWhat steps will reproduce the problem?\n1. Add the following snippet of code in your onFrame method and compile\n    for(std::set<Unit*>::const_iterator i=Broodwar->getAllUnits().begin();i!=Broodwar->getAllUnits().end();i++) {\n\t    if ((*i)->isSelected() && (*i)->isTraining() && (*i)->getBuildUnit() != NULL) {\n        Broodwar->printf(\"Get Build Unit Type is: '%s(%d)'!\", (*i)->getBuildUnit()->getType().getName().c_str(), (*i)->getBuildUnit()->getType()); \n      }\n    }\n2. While the game is playing select a Terran Building that is training a unit, \ne.g. a factory training a vulture.\n\n3. You should see \"Terran Vulture\" as output from the code snippet but \nsometimes, you may get weird results\n\nBWAPI ver. 3.1\n\n```\n\n-----\nOriginal issue reported on code.google.com by `krasi...@gmail.com` on 17 Oct 2010 at 3:40"},"comment":{"url":"https://api.github.com/repos/chrsmith/bwapi/issues/comments/75463466","html_url":"https://github.com/chrsmith/bwapi/issues/255#issuecomment-75463466","issue_url":"https://api.github.com/repos/chrsmith/bwapi/issues/255","id":75463466,"user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T21:44:25Z","updated_at":"2015-02-22T21:44:25Z","body":"```\nCommitted a possible fix in r2833. Training units are now treated as alive (so \nUnitCreate, UnitShow, and UnitDiscover events are generated the instant a \nfriendly unit starts training). UnitCreate events are no longer generated for \nenemy training units since the enemy units are not accessible when the unit \nbegins to train. UnitShow and UnitDiscover events are still generated when the \nunit pops out of the enemy factory.\n```\n\n-----\nOriginal comment by `lowerlo...@gmail.com` on 17 Oct 2010 at 9:52"}}