HomeWildfire Games

Implement basic color editing in the options page and use it for the diplomacy…
AuditedrP21527

Description

Implement basic color editing in the options page and use it for the diplomacy colors, refs #4747, rP21107.
Update the RangeOverlay config option only when the options dialog was closed, not each turn, refs rP19519.

Patch By: temple
Differential Revision: https://code.wildfiregames.com/D1291

Event Timeline

vladislavbelov raised a concern with this commit.Mar 12 2018, 6:07 PM
vladislavbelov added a subscriber: vladislavbelov.
vladislavbelov added inline comments.
/ps/trunk/binaries/data/mods/public/gui/options/options.js
14

g_ClosingCallbacks, it's not all callback on the page.

90

Avoid hardcoded values.

/ps/trunk/binaries/data/mods/public/gui/options/options.json
458

Someone was disagree with hardcoding JS-functions in the JSON, no? And the name isn't equal to its meaning.

This commit now has outstanding concerns.Mar 12 2018, 6:07 PM

And we started the FF, no?

I believe a concern shouldn't be raised if there isn't something actually broken. If you want some other function or variable name, ask friendly or convince.
Secondly if you do raise a concern, please at least refer to the arguments posted in the review.

/ps/trunk/binaries/data/mods/public/gui/options/options.json
458

Who is it? I only see comments of myself and I said something about that.
Not sure what you want about the name and it wasn't changed in this commit either.

vladislavbelov added a comment.EditedMar 12 2018, 7:47 PM

I believe a concern shouldn't be raised if there isn't something actually broken. If you want some other function or variable name, ask friendly or convince.
Secondly if you do raise a concern, please at least refer to the arguments posted in the review.

Simple comments are usually forgotten. So I made a note, nothing is non-friendly. I think the name is important, because it uses the noticeable different meaning. Compare: CloseCallbacks vs CallbacksOnEnd and Callbacks vs CallbacksOnClose. The first one is simple, and it won't make a problem, because everyone will understand the meaning. The second one isn't so simple, it not enough tells about itself.

FF?

/ps/trunk/binaries/data/mods/public/gui/options/options.json
458

Yep, it wasn't, but it's used in the other meaning.

nothing is non-friendly.

If you raise a concern, point out an actual defect, not only a variable name.

And we started the FF, no?

Not at the time of the commit.

If you want to raise a concern, do it on rP21524 which introduced that utf8 character that crashes atlas.
I've hence set #4936 back to Alpha 23 as a reminder. At least the description should contain that character ë in Meroë.
Would you be interested into looking into that Atlas utf string crash?

Compare: Callbacks vs CallbacksOnClose

Since there is a comment explaining what it does, I don't see this being a defect. "Functions to call after closing the page."

/ps/trunk/binaries/data/mods/public/gui/options/options.json
458

What is the other meaning?

nothing is non-friendly.

If you raise a concern, point out an actual defect, not only a variable name.

Defect is bad naming, if it doesn't crashes the game, but it doesn't mean that it's not a defect.

And we started the FF, no?

Not at the time of the commit.

10 March, no?

If you want to raise a concern, do it on rP21524 which introduced that utf8 character that crashes atlas.
I've hence set #4936 back to Alpha 23 as a reminder. At least the description should contain that character ë in Meroë.
Would you be interested into looking into that Atlas utf string crash?

Yes, it'd be good to fix it.

Compare: Callbacks vs CallbacksOnClose

Since there is a comment explaining what it does, I don't see this being a defect. "Functions to call after closing the page."

Wrong, we shouldn't use only comments to explain the variable meaning. As I said in the CC post, we not only write code, but also review patches. Look at the more simple example:

// Count of changed states.
var g_Count = ...;
...
function updateState()
{
    g_Count += 1;
}

You will need to find a comment for every variable.

Defect is bad naming, if it doesn't crashes the game, but it doesn't mean that it's not a defect.

Naming is something that can almost always be improved and it would be ok for me to rename, but I don't accept this name being a defect that warrants a red flag.

And we started the FF, no?

Not at the time of the commit.

10 March, no?

It was set to 6 hours after the meeting and I'm not ashamed of having worked until 6:30 in the morning rather than 5 or something.
The FF commit was FeXoRs map description 2 commits / 45 minutes later.

vladislavbelov added a comment.EditedMar 13 2018, 1:25 PM

Naming is something that can almost always be improved and it would be ok for me to rename, but I don't accept this name being a defect that warrants a red flag.

Please, don't think that I'm non-friendly or dislike this commit at all. I only want to follow rules. And I had Request Changes for the diff. Just fix the problem, and I'll accept the commit.

It was set to 6 hours after the meeting and I'm not ashamed of having worked until 6:30 in the morning rather than 5 or something.
The FF commit was FeXoRs map description 2 commits / 45 minutes later.

So I can commit D614? :)

It was set to 6 hours after the meeting and I'm not ashamed of having worked until 6:30 in the morning rather than 5 or something.
The FF commit was FeXoRs map description 2 commits / 45 minutes later.

So I can commit D614? :)

I can't speak for others, but not delaying the release and not delaying the development progress simultaneously would be benefitial IMO. Looks like s0600204 has tested well that it works with all wxWidgets versions and it doesn't break any language freeze since atlas strings are not marked for traslation.
The idea of FF is mostly to prevent us from delaying the release and freezing strings soon, but unless this is terribly broken, it won't cost more release-time than a quick final test and a commit.

temple added a subscriber: temple.Mar 13 2018, 4:03 PM

I don't have objections to renaming.

I don't have objections to renaming.

Me neither, I only don't want to stop working on the things I'm working on and secondly I don't see this as a defect that is above --lint --verbose.
Review guidelines or a similar document say the patch author is the first in line to fix if you want to address some of the 3 mentioned things.

I don't have objections to renaming.

My objection is simple: g_Callbacks isn't equal to g_ClosingCallbacks. It's bad for mods. Now I can't add a callback for the page entering. Because it'll be called on the wrong time.

I don't have objections to renaming.

My objection is simple: g_Callbacks isn't equal to g_ClosingCallbacks. It's bad for mods. Now I can't add a callback for the page entering. Because it'll be called on the wrong time.

Unless that mod uses a different variable name, such as g_OpeningCallbacks.

Me neither, I only don't want to stop working on the things I'm working on and secondly I don't see this as a defect that is above --lint --verbose.
Review guidelines or a similar document say the patch author is the first in line to fix if you want to address some of the 3 mentioned things.

You had objections about getTIPIADBON and SRVHSRES. I have for g_Callbacks. The bad naming is the problem: in both cases you can't say in the code, what is it for. But you have comments for both.

Unless that mod uses a different variable name, such as g_OpeningCallbacks.

Ha, why g_Callbacks for closing and g_OpeningCallbacks for opening? It looks weird.

Me neither, I only don't want to stop working on the things I'm working on and secondly I don't see this as a defect that is above --lint --verbose.
Review guidelines or a similar document say the patch author is the first in line to fix if you want to address some of the 3 mentioned things.

You had objections about getTIPIADBON and SRVHSRES. I have for g_Callbacks. The bad naming is the problem: in both cases you can't say in the code, what is it for. But you have comments for both.

Contrary to getTIPIADBON and SRVHSRES, g_Callbacks does carry connotation, even if not all attributes.

why g_Callbacks for closing and g_OpeningCallbacks for opening? It looks weird.

If a mod contains N ways for callbacks, it should also rename the variabes to support an N+1st way to add callbacks (for all natural numbers N)?
I agree that g_CloseCallbacks is better. Just not on this variable name being a relevant enough property to claim ownership of my time. It's an enhancement, not a defect.

Just not on this variable name being a relevant enough property to claim ownership of my time. It's an enhancement, not a defect.

It's not a defect during development, but we're in the release process. And this name may be in the release, which will affect all mods using it.

elexis requested verification of this commit.Mar 19 2018, 4:17 PM
This commit now requires verification by auditors.Mar 19 2018, 4:17 PM
All concerns with this commit have now been addressed.Mar 19 2018, 4:21 PM
elexis added inline comments.Jul 23 2019, 3:24 PM
/ps/trunk/binaries/data/mods/public/gui/common/color.js
37

There is also new GUIColor() (JSI_GUIColor::construct, but about to nuke that).
That and JSI_IGUIObject::setProperty uses property a instead of alpha, so one cannot do Engine.GetGUIObjectByName("foo").textcolor = guiToRgbColor("12 34 56 78") until thats made consistent (but .textcolor = "12 34 56 78" works).

The function was introduced only for storing the color as a string in config files and all assignments of colors from JS to C++ GUI Objects is done by passing color strings, and JS defines color strings everywhere unless its for modifying the HSL or opaqueness of colors.

The ColorString <-> ColorObject conversion exists in C++ but that conversion is inaccessible unless providing a new ConfigDB_GetColorValue and ConfigDB_CreateColorValue specialized color functions, which sounds ugly (and the existing config functions cant derive from the fact that its a JS object which type it is, unless again it is a JSClass defined in C++ and that iterating through all known JSclasses to determine how it should convert the object. It doesn't seem so bad to have these two functions in a JS Color prototype used by C++ like Vector2D.

(Still alpha -> a.)