OpenXcom Forum

OpenXcom Forks => OXCE Bugs => OpenXcom Extended (OXCE) => OXCE Bugs FIXED => Topic started by: Extremator on March 18, 2025, 01:00:55 pm

Title: [FIXED] It is possible to go into negative global funds, when selling a facility
Post by: Extremator on March 18, 2025, 01:00:55 pm
Modders actively use the negative cost of demolishing structures for their own insidious purposes!
If a negative price is specified, then you can destroy the structure by losing more money than you had. Is it possible to somehow prevent this and block this type of operation?

As an option: At the game engine level, change "Return -$100000" to "Costs $100000" if the cost of this action is less than 0.
Title: Re: Return to negative cost
Post by: Delian on March 18, 2025, 01:06:16 pm
Might also be useful to colorize the cost number red or green.
Title: Re: Return to negative cost
Post by: Extremator on March 18, 2025, 01:10:17 pm
I support this!

As well as the ability to enter colortags for text.
|c00ff0000to_red_text|r or [ color=#ff0000]to_red_text[ /color] > to_red_text
Title: Re: Return to negative cost
Post by: Meridian on March 18, 2025, 01:14:10 pm
Is it possible to somehow prevent this and block this type of operation?

Read, and don't click the button?

Might also be useful to colorize the cost number red or green.

There is no red or green text color in basescape.

The only available colors are:
- UFO: white, lightblue, gold, pink, purple
- TFTD: white, lightblue, lightgreen
Title: Re: Return to negative cost
Post by: Extremator on March 18, 2025, 01:18:54 pm
Read, and don't click the button?

I can't build structures if I don't have the money for them. But I can make "improvements" if I don't have the money for them. Do you understand the difference? Or am I expressing myself incorrectly?

(I am not a student of English, sorry...)
Title: Re: Return to negative cost
Post by: Delian on March 18, 2025, 02:09:51 pm
There is no red or green text color in basescape.

Elaborate. The "dismantleFacility" has only those 5 colors defined for the elements but, isn't it possible to add more colors to an interface? The basescape palette does have red and green colors, no?
Title: Re: Return to negative cost
Post by: Meridian on March 18, 2025, 02:31:18 pm
Elaborate. The "dismantleFacility" has only those 5 colors defined for the elements but, isn't it possible to add more colors to an interface? The basescape palette does have red and green colors, no?

the UFO basescape palette has only 5 text colors (or better said color ranges):
1. white: 208 (209-213)
2. lightblue: 218 (219-223)
3. gold: 213 (214-218)
4. pink: 241 (242-246)
5. purple: 246 (247-251)

All other color ranges were not meant for text and look like shit (or worse).
Title: Re: [Bug] It is possible to go into negative global funds, when selling a facility
Post by: Meridian on March 18, 2025, 04:59:54 pm
Here visually.
Title: Re: [Bug] It is possible to go into negative global funds, when selling a facility
Post by: Extremator on March 18, 2025, 05:16:58 pm
Please note that the original discussion was not about a color palette for text, but about a message about "return -$100,000", which I would like to replace with "need $100,000". And if nothing is returned - then a completely different text (as an alternative for styling the mod).

Also, I would like to draw attention to the fact that sometimes some items are needed, and this is visible during construction. Is it possible to expand and add this information in case of demolition of buildings? (show what will be returned)

And what about negative expenses for the maintenance of buildings? Is it possible to also replace the display of this line with "Income" and remove the negative sign? ;)
Title: Re: [Bug] It is possible to go into negative global funds, when selling a facility
Post by: Yankes on March 18, 2025, 06:07:52 pm
One solution I would see is simply add optional transnational like:
Code: [Select]
translation = "STR_REFUND_VALUE";
negative_translation = "STR_REFUND_VALUE_NEGATIVE";
if (tr(negative_translation).exist() and value < 0)
{
    value *= -1;
    translation= negative_translation;
}
setText(tr(translation).arg(value));
Title: Re: [Bug] It is possible to go into negative global funds, when selling a facility
Post by: Meridian on March 18, 2025, 06:10:12 pm
I can't build structures if I don't have the money for them. But I can make "improvements" if I don't have the money for them. Do you understand the difference? Or am I expressing myself incorrectly?

Yes, understood.
It will be fixed.

Please note that the original discussion was not about a color palette for text, but about a message about "return -$100,000", which I would like to replace with "need $100,000".

Can be done.

And if nothing is returned - then a completely different text (as an alternative for styling the mod).

When nothing is returned, nothing is shown, for vanilla backwards-compatibility.

Also, I would like to draw attention to the fact that sometimes some items are needed, and this is visible during construction. Is it possible to expand and add this information in case of demolition of buildings? (show what will be returned)

Yes, it is possible.
Please note that the original discussion was not about this.

And what about negative expenses for the maintenance of buildings? Is it possible to also replace the display of this line with "Income" and remove the negative sign? ;)

Yes, it is possible.
Please note that the original discussion was not about this.

I support this!

As well as the ability to enter colortags for text.
|c00ff0000to_red_text|r or [ color=#ff0000]to_red_text[ /color] > to_red_text


Not doable.
Please note that the original discussion was not about this.
Title: Re: [Bug] It is possible to go into negative global funds, when selling a facility
Post by: Delian on March 18, 2025, 06:33:00 pm
Here visually.

I see. So we'd need to extend the existing Text surface, because it's currently hardcoded (https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Interface/Text.cpp#L557) to 5(4?)-size color ranges, but the two color ranges that are interesting (red and green) have 16 colors each.
Title: Re: [Bug] It is possible to go into negative global funds, when selling a facility
Post by: Extremator on March 18, 2025, 06:34:29 pm
Please note that the original discussion was not about this.
Yes, I understand that.

I have a lot of ideas, but I can't describe them all in detail and separately. So I mention something close in meaning.
Title: Re: [Bug] It is possible to go into negative global funds, when selling a facility
Post by: Yankes on March 18, 2025, 06:46:52 pm
I see. So we'd need to extend the existing Text surface, because it's currently hardcoded (https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Interface/Text.cpp#L557) to 5(4?)-size color ranges, but the two color ranges that are interesting (red and green) have 16 colors each.
Not text surface, surface have 255 colors like any other graphic, problem is font have limited range of values set, and if you apply offset to mach some range
of colors from 255, only one that Meridian show look right as they where designed to used by fonts.

Final color of font character color is `common_offset + pixel` and fonts have `pixel` range of 0-4 values. Offset can be `200` or different depending what color you want.
If I understand correctly to allow other colors we would need add multiplier to `pixel` to have it bigger range than now to have better gradient.
Title: Re: [FIXED] It is possible to go into negative global funds, when selling a facility
Post by: Meridian on March 23, 2025, 11:27:41 am
Fixed: https://github.com/MeridianOXC/OpenXcom/commit/94d3f3825b31a84167fe2db05e319dce25f82733

Code: [Select]
  STR_REFUND_VALUE: "Sales value> {ALT}{0}"
  STR_REFUND_VALUE_NEGATIVE: "Expenses> {ALT}{0}"
Title: Re: [FIXED] It is possible to go into negative global funds, when selling a facility
Post by: Extremator on March 25, 2025, 12:03:58 am
Doesn't it seem logical to you to add variations for the name of dismantling?
If the money is returned - it's dismantling. But if the money needs to be spent - what to call it?
Is it possible to add an alternative name only if dismantling causes the appearance of another structure?
Is it possible to add variations of such names for each type of structure separately?

Should I write about all this separately?  :D
Title: Re: [FIXED] It is possible to go into negative global funds, when selling a facility
Post by: Yankes on March 25, 2025, 01:40:04 am
dismantling building usually need money as it require labor to take things apart, and in many cases you do not get anything worth from it, maybe scraps.
Title: Re: [FIXED] It is possible to go into negative global funds, when selling a facility
Post by: Meridian on March 25, 2025, 09:43:40 am
1. Doesn't it seem logical to you to add variations for the name of dismantling?
2. If the money is returned - it's dismantling. But if the money needs to be spent - what to call it?
3. Is it possible to add an alternative name only if dismantling causes the appearance of another structure?
4. Is it possible to add variations of such names for each type of structure separately?

5. Should I write about all this separately?  :D

1. to me, no
2. also dismantling... when you dismantle an old house you inherited from your grandmother to build a new one in its place it also costs you money, no? quite a lot of money actually
3. yes
4. yes

5. you can, but I do modding requests only for modders, so don't expect much/anything to happen: https://openxcom.org/forum/index.php?topic=11631.msg166226#msg166226