{"action":"opened","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":58481034,"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":1,"created_at":"2015-02-21T23:56:25Z","updated_at":"2015-02-21T23:56: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"}}