Skip to content

Conversation

@patrikjuvonen
Copy link
Contributor

@patrikjuvonen patrikjuvonen commented Feb 22, 2020

Summary

XMLColorToInt is used when parsing i.e. color attribute from map files on various elements such as vehicles, blips, radarareas, teams and so on.

Currently it only supports a single format for multi-value attributes (i.e. vehicles have many colors) and many elements don't support hex color format right now anyway, so this PR adds consistent color attribute behavior across all element types.

So now it is possible to specify separate colors like so:

#ff0, 255, 0, 0, #ff0000, #ffffff55

Which corresponds to:

yellow, red, red, transparent white

And works straight for vehicles.

But most importantly all elements now have consistent color behavior, so for example blips, radarareas, teams can now be passed a hex color value and it will work.

This PR closes #1258.

Tests

A test map file is available for download here.

`XMLColorToInt` is used when parsing i.e. `color` attribute from map files on various elements such as vehicles, blips, radarareas, teams and so on. Before it only supported a single format for multi-value attributes.

So now it is possible to specify separate colors like so:
`#ff0, 255, 0, 0, #ff0000, #ffffff55`

Which corresponds:
yellow, red, red, transparent white
@patrikjuvonen patrikjuvonen added the enhancement New feature or request label Feb 22, 2020
@patrikjuvonen patrikjuvonen added this to the Backlog milestone Feb 22, 2020
@patrikjuvonen patrikjuvonen changed the title Fix #1258: Add mixed hex and RGBA parsing to XMLColorToInt WIP: Fix #1258: Add mixed hex and RGBA parsing to XMLColorToInt Feb 22, 2020
@patrikjuvonen patrikjuvonen changed the title WIP: Fix #1258: Add mixed hex and RGBA parsing to XMLColorToInt Fix #1258: Add mixed hex and RGBA parsing to XMLColorToInt Feb 22, 2020
@patrikjuvonen patrikjuvonen changed the title Fix #1258: Add mixed hex and RGBA parsing to XMLColorToInt Fix #1258: Add mixed hex and RGB(A) parsing to XMLColorToInt Feb 22, 2020
Copy link
Contributor

@qaisjp qaisjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. :shipit:

@qaisjp qaisjp modified the milestones: Backlog, 1.6 Mar 23, 2020
@patrikjuvonen patrikjuvonen self-assigned this Apr 1, 2020
Copy link
Contributor

@qaisjp qaisjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still lgtm

@patrikjuvonen patrikjuvonen merged commit a3695fb into multitheftauto:master Apr 1, 2020
@patrikjuvonen patrikjuvonen deleted the feature/parse-mixed-colors branch April 1, 2020 17:47
patrikjuvonen added a commit that referenced this pull request Apr 28, 2020
…1261)"

This reverts commit a3695fb.

This fixes #1393.

This reopens #1258.

Signed-off-by: Patrik Juvonen <[email protected]>
patrikjuvonen added a commit that referenced this pull request Apr 28, 2020
…orToInt (#1261)""

This reverts commit 3f39bb5.

Signed-off-by: Patrik Juvonen <[email protected]>
@patrikjuvonen patrikjuvonen modified the milestones: 1.5.8, Future Release Aug 5, 2021
patrikjuvonen added a commit that referenced this pull request Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add hex and RGB(A) support to all map color attributes

2 participants