Skip to content

Commit

Permalink
Handle edge case where the only unit targetable is a filtered unit
Browse files Browse the repository at this point in the history
  • Loading branch information
xeropresence committed Mar 3, 2020
1 parent ffcced2 commit 283eb57
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion AOPP/TabFilterPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ __declspec(noinline) int __fastcall GetCloseTarget(int a1, void* EDX, Identity_t
typedef int(__thiscall* OriginalFunctionType)(int, Identity_t*, int, int);
char* name = nullptr;
Identity_t starting{};

Identity_t lastKey{ 0xFFFFFFFF,0xFFFFFFFF };
memcpy(&starting, a2, sizeof(Identity_t));

int result;
Expand All @@ -73,6 +73,14 @@ __declspec(noinline) int __fastcall GetCloseTarget(int a1, void* EDX, Identity_t
{
break;
}

if (lastKey.Type != 0xFFFFFFFF && lastKey.Key == a2->Key)
{
memcpy(a2, &starting, sizeof(Identity_t));
break;
}

memcpy(&lastKey, a2, sizeof(Identity_t));
}

return result;
Expand Down

0 comments on commit 283eb57

Please sign in to comment.