{"action":"created","issue":{"url":"https://api.github.com/repos/chrsmith/bwapi/issues/398","labels_url":"https://api.github.com/repos/chrsmith/bwapi/issues/398/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/bwapi/issues/398/comments","events_url":"https://api.github.com/repos/chrsmith/bwapi/issues/398/events","html_url":"https://github.com/chrsmith/bwapi/issues/398","id":58521550,"number":398,"title":"canUpgrade(Unit* unit, UpgradeType type) returns false incorrectly for Zerg","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/Component-Logic","name":"Component-Logic","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/bwapi/labels/Priority-High","name":"Priority-High","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/bwapi/labels/Type-Defect","name":"Type-Defect","color":"ededed"},{"url":"https://api.github.com/repos/chrsmith/bwapi/labels/Usability","name":"Usability","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-22T21:47:03Z","updated_at":"2015-02-22T21:47:03Z","closed_at":null,"body":"```\nWhat steps will reproduce the problem?\n1. Build one evolution chamber\n2. Upgrade to Carapace level 1\n3. Upgrade to Lair\n4. Build Queen's Nest and begin to upgrade to Hive\n5. --> Broodwar->canUpgrade(unit, UpgradeTypes::Zerg_Carapace) returns false\n6. Wait until Hive completes\n7. --> Broodwar->canUpgrade(unit, UpgradeTypes::Zerg_Carapace) still returns \nfalse\n\nThere are two problems here, and they both lie within the if-statement in \nTemplates.h:393. \n\nFirstly, this only checks for _completed_ Hatcheries, Lairs, and Hives. If you \nhave a Lair that is upgrading to a Hive, it will not be credited because it is \nnot completed. Using !self->allUnitCount(...) for Lairs and Hives in the \nHatchery if-block and the same for Hives in the Lair if-block should be \nsufficient.\n\nThe second problem is that if you DO pass the previous test (step 6-7 above), \nit will continue through the else-if chain and eventually reach the final test, \nwhich will cause a false return if you do not have the exact building (Lair for \na level 2 upgrade).\n```\n\n-----\nOriginal issue reported on code.google.com by `douglas....@gmail.com` on 7 Aug 2011 at 8:10"},"comment":{"url":"https://api.github.com/repos/chrsmith/bwapi/issues/comments/75464205","html_url":"https://github.com/chrsmith/bwapi/issues/398#issuecomment-75464205","issue_url":"https://api.github.com/repos/chrsmith/bwapi/issues/398","id":75464205,"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:47:03Z","updated_at":"2015-02-22T21:47:03Z","body":"```\nI'm pretty sure the check for completed Hatcheries, Lairs, and Hives is \ncorrect. The issue was people complained about morphing Zerg buildings being \ncompleted, so that behaviour was altered for BWAPI and the check was not \ncorrectly updated to reflect this.\n\nFixed this in r3834.\n\nI'm not sure what you mean in the second problem, since if the first problem is \nfixed then that shouldn't happen.\n```\n\n-----\nOriginal comment by `AHeinerm` on 7 Aug 2011 at 7:24\n* Changed state: **Fixed**\n* Added labels: **Priority-High**, **Type-Defect**, **Usability**, **Component-Logic**"}}