Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong var 45 value #2546

Closed
DorpsGek opened this issue Jan 16, 2009 · 9 comments
Closed

Wrong var 45 value #2546

DorpsGek opened this issue Jan 16, 2009 · 9 comments
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

George opened the ticket and wrote:

R15097

// front part
440 * 14 02 01 23 81 45 08 FF 01 00 00 01 02 13 00
441 * 14 02 01 25 81 45 08 FF 01 00 00 0E 0F 15 00
442 * 22 02 01 2F 81 9F 00 07 03
23 00 03 03
14 00 04 04
25 00 05 05
00 00

The code should draw the front part if the back part has the same direction (for directions 03 and 05), but it does not update (or calculates wrong) var 45 right after the turn, that makes one invisible state, where the back parts decides that front part starts to draw the vehicle, while the the front part does not start to do so.

Attachments

Reported version: trunk
Operating system: Windows


This issue was imported from FlySpray: https://bugs.openttd.org/task/2546
@DorpsGek
Copy link
Member Author

George wrote:

and a version with front part report (report fail text for front part)

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5352

@DorpsGek
Copy link
Member Author

frosch wrote:

v->cur_image is updated after each part has been moved.
To fix this, all images need updating after all parts have been moved.

Same applies to trains.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5355

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Wouldn't this NewGRF be horribly broken when the vehicle crashes and gets random orientations? It could be in basically any state, even 180 degrees between the parts.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5391

@DorpsGek
Copy link
Member Author

George wrote:

Rubidium: Yes, the degree can be 180, but it can happen and when RV turns around, for example. So, support for every degree between parts is planned.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5396

@DorpsGek
Copy link
Member Author

Rubidium wrote:

We need to update cur_image while it's being moved as only one vehicle can be moved at a time. Unless we completely turn this behaviour around it won't be possible to update cur_image outside of the loop without glitches.

So fixing this would basically mean adding _old_vehicle_coords to the vehicle struct just to support this. I'm not sure whether that's worth the effort. Or is it cheaper to just mark the viewports before and after moving instead of keeping track of what needs to be marked and mark them at the same time?


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5743

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Marking the viewports twice costs about 1.5 to 2% more CPU with ~500 trains.

Moveing the _old_vehicle_coords into the vehicle struct costs about 2 to 3% less CPU with ~500 trains (need to confirm this on other systems). The location where EndVehicleMove (and thus the viewport update) was called has not been changed.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5752

@DorpsGek
Copy link
Member Author

frosch wrote:

just to add: if the position hash depends on the sprite size, that is also a desyncer, as sprites can be changed with static grfs resp. 32bpp


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5759

@DorpsGek
Copy link
Member Author

Rubidium wrote:

The position hash depends on the sprite size. However... the position hash is only used for adding vehicles to the viewport. The "new vehicle position hash" uses v->tile and is used by the game's internals.

So there's no chance of desyncs here.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546#comment5760

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r15677.


This comment was imported from FlySpray: https://bugs.openttd.org/task/2546

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) component: NewGRF This issue is related to NewGRFs bug labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant