FS#5222 - Order of checks in commands need verification

Attached to Project: OpenTTD
Opened by Kogut (Kogut) - Tuesday, 26 June 2012, 19:16 GMT
Last edited by andythenorth (andythenorth) - Tuesday, 15 August 2017, 17:45 GMT
Type Work in progress
Category Core
Status Closed
Assigned To andythenorth (andythenorth)
Operating System All
Severity Low
Priority Normal
Reported Version Version?
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


if somebody attempts adding rail that is impossible due to terrain, on tile occupied by train reported error will be "train in the way" instead of "land sloped in wrong direction"

This task depends upon

Closed by  andythenorth (andythenorth)
Tuesday, 15 August 2017, 17:45 GMT
Reason for closing:  Won't implement
Additional comments about closing:  Mass closure of patch tickets with no commentary for >5 years. Goal is to reduce patch queue as an experiment to see if it aids faster reviewing and rejection/acceptance (it may not). If this offends you and the patch is maintained and compiles with current trunk, discuss with andythenorth in irc. (andythenorth has no ability to review patches but can re-open tickets).
Comment by Alberth (Alberth) - Saturday, 07 July 2012, 09:27 GMT
In general, checks are ordered to make failure as cheap as possible. Easy and fast checks are performed first so failure does not waste a lot of CPU time.

I verified this instance, and it seems to make sense in this case to swap the checks (patch attached).
That in turn means our code is not optimal in this respect. All commands should be verified for the order of checks.
Can you please find out which checks are in the wrong order? (In terms of increasing CPU costs.)