{"action":"created","issue":{"url":"https://api.github.com/repos/chrsmith/bwapi/issues/104","labels_url":"https://api.github.com/repos/chrsmith/bwapi/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/chrsmith/bwapi/issues/104/comments","events_url":"https://api.github.com/repos/chrsmith/bwapi/issues/104/events","html_url":"https://github.com/chrsmith/bwapi/issues/104","id":58380348,"number":104,"title":"wrong interpretation of the unit array","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/Performance","name":"Performance","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-Enhancement","name":"Type-Enhancement","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2015-02-20T17:01:37Z","updated_at":"2015-02-20T17:01:42Z","closed_at":null,"body":"```\nIn \"Unit.h\" UnitArray is declared. It is then Used in \"GameImpl.cpp\" to \niterate through the units.\n\nThere is no such thing as a UnitArray! Each unit has got a pointer to it's \nprevious and next item, and there are pointer to the first and last items \nand the total item amount declared somewhere in Offsets.h. All this \nclearly indicates that the unit list is implemented as an std::deque\n\nstd utilizes an old trick to reduce memory reallocation, it allocates its \nown huge memory chunks/arrays and distributes the elements among the \ndeques in that program. That UnitArray is a consequence of someone \nmisinterpreting this memory chunk for an actual array. Fact is, that this \nmemory chunk can contain foreign elements (not from the unit-list) and \nmany elements that ARE in the unit-list will be not in this chunk.\n\nFixing this will fix problems such as \"Right-clicking on enemy unit does \nnot always result in attack command\"\n```\n\n-----\nOriginal issue reported on code.google.com by `goo...@teabix.com` on 16 Nov 2009 at 11:33"},"comment":{"url":"https://api.github.com/repos/chrsmith/bwapi/issues/comments/75274290","html_url":"https://github.com/chrsmith/bwapi/issues/104#issuecomment-75274290","issue_url":"https://api.github.com/repos/chrsmith/bwapi/issues/104","id":75274290,"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-20T17:01:42Z","updated_at":"2015-02-20T17:01:42Z","body":"```\nwill add this technique when commiting the unit support. But currently a scheme \nto \nreduce code repetitiveness in BridgeServer and BridgeClient has my full \nattention\n(man those files became so unreadable..)\n```\n\n-----\nOriginal comment by `goo...@teabix.com` on 11 Dec 2009 at 12:44"}}