{"action":"closed","issue":{"url":"https://api.github.com/repos/chrsmith/bwapi/issues/456","labels_url":"https://api.github.com/repos/chrsmith/bwapi/issues/456/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/bwapi/issues/456/comments","events_url":"https://api.github.com/repos/chrsmith/bwapi/issues/456/events","html_url":"https://github.com/chrsmith/bwapi/issues/456","id":58932599,"number":456,"title":"Repair shouldn't be a valid command if don't have enough resources","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"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-25T16:55:51Z","updated_at":"2015-02-25T16:55:52Z","closed_at":"2015-02-25T16:55:51Z","body":"```\nWhat steps will reproduce the problem?\n1. My bot is playing Terran (or Protoss and has mind-controlled an SCV and \nbuilt a Terran command center etc...).  During an frame when my bot has 0 \nminerals and 0 gas and my command center is damaged and my SCV is idle, check \nthe return value of the following canIssueCommand() call (where \"scv\" is a \npointer to the SCV Unit, and \"commandCenter\" is a pointer to the command center \nUnit):\nUnitCommand unitCmd;\nunitCmd.unit = scv;\nunitCmd.type = UnitCommandTypes::Repair;\nunitCmd.target = commandCenter;\nif (scv->canIssueCommand(unitCmd))\n{\n    Broodwar->printf(\"I can repair\");\n    scv->repair(commandCenter);\n}\nelse\n{\n    Broodwar->printf(\"I can not repair\");\n}\n\nWhat is the expected output? What do you see instead?\nExpected output: \"I can not repair\" printed on screen.\nActual output: \"I can repair\" printed on screen and Broodwar immediately \ndisplays a message saying \"Not enough minerals...mine more minerals.\" and \nBroodwar's audio says \"Not enough minerals\".\n\nWhat version of the product are you using? On what operating system?\nBWAPI 3.7.4 on WinXP SP3 32-bit.\n\nPlease provide any additional information below.\nNote that canIssueCommand() returns false for a UnitCommandTypes::Train command \nif the bot has insufficient resources.\nAlso note that it would need to check for sufficient minerals and gas.  I \nsuppose the amount of each required depends on how much the target unit costed. \n AFAIK, repairing is done in cycles until the target unit is fully repaired or \nwe run out of minerals and/or gas.  Maybe it's not easy to calculate how much \nminerals & gas are required for one repair cycle.\n```\n\n-----\nOriginal issue reported on code.google.com by `chris.c...@gmail.com` on 24 Aug 2012 at 7:45"}}