Describe the bug
If the color attribute, provided in RGB, for a vehicle in map file is same as current m_Color (currently both RGB and palette are initialized as 0, 0, 0, 0 in CVehicleColor), the provided color will be ignored and will use randomized color.
To reproduce
Will not be set (interpreted as RGB):
<vehicle color="0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0,0,0,0,0"></vehicle>
Will be set (interpreted as RGB different from own RGB value):
<vehicle color="0,0,1"></vehicle>
<vehicle color="0,0,0,0,0,1"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0,1"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0,0,0,0,1"></vehicle>
Will be set (interpreted as palette color):
<vehicle color="0"></vehicle>
<vehicle color="0,0"></vehicle>
<vehicle color="0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0,0,0,0"></vehicle>
<vehicle color="0,0,0,0,0,0,0,0,0,0,0,0,0"></vehicle>
Expected behaviour
Vehicle color should be set to the provided color.
Version
Multi Theft Auto v1.5.7-release-20402
Additional context
Perhaps add a force attribute for the affected color functions: SetRGBColors, SetPaletteColors. See previous work done for this in #263@00ad397, #263@ff052d3 and #263@274d9b3.
We have to evaluate backwards-compatibility before anyone starts to work on this issue.
_Originally posted by @Woovie in https://github.com/multitheftauto/mtasa-blue/pull/263#issuecomment-575700932_:
I contacted AfuSensi on Discord, who owns/operates/works on Mr. Green's
Search "<vehicle.*color="0,0,0" (1485 hits in 167 files)
Search "<vehicle.*color="([1-255]{1,3}),\1,\1" (82 hits in 33 files)Around 2500 maps total, and this is the total amount of returns.
Any news about this issue? Is there a workaround for this?
Any news about this issue? Is there a workaround for this?
For now you can use the black color provided by the palette, for example:
<vehicle color="0"></vehicle>
<vehicle color="0,0"></vehicle>
<vehicle color="0,0,0,0"></vehicle>
Will not work:
<vehicle color="0,0,0"></vehicle>
"backwards compatibility" nah. Is there any kind of version attribute in the map file? Or would this really be an issue?