FS#869 - vehicles disappear when crossing certain line

Attached to Project: OpenTTD
Opened by Johannes E. Krause (Eddi) - Wednesday, 13 June 2007, 18:40 GMT
Type Bug
Category Interface
Status Closed
Assigned To No-one
Operating System All
Severity Very Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


when trains cross the line (1024+x, x) the wagons disappear for a short time, last tested in r10144
This task depends upon

Closed by  Remko Bijker (Rubidium)
Wednesday, 13 June 2007, 23:14 GMT
Reason for closing:  Fixed
Additional comments about closing:  In r10153.
Comment by Zdeněk Sojka (SmatZ) - Wednesday, 13 June 2007, 19:20 GMT
The problem lies here:

vehicle.cpp, 46:
#define INVALID_COORD (-0x8000)

It your coordinates, the position is computed as INVALID_COORD ( -32768 = 16 * (16 - 1024) * 2 ), so the vehicle is removed etc.
Comment by Zdeněk Sojka (SmatZ) - Wednesday, 13 June 2007, 19:34 GMT

#define INVALID_COORD (0x7fffffff)

In coparisons, there are all 32bit integers.
16 * 2048 * 2 = 65536, so INVALID_COORD is not to be reached

Well, devs could decide any other constant :)