{"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":58520940,"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":15,"created_at":"2015-02-22T21:40:39Z","updated_at":"2015-02-22T21:40: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/75462318","html_url":"https://github.com/chrsmith/bwapi/issues/104#issuecomment-75462318","issue_url":"https://api.github.com/repos/chrsmith/bwapi/issues/104","id":75462318,"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:40:41Z","updated_at":"2015-02-22T21:40:41Z","body":"```\nDon't mind my bad naming\n\n.data:006283E8 unknown_CurrentCycleIndex dd ?\n.data:006283EC FirstHiddenUnitPointer dd ?\n.data:006283F0 usedUnitCount dd ?\n.data:006283F4 UnknownPtr? dd ?\n.data:006283F8 playerUnitPointers dd ?\n.data:006283FC dd ?\n.data:00628400 dd ?\n.data:00628404 dd ?\n.data:00628408 dd ?\n.data:0062840C dd ?\n.data:00628410 dd ?\n.data:00628414 dd ?\n.data:00628418 dd ?\n.data:0062841C dd ?\n.data:00628420 dd ?\n.data:00628424 p12FirstUnitPointer dd ?\n.data:00628428 LastHiddenUnitPointer dd ?\n.data:0062842C unknownPointer? dd ?\n.data:00628430 firstUnitPointer dd ?\n.data:00628434 unkUnitPointer dd ?\n.data:00628438 firstEmptyUnitPointer dd ?\n.data:0062843C lastEmptyUnitPointer dd ?\n\n\n.data:0059CCA8 CUnitStruct db 571200 dup(?)\n\nRestart/New Game (shows constant size):\n.text:0049F3BE xor     esi, esi\n.text:0049F3C0 xor     eax, eax\n.text:0049F3C2 mov     ecx, 142800\n.text:0049F3C7 mov     edi, offset CUnitStruct\n.text:0049F3CC rep stosd\n.text:0049F3CE mov     ecx, 12\n.text:0049F3D3 mov     edi, offset playerUnitPointers\n.text:0049F3D8 rep stosd \n\n```\n\n-----\nOriginal comment by `AHeinerm` on 16 Nov 2009 at 3:11"}}