Repository navigation
Conversation
|
Tested this on top of current master (72bf89c), Windows. Getter first: on master TextDrawGetPreviewVehicleColours and PlayerTextDrawGetPreviewVehicleColours give -1, -1 for a vehicle preview with no colours set. With this PR they give a pair that really exists in carcols for that model (checked against GetRandomCarColPair), it stays the same after hide/show, and -1, 1 only randomizes the first colour. Explicit colours and non-vehicle models work like before. Then in game (0.3.7-R5): two Infernus previews side by side, the left one with no colours and the right one set to whatever the server reports for the left one. On master they come out different (blue and red in my case), since the server says -1, -1 and the client rolls its own. With this PR both show the same colour every time, also after recreating them a few times, and hiding/showing the left one doesn't change it. Same idea as #1232, which got closed without a review. LGTM from testing. |
Fixes #1071
When a model preview textdraw shows a vehicle and the colours were never set, the server keeps them as -1 and sends -1 to the client. The client then picks a random colour from carcols on its own, so the server never knows what is actually shown, and "(Player)TextDrawGetPreviewVehCol" returns "-1, -1". This change makes the server pick the colours instead, using "getRandomVehilceColour" (the same that vehicles use when spawned with -1 colours). The picked colors is what gets sent to clients and what the get returns, so they always match.
Details:
before, each client picked its own random colour on every show, so different players could see different colours on the same global textdraw. Now the colour is picked once per textdraw and everyone sees the same one, which makes more sense to me.
Tested on Windows with latest 1.6.7.3218 realase.