Skip to content

Commit 13ae1a6

Browse files
committed
update
1 parent 1c8132f commit 13ae1a6

File tree

4 files changed

+48
-38
lines changed

4 files changed

+48
-38
lines changed

src/Interop/AttachEffect.cpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include "New/Type/AttachEffectTypeClass.h"
55

66
int __stdcall AE_Attach(
7-
void* pTarget,
8-
void* pInvokerHouse,
9-
void* pInvoker,
10-
void* pSource,
7+
TechnoClass* pTarget,
8+
HouseClass* pInvokerHouse,
9+
TechnoClass* pInvoker,
10+
AbstractClass* pSource,
1111
const char** effectTypeNames,
1212
int typeCount,
1313
int durationOverride,
@@ -19,11 +19,6 @@ int __stdcall AE_Attach(
1919
if (!pTarget || !effectTypeNames || typeCount <= 0)
2020
return 0;
2121

22-
TechnoClass* pTargetTechno = static_cast<TechnoClass*>(pTarget);
23-
HouseClass* pInvokerHouseClass = static_cast<HouseClass*>(pInvokerHouse);
24-
TechnoClass* pInvokerTechno = static_cast<TechnoClass*>(pInvoker);
25-
AbstractClass* pSourceAbs = static_cast<AbstractClass*>(pSource);
26-
2722
AEAttachInfoTypeClass attachInfo;
2823

2924
for (int i = 0; i < typeCount; i++)
@@ -50,20 +45,18 @@ int __stdcall AE_Attach(
5045
if (recreationDelay >= -1)
5146
attachInfo.RecreationDelays.push_back(recreationDelay);
5247

53-
return AttachEffectClass::Attach(pTargetTechno, pInvokerHouseClass, pInvokerTechno, pSourceAbs, attachInfo);
48+
return AttachEffectClass::Attach(pTarget, pInvokerHouse, pInvoker, pSource, attachInfo);
5449
}
5550

5651
int __stdcall AE_Detach(
57-
void* pTarget,
52+
TechnoClass* pTarget,
5853
const char** effectTypeNames,
5954
int typeCount
6055
)
6156
{
6257
if (!pTarget || !effectTypeNames || typeCount <= 0)
6358
return 0;
6459

65-
TechnoClass* pTargetTechno = static_cast<TechnoClass*>(pTarget);
66-
6760
AEAttachInfoTypeClass detachInfo;
6861

6962
for (int i = 0; i < typeCount; i++)
@@ -78,20 +71,18 @@ int __stdcall AE_Detach(
7871
if (detachInfo.RemoveTypes.empty())
7972
return 0;
8073

81-
return AttachEffectClass::Detach(pTargetTechno, detachInfo);
74+
return AttachEffectClass::Detach(pTarget, detachInfo);
8275
}
8376

8477
int __stdcall AE_DetachByGroups(
85-
void* pTarget,
78+
TechnoClass* pTarget,
8679
const char** groupNames,
8780
int groupCount
8881
)
8982
{
9083
if (!pTarget || !groupNames || groupCount <= 0)
9184
return 0;
9285

93-
TechnoClass* pTargetTechno = static_cast<TechnoClass*>(pTarget);
94-
9586
AEAttachInfoTypeClass detachInfo;
9687

9788
for (int i = 0; i < groupCount; i++)
@@ -103,19 +94,16 @@ int __stdcall AE_DetachByGroups(
10394
if (detachInfo.RemoveGroups.empty())
10495
return 0;
10596

106-
return AttachEffectClass::DetachByGroups(pTargetTechno, detachInfo);
97+
return AttachEffectClass::DetachByGroups(pTarget, detachInfo);
10798
}
10899

109100
void __stdcall AE_TransferEffects(
110-
void* pSource,
111-
void* pTarget
101+
TechnoClass* pSource,
102+
TechnoClass* pTarget
112103
)
113104
{
114105
if (!pSource || !pTarget)
115106
return;
116107

117-
TechnoClass* pSourceTechno = static_cast<TechnoClass*>(pSource);
118-
TechnoClass* pTargetTechno = static_cast<TechnoClass*>(pTarget);
119-
120-
AttachEffectClass::TransferAttachedEffects(pSourceTechno, pTargetTechno);
108+
AttachEffectClass::TransferAttachedEffects(pSource, pTarget);
121109
}

src/Interop/AttachEffect.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#pragma once
22

3+
#include <TechnoClass.h>
4+
#include <HouseClass.h>
5+
#include <AbstractClass.h>
6+
37
extern "C"
48
{
9+
/// <summary>
10+
/// Attaches AttachEffect instances to a target unit.
11+
/// </summary>
512
__declspec(dllexport) int __stdcall AE_Attach(
6-
void* pTarget,
7-
void* pInvokerHouse,
8-
void* pInvoker,
9-
void* pSource,
13+
TechnoClass* pTarget,
14+
HouseClass* pInvokerHouse,
15+
TechnoClass* pInvoker,
16+
AbstractClass* pSource,
1017
const char** effectTypeNames,
1118
int typeCount,
1219
int durationOverride,
@@ -15,20 +22,29 @@ extern "C"
1522
int recreationDelay
1623
);
1724

25+
/// <summary>
26+
/// Removes AttachEffect instances matching given types from a unit.
27+
/// </summary>
1828
__declspec(dllexport) int __stdcall AE_Detach(
19-
void* pTarget,
29+
TechnoClass* pTarget,
2030
const char** effectTypeNames,
2131
int typeCount
2232
);
2333

34+
/// <summary>
35+
/// Removes AttachEffect instances matching given groups from a unit.
36+
/// </summary>
2437
__declspec(dllexport) int __stdcall AE_DetachByGroups(
25-
void* pTarget,
38+
TechnoClass* pTarget,
2639
const char** groupNames,
2740
int groupCount
2841
);
2942

43+
/// <summary>
44+
/// Transfers AttachEffect instances from one unit to another.
45+
/// </summary>
3046
__declspec(dllexport) void __stdcall AE_TransferEffects(
31-
void* pSource,
32-
void* pTarget
47+
TechnoClass* pSource,
48+
TechnoClass* pTarget
3349
);
3450
}

src/Interop/TechnoExt.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
#include "TechnoExt.h"
22
#include <Ext/Techno/Body.h>
33

4-
extern "C" __declspec(dllexport) bool __stdcall ConvertToType_Phobos(void* pThis, void* toType)
4+
extern "C" __declspec(dllexport) bool __stdcall ConvertToType_Phobos(FootClass* pThis, TechnoTypeClass* toType)
55
{
6-
auto pTechno = static_cast<FootClass*>(pThis);
7-
auto pType = static_cast<TechnoTypeClass*>(toType);
8-
9-
return TechnoExt::ConvertToType(pTechno, pType);
6+
return TechnoExt::ConvertToType(pThis, toType);
107
}

src/Interop/TechnoExt.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#pragma once
22

3+
#include <TechnoTypeClass.h>
4+
#include <FootClass.h>
5+
36
extern "C"
47
{
5-
__declspec(dllexport) bool __stdcall ConvertToType_Phobos(void* pThis, void* toType);
8+
/// <summary>
9+
/// Converts a unit to a different type.
10+
/// </summary>
11+
/// <param name="pThis">Pointer to the FootClass instance to convert</param>
12+
/// <param name="toType">Pointer to the target TechnoTypeClass</param>
13+
/// <returns>true if conversion was successful, false otherwise</returns>
14+
__declspec(dllexport) bool __stdcall ConvertToType_Phobos(FootClass* pThis, TechnoTypeClass* toType);
615
}

0 commit comments

Comments
 (0)