Skip to content

Fix remove agents simulation #15 #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions arcdps_collector/arcdps_collector.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Mock Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
7 changes: 6 additions & 1 deletion arcdps_mock/CombatMock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@ void CombatMock::Execute()
ag destination = {};
FillAgentEvent(agent, mySelfId, source, destination);

source.prof = static_cast<Prof>(1); // indicates this is an agent registration event
if (!agent.removed) {
source.prof = static_cast<Prof>(1); // indicates this is an agent registration event
}
source.elite = 0; // indicates this is an agent registration event

if (myCallbacks->combat != nullptr)
Expand Down Expand Up @@ -370,6 +372,7 @@ void CombatMock::Execute()
{
combatEvent.dst_agent = destinationAgent->UniqueId;
combatEvent.dst_instid = destinationAgent->InstanceId;

}
else
{
Expand Down Expand Up @@ -961,6 +964,8 @@ void CombatMock::DisplayAgents()
ImGui::TableNextColumn();
if (ImGui::SmallButton("remove") == true)
{
iter->removed = true;
Execute();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you misunderstand the interface or that you're trying to use it for something it wasn't designed for

If you look at the "Add" button in the "Add agent" window, it doesn't send an agent registration immediately, it just adds it to the list. Similarly, "remove" doesn't send an agent deregistration immediately, it just removes it from the list. So the call to Execute here is really not following the design of the rest of the program - the idea is that you build up the event sequence you want to send and can press one button to send it all, rather than "real time" sending all the events you want.

With that being said, agent deregistration is indeed not supported. Perhaps there should be a new event type in "Add event" which is "deregister agent"?

Or if your use case is just to reset the state in your addon, I'm not sure if the mock should have a button to dynamically reload the addon? It can get a bit tricky though with making sure the dll actually gets unloaded and so on, as well as anything the dll might have done in the process that's persistent (like mutexes and stuff like that)

iter = myAgents.erase(iter);
}
else
Expand Down
1 change: 1 addition & 0 deletions arcdps_mock/CombatMock.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CombatMock

uint64_t UniqueId = 0;
uint16_t InstanceId = 0;
bool removed = false;
};

enum class CombatEventType : int
Expand Down
4 changes: 2 additions & 2 deletions arcdps_mock/arcdps_mock.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down