{"action":"created","issue":{"url":"https://api.github.com/repos/FAForever/fa/issues/679","labels_url":"https://api.github.com/repos/FAForever/fa/issues/679/labels{/name}","comments_url":"https://api.github.com/repos/FAForever/fa/issues/679/comments","events_url":"https://api.github.com/repos/FAForever/fa/issues/679/events","html_url":"https://github.com/FAForever/fa/pull/679","id":89862582,"number":679,"title":"Bugfix/disappearing wreck","user":{"login":"Crotalus","id":254972,"avatar_url":"https://avatars.githubusercontent.com/u/254972?v=3","gravatar_id":"","url":"https://api.github.com/users/Crotalus","html_url":"https://github.com/Crotalus","followers_url":"https://api.github.com/users/Crotalus/followers","following_url":"https://api.github.com/users/Crotalus/following{/other_user}","gists_url":"https://api.github.com/users/Crotalus/gists{/gist_id}","starred_url":"https://api.github.com/users/Crotalus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Crotalus/subscriptions","organizations_url":"https://api.github.com/users/Crotalus/orgs","repos_url":"https://api.github.com/users/Crotalus/repos","events_url":"https://api.github.com/users/Crotalus/events{/privacy}","received_events_url":"https://api.github.com/users/Crotalus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FAForever/fa/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/FAForever/fa/milestones/6","html_url":"https://github.com/FAForever/fa/milestones/3641","labels_url":"https://api.github.com/repos/FAForever/fa/milestones/6/labels","id":922930,"number":6,"title":"3641","description":"","creator":{"login":"Sheeo","id":37968,"avatar_url":"https://avatars.githubusercontent.com/u/37968?v=3","gravatar_id":"","url":"https://api.github.com/users/Sheeo","html_url":"https://github.com/Sheeo","followers_url":"https://api.github.com/users/Sheeo/followers","following_url":"https://api.github.com/users/Sheeo/following{/other_user}","gists_url":"https://api.github.com/users/Sheeo/gists{/gist_id}","starred_url":"https://api.github.com/users/Sheeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sheeo/subscriptions","organizations_url":"https://api.github.com/users/Sheeo/orgs","repos_url":"https://api.github.com/users/Sheeo/repos","events_url":"https://api.github.com/users/Sheeo/events{/privacy}","received_events_url":"https://api.github.com/users/Sheeo/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":77,"state":"open","created_at":"2015-01-05T22:51:11Z","updated_at":"2015-06-21T04:26:06Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-06-21T04:25:10Z","updated_at":"2015-06-21T05:40:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/FAForever/fa/pulls/679","html_url":"https://github.com/FAForever/fa/pull/679","diff_url":"https://github.com/FAForever/fa/pull/679.diff","patch_url":"https://github.com/FAForever/fa/pull/679.patch"},"body":"This is not the most beautiful solution to #623 but I can't come up with a better either. Input welcome!\r\n\r\nSo:\r\n\r\nIf a builder is about to rebuild something (decided by a call to GetRebuildBonus) we\r\ncheck in SetRebuildProgress if the actual bonus never was triggered. This\r\nmeans that there's a risk for a disappearing wreck.\r\n\r\nWe then search for the potential wrecks on the map, iff one of these wrecks\r\nare getting destroyed right after (same tick) we just recreate it\r\n\r\nThis scan for wrecks will happen very, very seldom, thus should not impact the\r\noverall performance of the sim\r\n\r\nThere is a minuscule risk that it recreates a wreck that disappeared for some other reason; garbage collected or that it was reclaimed the same tick - but shouldn't be a problem. The clone function sets the mass value of the wreck to the current reclaim progress so it would be worthless anyway. \r\n\r\nFixes #623"},"comment":{"url":"https://api.github.com/repos/FAForever/fa/issues/comments/113865446","html_url":"https://github.com/FAForever/fa/pull/679#issuecomment-113865446","issue_url":"https://api.github.com/repos/FAForever/fa/issues/679","id":113865446,"user":{"login":"ChrisKitching","id":3526849,"avatar_url":"https://avatars.githubusercontent.com/u/3526849?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisKitching","html_url":"https://github.com/ChrisKitching","followers_url":"https://api.github.com/users/ChrisKitching/followers","following_url":"https://api.github.com/users/ChrisKitching/following{/other_user}","gists_url":"https://api.github.com/users/ChrisKitching/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisKitching/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisKitching/subscriptions","organizations_url":"https://api.github.com/users/ChrisKitching/orgs","repos_url":"https://api.github.com/users/ChrisKitching/repos","events_url":"https://api.github.com/users/ChrisKitching/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisKitching/received_events","type":"User","site_admin":false},"created_at":"2015-06-21T05:40:34Z","updated_at":"2015-06-21T05:40:34Z","body":"But yes, at a high level this approach is probably the neatest, as other ways seem to involve large datastructures tracking wrecks, and as you say we really only run the hideously expensive thing in cases where the bug would've been reproduced before.\r\n\r\nUnfortunately, this does lead to some odditites: engineers reclaiming a wreck that gets cloned will stop, and if you move the build template onto another wreck of the right sort it'll still delete the original."}}