was there a train bug in depot?
Moderator: OpenTTD Developers
was there a train bug in depot?
I think I remember reading this, but I'm not sure.
was there a bug that under some situations made the train appear about 20 squares away from depot?
was there a bug that under some situations made the train appear about 20 squares away from depot?
Creator of the Openttd Challenge Spinoff, Town Demand patch
After action reports: The path to riches, A dream of skyscrapers
After action reports: The path to riches, A dream of skyscrapers
There was and is a bug which happens if you click on the "pass red signal" button while a train is halfway into the depot.
I don't think it's serious enough to need fixing, basically, people just have to not push this button
[edit] Oops, I didn't notice this was the OpenTTD forum... so the above bug exists in TTD, and depending how closely OpenTTD follows its code, may or may not exist there.
I don't think it's serious enough to need fixing, basically, people just have to not push this button

[edit] Oops, I didn't notice this was the OpenTTD forum... so the above bug exists in TTD, and depending how closely OpenTTD follows its code, may or may not exist there.
The bug was that the train would go out as soon as it went in, not that it appears 20 squares away. Anyway this should be fixed, cos whenever I press it when the train is sitting at a red light one square away from the depot it does this. I then can't get it to go in the depot and if you have limited space you can do nothing other than crash the damn train and wait for the wreckage to go away. Which f***s up your ratings.



I ask this because there's a macro in ottd that seems to be to wrong to me...
it has to do with calculating coordinates
#define TILE_FROM_XY(x,y) (((((y) & ~0xF) <<
+ (x)) >> 4)
this a bit of bit shifting going on here...
~0xf is the bit pattern 1111111111110000 thus masks the last 4 bits.
then the result of the mask gets shifted left 8 places
so there are 12 zeros at the end.... for a map size of 256 that should be 8.
so that's an erroneous multiplication by 16...
am I wrong?
it has to do with calculating coordinates
#define TILE_FROM_XY(x,y) (((((y) & ~0xF) <<

this a bit of bit shifting going on here...
~0xf is the bit pattern 1111111111110000 thus masks the last 4 bits.
then the result of the mask gets shifted left 8 places
so there are 12 zeros at the end.... for a map size of 256 that should be 8.
so that's an erroneous multiplication by 16...
am I wrong?
Creator of the Openttd Challenge Spinoff, Town Demand patch
After action reports: The path to riches, A dream of skyscrapers
After action reports: The path to riches, A dream of skyscrapers
it is because x and y are not tiles, but 1/16 tile. Removing the last 4 bits makes it tile coordinatesKorenn wrote:I ask this because there's a macro in ottd that seems to be to wrong to me...
it has to do with calculating coordinates
#define TILE_FROM_XY(x,y) (((((y) & ~0xF) <<+ (x)) >> 4)
this a bit of bit shifting going on here...
~0xf is the bit pattern 1111111111110000 thus masks the last 4 bits.
then the result of the mask gets shifted left 8 places
so there are 12 zeros at the end.... for a map size of 256 that should be 8.
so that's an erroneous multiplication by 16...
am I wrong?
well duuh read my post thoroughly before answering please.
the y coordinate at the end is in total shifted by 12
8 because of the shift, and 4 because the last 4 bits are masked.
the y coordinate at the end is in total shifted by 12
8 because of the shift, and 4 because the last 4 bits are masked.
Creator of the Openttd Challenge Spinoff, Town Demand patch
After action reports: The path to riches, A dream of skyscrapers
After action reports: The path to riches, A dream of skyscrapers
Note that in the end it's again shifted 4 to the right (check the parens!) and that's exactly right. It becomes the upper byte of a 16 bit value, with the lower byte being the x tile coordinate.
I.e. 0xxx, 0yyy becomes yyxx, with the last 4 bits of each (the position within the tile) being discarded.
I.e. 0xxx, 0yyy becomes yyxx, with the last 4 bits of each (the position within the tile) being discarded.
oooooh the y value is also shifted right!
ofc.... d'oh!
ofc.... d'oh!
Creator of the Openttd Challenge Spinoff, Town Demand patch
After action reports: The path to riches, A dream of skyscrapers
After action reports: The path to riches, A dream of skyscrapers
Who is online
Users browsing this forum: No registered users and 14 guests