{"action":"created","comment":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/37460716","id":37460716,"diff_hunk":"@@ -186,36 +194,48 @@ public bool CanEnterCell(World world, Actor self, CPos cell, Actor ignoreActor =\n \t\t// Determines whether the actor is blocked by other Actors\n \t\tpublic bool CanMoveFreelyInto(World world, Actor self, CPos cell, Actor ignoreActor, CellConditions check)\n \t\t{\n+\t\t\tif (!check.HasCellCondition(CellConditions.TransientActors))\n+\t\t\t\treturn true;\n+\n \t\t\tif (SharesCell && world.ActorMap.HasFreeSubCell(cell))\n \t\t\t\treturn true;\n \n-\t\t\tif (check.HasFlag(CellConditions.TransientActors))\n-\t\t\t{\n-\t\t\t\tvar canIgnoreMovingAllies = self != null && !check.HasFlag(CellConditions.BlockedByMovers);\n-\t\t\t\tvar needsCellExclusively = self == null || Crushes == null || !Crushes.Any();\n-\t\t\t\tforeach (var a in world.ActorMap.GetUnitsAt(cell))\n-\t\t\t\t{\n-\t\t\t\t\tif (a == ignoreActor)\n-\t\t\t\t\t\tcontinue;\n-\n-\t\t\t\t\t// Neutral/enemy units are blockers. Allied units that are moving are not blockers.\n-\t\t\t\t\tif (canIgnoreMovingAllies && self.Owner.Stances[a.Owner] == Stance.Ally && IsMovingInMyDirection(self, a)) continue;\n-\n-\t\t\t\t\t// Non-sharable unit can enter a cell with shareable units only if it can crush all of them.\n-\t\t\t\t\tif (needsCellExclusively)\n-\t\t\t\t\t\treturn false;\n-\t\t\t\t\tvar crushables = a.TraitsImplementing<ICrushable>();\n-\t\t\t\t\tif (!crushables.Any())\n-\t\t\t\t\t\treturn false;\n-\t\t\t\t\tforeach (var crushable in crushables)\n-\t\t\t\t\t\tif (!crushable.CrushableBy(Crushes, self.Owner))\n-\t\t\t\t\t\t\treturn false;\n-\t\t\t\t}\n-\t\t\t}\n+\t\t\tforeach (var otherActor in world.ActorMap.GetUnitsAt(cell))\n+\t\t\t\tif (IsBlockedBy(self, otherActor, ignoreActor, check))\n+\t\t\t\t\treturn false;\n \n \t\t\treturn true;\n \t\t}\n \n+\t\tbool IsBlockedBy(Actor self, Actor otherActor, Actor ignoreActor, CellConditions check)\n+\t\t{\n+\t\t\t// We are not blocked by the actor we are ignoring.\n+\t\t\tif (otherActor == ignoreActor)\n+\t\t\t\treturn false;\n+\n+\t\t\t// If the check allows: we are not blocked by allied units moving in our direction.\n+\t\t\tif (!check.HasCellCondition(CellConditions.BlockedByMovers) &&\n+\t\t\t\tself != null &&\n+\t\t\t\tself.Owner.Stances[otherActor.Owner] == Stance.Ally &&\n+\t\t\t\tIsMovingInMyDirection(self, otherActor))\n+\t\t\t\treturn false;\n+\n+\t\t\t// If we cannot crush the other actor in our way, we are blocked.\n+\t\t\tif (self == null || Crushes == null || Crushes.Length == 0)\n+\t\t\t\treturn true;\n+\n+\t\t\t// If the other actor in our way cannot be crushed, we are blocked.\n+\t\t\tvar crushables = otherActor.TraitsImplementing<ICrushable>();\n+\t\t\tif (!crushables.Any())\n+\t\t\t\treturn true;","path":"OpenRA.Mods.Common/Traits/Mobile.cs","position":75,"original_position":75,"commit_id":"3d94c4b216933bc741c26e15883a837b73cea906","original_commit_id":"3d94c4b216933bc741c26e15883a837b73cea906","user":{"login":"Mailaender","id":756669,"avatar_url":"https://avatars.githubusercontent.com/u/756669?v=3","gravatar_id":"","url":"https://api.github.com/users/Mailaender","html_url":"https://github.com/Mailaender","followers_url":"https://api.github.com/users/Mailaender/followers","following_url":"https://api.github.com/users/Mailaender/following{/other_user}","gists_url":"https://api.github.com/users/Mailaender/gists{/gist_id}","starred_url":"https://api.github.com/users/Mailaender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mailaender/subscriptions","organizations_url":"https://api.github.com/users/Mailaender/orgs","repos_url":"https://api.github.com/users/Mailaender/repos","events_url":"https://api.github.com/users/Mailaender/events{/privacy}","received_events_url":"https://api.github.com/users/Mailaender/received_events","type":"User","site_admin":false},"body":"It is not convention and we also tend to group that in various other location as it helps with readability vs. following a blind preference. Let's try to avoid commenting on minor style issues.","created_at":"2015-08-19T20:02:06Z","updated_at":"2015-08-19T20:02:06Z","html_url":"https://github.com/OpenRA/OpenRA/pull/9105#discussion_r37460716","pull_request_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105","_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments/37460716"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/9105#discussion_r37460716"},"pull_request":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105"}}},"pull_request":{"url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105","id":42756190,"html_url":"https://github.com/OpenRA/OpenRA/pull/9105","diff_url":"https://github.com/OpenRA/OpenRA/pull/9105.diff","patch_url":"https://github.com/OpenRA/OpenRA/pull/9105.patch","issue_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/9105","number":9105,"state":"open","locked":false,"title":"Mobile Blocking Refactor","user":{"login":"RoosterDragon","id":3399086,"avatar_url":"https://avatars.githubusercontent.com/u/3399086?v=3","gravatar_id":"","url":"https://api.github.com/users/RoosterDragon","html_url":"https://github.com/RoosterDragon","followers_url":"https://api.github.com/users/RoosterDragon/followers","following_url":"https://api.github.com/users/RoosterDragon/following{/other_user}","gists_url":"https://api.github.com/users/RoosterDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/RoosterDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoosterDragon/subscriptions","organizations_url":"https://api.github.com/users/RoosterDragon/orgs","repos_url":"https://api.github.com/users/RoosterDragon/repos","events_url":"https://api.github.com/users/RoosterDragon/events{/privacy}","received_events_url":"https://api.github.com/users/RoosterDragon/received_events","type":"User","site_admin":false},"body":"This is a refactoring in Mobile.cs of the logic used to determine if actors block movement.\r\n\r\nThis centralises some duplicated logic in ```CanMoveFreelyInto``` and into ```GetAvailableSubCell``` into a new method and makes some minor changes to squeeze out a bit more performance as the pathfinder calls ```CanMoveFreelyInto``` frequently.\r\n\r\nThis is intended to have no impact on the output of these functions. This means for testing you could record a game on bleed and replaying it with this PR should not desync. That's how I tested it.","created_at":"2015-08-18T22:21:22Z","updated_at":"2015-08-19T20:02:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdaf48ff1467f490ba3d8132f46c6b224426f317","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105/commits","review_comments_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105/comments","review_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/9105/comments","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/3d94c4b216933bc741c26e15883a837b73cea906","head":{"label":"RoosterDragon:cmfi-refactor-perf","ref":"cmfi-refactor-perf","sha":"3d94c4b216933bc741c26e15883a837b73cea906","user":{"login":"RoosterDragon","id":3399086,"avatar_url":"https://avatars.githubusercontent.com/u/3399086?v=3","gravatar_id":"","url":"https://api.github.com/users/RoosterDragon","html_url":"https://github.com/RoosterDragon","followers_url":"https://api.github.com/users/RoosterDragon/followers","following_url":"https://api.github.com/users/RoosterDragon/following{/other_user}","gists_url":"https://api.github.com/users/RoosterDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/RoosterDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoosterDragon/subscriptions","organizations_url":"https://api.github.com/users/RoosterDragon/orgs","repos_url":"https://api.github.com/users/RoosterDragon/repos","events_url":"https://api.github.com/users/RoosterDragon/events{/privacy}","received_events_url":"https://api.github.com/users/RoosterDragon/received_events","type":"User","site_admin":false},"repo":{"id":20080394,"name":"OpenRA","full_name":"RoosterDragon/OpenRA","owner":{"login":"RoosterDragon","id":3399086,"avatar_url":"https://avatars.githubusercontent.com/u/3399086?v=3","gravatar_id":"","url":"https://api.github.com/users/RoosterDragon","html_url":"https://github.com/RoosterDragon","followers_url":"https://api.github.com/users/RoosterDragon/followers","following_url":"https://api.github.com/users/RoosterDragon/following{/other_user}","gists_url":"https://api.github.com/users/RoosterDragon/gists{/gist_id}","starred_url":"https://api.github.com/users/RoosterDragon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoosterDragon/subscriptions","organizations_url":"https://api.github.com/users/RoosterDragon/orgs","repos_url":"https://api.github.com/users/RoosterDragon/repos","events_url":"https://api.github.com/users/RoosterDragon/events{/privacy}","received_events_url":"https://api.github.com/users/RoosterDragon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RoosterDragon/OpenRA","description":"An open-source implementation of the Red Alert engine using .NET/mono and OpenGL. Runs on Windows, Linux and Mac OS X.","fork":true,"url":"https://api.github.com/repos/RoosterDragon/OpenRA","forks_url":"https://api.github.com/repos/RoosterDragon/OpenRA/forks","keys_url":"https://api.github.com/repos/RoosterDragon/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RoosterDragon/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RoosterDragon/OpenRA/teams","hooks_url":"https://api.github.com/repos/RoosterDragon/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/RoosterDragon/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/RoosterDragon/OpenRA/events","assignees_url":"https://api.github.com/repos/RoosterDragon/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/RoosterDragon/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/RoosterDragon/OpenRA/tags","blobs_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RoosterDragon/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/RoosterDragon/OpenRA/languages","stargazers_url":"https://api.github.com/repos/RoosterDragon/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/RoosterDragon/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/RoosterDragon/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/RoosterDragon/OpenRA/subscription","commits_url":"https://api.github.com/repos/RoosterDragon/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/RoosterDragon/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/RoosterDragon/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/RoosterDragon/OpenRA/issues/comments{/number}","contents_url":"https://api.github.com/repos/RoosterDragon/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/RoosterDragon/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RoosterDragon/OpenRA/merges","archive_url":"https://api.github.com/repos/RoosterDragon/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RoosterDragon/OpenRA/downloads","issues_url":"https://api.github.com/repos/RoosterDragon/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/RoosterDragon/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/RoosterDragon/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/RoosterDragon/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RoosterDragon/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/RoosterDragon/OpenRA/releases{/id}","created_at":"2014-05-22T23:21:53Z","updated_at":"2015-05-08T18:52:20Z","pushed_at":"2015-08-18T22:25:27Z","git_url":"git://github.com/RoosterDragon/OpenRA.git","ssh_url":"git@github.com:RoosterDragon/OpenRA.git","clone_url":"https://github.com/RoosterDragon/OpenRA.git","svn_url":"https://github.com/RoosterDragon/OpenRA","homepage":"http://open-ra.org","size":91865,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"bleed"}},"base":{"label":"OpenRA:bleed","ref":"bleed","sha":"83b310713deb15c05d810a6524ad4f3d87d8300c","user":{"login":"OpenRA","id":409046,"avatar_url":"https://avatars.githubusercontent.com/u/409046?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"repo":{"id":959908,"name":"OpenRA","full_name":"OpenRA/OpenRA","owner":{"login":"OpenRA","id":409046,"avatar_url":"https://avatars.githubusercontent.com/u/409046?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenRA","html_url":"https://github.com/OpenRA","followers_url":"https://api.github.com/users/OpenRA/followers","following_url":"https://api.github.com/users/OpenRA/following{/other_user}","gists_url":"https://api.github.com/users/OpenRA/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenRA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenRA/subscriptions","organizations_url":"https://api.github.com/users/OpenRA/orgs","repos_url":"https://api.github.com/users/OpenRA/repos","events_url":"https://api.github.com/users/OpenRA/events{/privacy}","received_events_url":"https://api.github.com/users/OpenRA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenRA/OpenRA","description":"Open Source real-time strategy game engine for early Westwood games such as Command & Conquer: Red Alert written in C# using SDL and OpenGL. Runs on Windows, Linux, *BSD and Mac OS X.","fork":false,"url":"https://api.github.com/repos/OpenRA/OpenRA","forks_url":"https://api.github.com/repos/OpenRA/OpenRA/forks","keys_url":"https://api.github.com/repos/OpenRA/OpenRA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenRA/OpenRA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenRA/OpenRA/teams","hooks_url":"https://api.github.com/repos/OpenRA/OpenRA/hooks","issue_events_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/events{/number}","events_url":"https://api.github.com/repos/OpenRA/OpenRA/events","assignees_url":"https://api.github.com/repos/OpenRA/OpenRA/assignees{/user}","branches_url":"https://api.github.com/repos/OpenRA/OpenRA/branches{/branch}","tags_url":"https://api.github.com/repos/OpenRA/OpenRA/tags","blobs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenRA/OpenRA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenRA/OpenRA/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenRA/OpenRA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenRA/OpenRA/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenRA/OpenRA/languages","stargazers_url":"https://api.github.com/repos/OpenRA/OpenRA/stargazers","contributors_url":"https://api.github.com/repos/OpenRA/OpenRA/contributors","subscribers_url":"https://api.github.com/repos/OpenRA/OpenRA/subscribers","subscription_url":"https://api.github.com/repos/OpenRA/OpenRA/subscription","commits_url":"https://api.github.com/repos/OpenRA/OpenRA/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenRA/OpenRA/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenRA/OpenRA/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenRA/OpenRA/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenRA/OpenRA/contents/{+path}","compare_url":"https://api.github.com/repos/OpenRA/OpenRA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenRA/OpenRA/merges","archive_url":"https://api.github.com/repos/OpenRA/OpenRA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenRA/OpenRA/downloads","issues_url":"https://api.github.com/repos/OpenRA/OpenRA/issues{/number}","pulls_url":"https://api.github.com/repos/OpenRA/OpenRA/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenRA/OpenRA/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenRA/OpenRA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenRA/OpenRA/labels{/name}","releases_url":"https://api.github.com/repos/OpenRA/OpenRA/releases{/id}","created_at":"2010-10-04T07:38:05Z","updated_at":"2015-08-19T19:41:56Z","pushed_at":"2015-08-19T19:52:42Z","git_url":"git://github.com/OpenRA/OpenRA.git","ssh_url":"git@github.com:OpenRA/OpenRA.git","clone_url":"https://github.com/OpenRA/OpenRA.git","svn_url":"https://github.com/OpenRA/OpenRA","homepage":"http://www.openra.net","size":187543,"stargazers_count":2088,"watchers_count":2088,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":748,"mirror_url":null,"open_issues_count":868,"forks":748,"open_issues":868,"watchers":2088,"default_branch":"bleed"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105"},"html":{"href":"https://github.com/OpenRA/OpenRA/pull/9105"},"issue":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/9105"},"comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/issues/9105/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenRA/OpenRA/pulls/9105/commits"},"statuses":{"href":"https://api.github.com/repos/OpenRA/OpenRA/statuses/3d94c4b216933bc741c26e15883a837b73cea906"}}}}