Author Topic: [DONE][Suggestion] A way to display statCaps on the soldier info screen  (Read 2566 times)

Offline MaxMahem

  • Captain
  • ***
  • Posts: 60
    • View Profile
While playing xpz (and I assume it would be similar for any other long-running mod), I have often desired to see if a soldier has reached the cap of their stat. But this information is not displayed anywhere, and it can be hard to keep track of mentally what a soldier's stat caps are when there are many different soldier types in play.

This enhancement was so mild I thought it would be a good low-hanging fruit to try and do myself, so I did. I have already sent in a pull request with this new "stat cap" feature. When a soldier's stat is at its cap, it will be displayed in the color2 color, which is configurable. A demonstration mod is also included in the pull request.



« Last Edit: March 29, 2023, 10:08:14 am by Meridian »

Offline Juku121

  • Commander
  • *****
  • Posts: 1793
  • We're all mad here.
    • View Profile
Re: [Suggestion] A way to display statCaps on the soldier info screen
« Reply #1 on: February 21, 2023, 05:50:16 pm »
From a purely practical viewpoint, I've found reversed Stat Strings to work better. Although these do have the drawback of working poorly with several relatively similar soldier types. So Piratez with its multitude of minions would likely benefit more from this.

« Last Edit: February 21, 2023, 05:52:11 pm by Juku121 »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: [Suggestion] A way to display statCaps on the soldier info screen
« Reply #2 on: February 21, 2023, 05:55:55 pm »
This enhancement was so mild I thought it would be a good low-hanging fruit to try and do myself, so I did. I have already sent in a pull request with this new "stat cap" feature. When a soldier's stat is at its cap, it will be displayed in the color2 color, which is configurable. A demonstration mod is also included in the pull request.

Feature looks OK to me.

I will remove the standard mod though. OXCE doesn't provide any standard mods... if we did, there would be thousands of them already and that's not my goal.

I'll make some tiny changes in the code and merge manually.

PS: welcome to the forum Max

Offline MaxMahem

  • Captain
  • ***
  • Posts: 60
    • View Profile
Re: [Suggestion] A way to display statCaps on the soldier info screen
« Reply #3 on: February 21, 2023, 08:31:42 pm »
PS: welcome to the forum Max

Good to be here.

Offline MaxMahem

  • Captain
  • ***
  • Posts: 60
    • View Profile
Re: [Suggestion] A way to display statCaps on the soldier info screen
« Reply #4 on: February 23, 2023, 06:40:26 am »
I will remove the standard mod though. OXCE doesn't provide any standard mods... if we did, there would be thousands of them already and that's not my goal.

I'll make some tiny changes in the code and merge manually.

Sorry to double-post, but do you mind if I ask what changes were desired in the code I wrote? I was hesitant to rewrite so much of the existing method in a lambda,  but my dummie brain was having trouble with copy-paste errors, and I got a bit fed up with it (I also saw that the existing code was like C++03 so lambda's weren't even an option at the time). A-okay with hacking up whatever, I just want to conform to existing styles/preferences as much as possible, so possible future submissions could hopefully be accepted with a minimum of friction (I'm also fairly new to C++, so I don't know what style sins I might inadvertently be committing).

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: [Suggestion] A way to display statCaps on the soldier info screen
« Reply #5 on: February 23, 2023, 08:41:02 am »
Your code is OK, already satisfies "minimum friction" as you say.

The tiny changes I had in mind when reading the PR:

1/ "const UnitStats max = _soldier->getRules()->getStatCaps();"

Here, we make an unnecessary copy of a read-only field. I wanted to change it to "const UnitStats& max", but I see now that RuleSoldier class doesn't actually have a method that returns a const reference. I'll add such methods and refactor code later. So, you didn't make any mistake here.

2/ "typedef UnitStats::Type Type;"

I don't like anything that's called just "Type". I will either give it a less generic name, or probably just remove it completely. But that's just a personal preference.

3/ "Text *number"

Even though we have all three kinds of formatting in the code (T* x, T *x and T * x), the preferred one is "Text* number" and should be used in all newly written code.


PS: rewriting using lambda makes sense in this case and is welcome. OXC still dwells on keeping the C++03 compatibility (to support old and rare hardware/OS), but we don't share this sentiment in OXCE. The primary goal of OXCE is to bring Xcom to new hardware/OS. OXC (and unfortunately still also OXCE) has serious issues running on newer Macs and newer Linux distros, we've became "too old" ourselves. Hopefully we'll be able to upgrade before someone starts the OpenOpenXcom project :) FYI, OXCE currently supports C++17 and we'll allow C++20 probably sometime in 2024.

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: [DONE][Suggestion] A way to display statCaps on the soldier info screen
« Reply #6 on: November 03, 2023, 01:13:23 am »
This new feature is really a good idea   :)