-
-
Notifications
You must be signed in to change notification settings - Fork 128
Export interface for external call #2131
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
TaranDahl
wants to merge
4
commits into
Phobos-developers:develop
Choose a base branch
from
TaranDahl:Interop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,3 +27,5 @@ out | |
|
|
||
| # Python virtual environment for docs | ||
| .venv/ | ||
|
|
||
| debug.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,234 @@ | ||
|
|
||
| # Interoperability | ||
|
|
||
| This page documents the exported interfaces in [Interop](https://github.com/Phobos-developers/Phobos/tree/develop/src/Interop). | ||
|
|
||
| ## API Version Tracking | ||
|
|
||
| Phobos tracks Interop API versions using build numbers. Each exported API is labeled with its availability range: | ||
| - **[startBuild, endBuild)**: API is available from build `startBuild` up to (but not including) build `endBuild`. | ||
| - **[startBuild, ∞)**: API is still active and has no planned removal date. | ||
|
|
||
| ### GetInteropBuildNumber | ||
|
|
||
| ```cpp | ||
| unsigned int GetInteropBuildNumber() | ||
| ``` | ||
|
|
||
| Returns the current Phobos Interop build number. Use this to detect which APIs are available. | ||
|
|
||
| **Availability:** [48, ∞) | ||
|
|
||
| ### Deprecated API Handling | ||
|
|
||
| When an API is deprecated, its function stub is retained but with a fatal error handler. The calling application will receive a descriptive error message and must stop execution. This ensures: | ||
| 1. Broken links are immediately detected at runtime (not a crash). | ||
| 2. Clear messaging guides developers to the replacement API. | ||
| 3. Migration timeline is documented in the error message. | ||
|
|
||
| **Example** (not currently in use): | ||
|
|
||
| ```cpp | ||
| // DEPRECATED: Removed after build 52. Use NewAPI instead. | ||
| // Calling this will trigger a fatal error with the message: | ||
| // "SomeOldAPI_Deprecated has been removed (was available until build 52). Please use NewAPI." | ||
| ``` | ||
|
|
||
| ### API Availability Table | ||
|
|
||
| | API | Signature | Availability | Notes | | ||
| |-----|-----------|---------------|-------| | ||
| | AE_Attach | `int AE_Attach(...)` | [48, ∞) | Still active | | ||
| | AE_Detach | `int AE_Detach(...)` | [48, ∞) | Still active | | ||
| | AE_DetachByGroups | `int AE_DetachByGroups(...)` | [48, ∞) | Still active | | ||
| | AE_TransferEffects | `void AE_TransferEffects(...)` | [48, ∞) | Still active | | ||
| | ConvertToType_Phobos | `bool ConvertToType_Phobos(...)` | [48, ∞) | Still active | | ||
| | Bullet_SetFirerOwner | `bool Bullet_SetFirerOwner(...)` | [48, ∞) | Still active | | ||
| | EventExt_AddEvent | `bool EventExt_AddEvent(...)` | [48, ∞) | Still active | | ||
|
|
||
| ## New type and entity | ||
|
|
||
| ### AttachEffect | ||
|
|
||
| AttachEffect interop APIs allow external code to attach, detach, and transfer attach effects on units. | ||
|
|
||
| #### AE_Attach | ||
|
|
||
| ```cpp | ||
| int AE_Attach( | ||
| TechnoClass* pTarget, | ||
| HouseClass* pInvokerHouse, | ||
| TechnoClass* pInvoker, | ||
| AbstractClass* pSource, | ||
| const char** effectTypeNames, | ||
| int typeCount, | ||
| int durationOverride, | ||
| int delay, | ||
| int initialDelay, | ||
| int recreationDelay | ||
| ) | ||
| ``` | ||
|
|
||
| Attaches one or more AttachEffect types to the target. | ||
|
|
||
| **Availability:** [48, ∞) | ||
|
|
||
| - Parameters: | ||
| - pTarget: Target unit to receive effects. | ||
| - pInvokerHouse: Invoker house context. | ||
| - pInvoker: Invoker techno context. | ||
| - pSource: Optional source object context. | ||
| - effectTypeNames: Array of AttachEffect type names. | ||
| - typeCount: Number of entries in effectTypeNames. | ||
| - durationOverride: If non-zero, duration override is applied. | ||
| - delay: If >= 0, delay override is applied. | ||
| - initialDelay: If >= 0, initial delay override is applied. | ||
| - recreationDelay: If >= -1, recreation delay override is applied. | ||
| - Returns: | ||
| - > 0 on success (value returned by internal attach routine). | ||
| - 0 on failure. | ||
| - Fails when: | ||
| - pTarget is null. | ||
| - effectTypeNames is null. | ||
| - typeCount <= 0. | ||
| - No valid effect type name resolves to an existing AttachEffectType. | ||
|
|
||
| #### AE_Detach | ||
|
|
||
| ```cpp | ||
| int AE_Detach( | ||
| TechnoClass* pTarget, | ||
| const char** effectTypeNames, | ||
| int typeCount | ||
| ) | ||
| ``` | ||
|
|
||
| Detaches effects by explicit effect type names. | ||
|
|
||
| - Parameters: | ||
| - pTarget: Target unit to remove effects from. | ||
| - effectTypeNames: Array of AttachEffect type names to remove. | ||
| - typeCount: Number of entries in effectTypeNames. | ||
| **Availability:** [48, ∞) | ||
| - Returns: | ||
| - > 0 on success (value returned by internal detach routine). | ||
| - 0 on failure. | ||
| - Fails when: | ||
| - pTarget is null. | ||
| - effectTypeNames is null. | ||
| - typeCount <= 0. | ||
| - No valid effect type name resolves to an existing AttachEffectType. | ||
|
|
||
| #### AE_DetachByGroups | ||
|
|
||
| ```cpp | ||
| int AE_DetachByGroups( | ||
| TechnoClass* pTarget, | ||
| const char** groupNames, | ||
| int groupCount | ||
| ) | ||
| ``` | ||
|
|
||
| Detaches effects by AttachEffect group name. | ||
|
|
||
| - Parameters: | ||
| - pTarget: Target unit to remove effects from. | ||
| - groupNames: Array of group names. | ||
| - groupCount: Number of entries in groupNames. | ||
| **Availability:** [48, ∞) | ||
| - Returns: | ||
| - > 0 on success (value returned by internal detach-by-group routine). | ||
| - 0 on failure. | ||
| - Fails when: | ||
| - pTarget is null. | ||
| - groupNames is null. | ||
| - groupCount <= 0. | ||
| - groupNames contains no non-null entries. | ||
|
|
||
| #### AE_TransferEffects | ||
|
|
||
| ```cpp | ||
| void AE_TransferEffects( | ||
| TechnoClass* pSource, | ||
| TechnoClass* pTarget | ||
| ) | ||
| ``` | ||
|
|
||
| Transfers all attached effects from source to target. | ||
|
|
||
| - Parameters: | ||
| - pSource: Source unit. | ||
| - pTarget: Target unit. | ||
|
|
||
| **Availability:** [48, ∞) | ||
|
|
||
| - Behavior: | ||
| - No operation if pSource or pTarget is null. | ||
|
|
||
| ## Vanilla class extension | ||
|
|
||
| ### TechnoExt | ||
|
|
||
| #### ConvertToType_Phobos | ||
|
|
||
| ```cpp | ||
| bool ConvertToType_Phobos(FootClass* pThis, TechnoTypeClass* toType) | ||
| ``` | ||
|
|
||
| Converts a FootClass instance to another TechnoType. | ||
|
|
||
| - Parameters: | ||
| - pThis: Unit to convert. | ||
| - toType: Destination TechnoType. | ||
|
|
||
| **Availability:** [48, ∞) | ||
|
|
||
| - Returns: | ||
| - true if conversion succeeds. | ||
| - false if conversion fails. | ||
| - Notes: | ||
| - This API forwards directly to TechnoExt::ConvertToType. | ||
|
|
||
| ### BulletExt | ||
|
|
||
| #### Bullet_SetFirerOwner | ||
|
|
||
| ```cpp | ||
| bool Bullet_SetFirerOwner(BulletClass* pBullet, HouseClass* pHouse) | ||
| ``` | ||
|
|
||
| Updates the recorded firer house for a bullet extension. | ||
|
|
||
| - Parameters: | ||
| - pBullet: Bullet instance. | ||
| - pHouse: New firer house (can be null if caller intentionally clears ownership). | ||
|
|
||
| **Availability:** [48, ∞) | ||
|
|
||
| - Returns: | ||
| - true if the bullet extension is found and updated. | ||
| - false on failure. | ||
| - Fails when: | ||
| - pBullet is null. | ||
| - No BulletExt entry exists for pBullet. | ||
|
|
||
| ### EventExt | ||
|
|
||
| #### EventExt_AddEvent | ||
|
|
||
| ```cpp | ||
| bool EventExt_AddEvent(EventExt* pEventExt) | ||
| ``` | ||
|
|
||
| Invokes AddEvent on an EventExt object. | ||
|
|
||
| - Parameters: | ||
| - pEventExt: Event extension instance. | ||
|
|
||
| **Availability:** [48, ∞) | ||
|
|
||
| - Returns: | ||
| - false if pEventExt is null. | ||
| - Otherwise, returns the result of pEventExt->AddEvent(). | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.