Skip to content
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

Game object stats refactor, pt. 2 #3617

Merged
merged 10 commits into from
Feb 5, 2024

Conversation

ManManson
Copy link
Member

The patchset consists of the following high-level changes:

  • Introduce stat getter member functions for DROID_TEMPLATE, replace direct uses of global stat arrays by calls to these member getters.
  • Convert free functions for getting droid-related stats into member functions of DROID class.
  • Move getWeaponStats(weaponSlot) from DROID to BASE_OBJECT to make it possible to use it for STRUCTURE instances.

Signed-off-by: Pavel Solodovnikov [email protected]

Replace direct uses of `asBodyStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Replace direct uses of `asBrainStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Replace direct uses of `asPropulsionStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Replace direct uses of `asSensorStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Replace direct uses of `asECMStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Replace direct uses of `asRepairStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Replace direct uses of `asConstructStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Replace direct uses of `asWeaponStats` for `DROID_TEMPLATE`
instances with calls to the corresponding member function.

Signed-off-by: Pavel Solodovnikov <[email protected]>
…DROID` class

These are not `inline` anymore, since it would
introduce cyclic dependencies between `droiddef.h`
and `objectdef.h` headers.

More refactorings may be needed until this can be made
inline again. Although, it may not be even necessary,
if there is no clear performance penalty, AFAICS.

I don't really see any of these functions to
have a measurable impact on performance when I
did some CPU profiling after the changes.

Signed-off-by: Pavel Solodovnikov <[email protected]>
Moved `getWeaponStats()` from `DROID` to `BASE_OBJECT`,
so that `STRUCTURE` class can also use it.

Actually, `BASE_OBJECT` may not be the best place to
store `asWeaps` and other weaponry-related data,
since `FEATURE` class doesn't use them at all (one of
the direct descendants of `BASE_OBJECT`).

But, for the time being, let it remain in `BASE_OBJECT`,
so that the diff is kept relatively small and easy-to-review.

Signed-off-by: Pavel Solodovnikov <[email protected]>
@ManManson ManManson force-pushed the stats_refactor_continued branch from edd1917 to 82c0417 Compare February 2, 2024 17:00
@ManManson
Copy link
Member Author

Seems like CI failure for the Flatpak job is unrelated to the PR:

error: Unable to load summary from remote flathub: While fetching https://dl.flathub.org/repo/summary.idx: [7] Couldn't connect to server

Is there a way to retrigger the job? @past-due

@KJeff01
Copy link
Member

KJeff01 commented Feb 5, 2024

Sometimes CI just fails for intermittent reasons.

@KJeff01 KJeff01 added this to the 4.5.0-beta1 milestone Feb 5, 2024
@KJeff01 KJeff01 merged commit 5242445 into Warzone2100:master Feb 5, 2024
35 checks passed
@ManManson ManManson deleted the stats_refactor_continued branch March 16, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants